{"id":160,"date":"2015-08-06T13:33:21","date_gmt":"2015-08-06T13:33:21","guid":{"rendered":"https:\/\/ruimoreira.co.uk\/?p=160"},"modified":"2015-08-06T13:34:06","modified_gmt":"2015-08-06T13:34:06","slug":"centos-redhat-remove-old-kernel-versions","status":"publish","type":"post","link":"https:\/\/ruimoreira.co.uk\/?p=160","title":{"rendered":"Centos \/ Redhat  Remove old kernel versions"},"content":{"rendered":"<p>Hello again<\/p>\n<p>So today I started installing a few updates on one of my servers (centos 7) and had the following issue , I could not install the new kernel version because there was not enough disk space in \/boot to accommodate the new kernel , so I went about removing the old files, and solving this problem permanently , so first I installed yum-utils<\/p>\n<p>#yum install yum-utils<\/p>\n<p>Then I used the package-cleanup utility (handy python script , yay python!!! )\u00a0 that allows us to remove duplicate or orphaned packages.<\/p>\n<p>Here is an example<\/p>\n<p>#package-cleanup &#8211;oldkernels &#8211;count=2<\/p>\n<p>so what this does is that it removes old kernels and keeps only the last 2 .<\/p>\n<p>So this does what we want , which is to remove the older version of the kernel , however we might have this problem again in the future . Looking for a solution I have checked \/etc\/yum.conf and there we have the option<\/p>\n<p><strong>installonly_limit=5<\/strong><\/p>\n<p>according to Red Hat and their deployment guide present <a href=\"https:\/\/access.redhat.com\/documentation\/en-US\/Red_Hat_Enterprise_Linux\/6\/html\/Deployment_Guide\/sec-Configuring_Yum_and_Yum_Repositories.html\" target=\"_blank\">here<\/a><\/p>\n<p><strong><span class=\"term\"><code class=\"option\">installonly_limit<\/code>=<em class=\"replaceable\">value<\/em><\/span><\/strong><\/p>\n<div class=\"para\">\u2026where <em class=\"replaceable\">value<\/em> is an integer representing the maximum number of versions that can be installed simultaneously for any single package listed in the <code class=\"option\">installonlypkgs<\/code> directive.<\/div>\n<div class=\"para\">The defaults for the <code class=\"option\">installonlypkgs<\/code> directive include several different kernel packages, so be aware that changing the value of <code class=\"option\">installonly_limit<\/code> will also affect the maximum number of installed versions of any single kernel package. The default value listed in <code class=\"filename\">\/etc\/yum.conf<\/code> is <code class=\"option\">installonly_limit=3<\/code>, and it is not recommended to decrease this value, particularly below <code class=\"literal\">2<\/code>.<\/div>\n<p>&nbsp;<\/p>\n<p>So , I changed the yum.conf to read<\/p>\n<p><strong>installonly_limit=2<\/strong><\/p>\n<p>There , we have avoided this problem.<\/p>\n<p>Of course that this has an impact on how many old versions of the kernel you wish to keep , and I do recommend that you set this value taking into account your needs &#8230; but for me at this point I feel that 2 is enough .<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello again So today I started installing a few updates on one of my servers (centos 7) and had the following issue , I could not install the new kernel version because there was not enough disk space in \/boot to accommodate the new kernel , so I went about removing the old files, and &hellip; <a href=\"https:\/\/ruimoreira.co.uk\/?p=160\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Centos \/ Redhat  Remove old kernel versions<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6,60,16,22],"tags":[79,3,80],"wppr_data":{"cwp_meta_box_check":"No","cwp_rev_product_name":"","cwp_rev_product_image":"","cwp_image_link":"image","cwp_rev_price":""},"_links":{"self":[{"href":"https:\/\/ruimoreira.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/160"}],"collection":[{"href":"https:\/\/ruimoreira.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ruimoreira.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ruimoreira.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ruimoreira.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=160"}],"version-history":[{"count":2,"href":"https:\/\/ruimoreira.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/160\/revisions"}],"predecessor-version":[{"id":162,"href":"https:\/\/ruimoreira.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/160\/revisions\/162"}],"wp:attachment":[{"href":"https:\/\/ruimoreira.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ruimoreira.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ruimoreira.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}