{"id":8432,"date":"2013-12-09T07:01:07","date_gmt":"2013-12-09T06:01:07","guid":{"rendered":"http:\/\/nolabnoparty.com\/?p=8432"},"modified":"2014-11-28T13:55:35","modified_gmt":"2014-11-28T12:55:35","slug":"removing-old-kernels-yum-centos","status":"publish","type":"post","link":"https:\/\/nolabnoparty.com\/en\/removing-old-kernels-yum-centos\/","title":{"rendered":"Removing old kernels with yum in CentOS"},"content":{"rendered":"<p><img decoding=\"async\" class=\"aligncenter\" style=\"margin: 10px auto 5px; padding-left: 0px; padding-right: 0px; float: none; padding-top: 0px; border-width: 0px;\" title=\"removekernelyum01\" alt=\"removekernelyum01\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2013\/12\/removekernelyum01.jpg\" width=\"602\" height=\"202\" border=\"0\" \/><\/p>\n<p>Removing old kernels with <em>yum<\/em> is a good way to keep Linux systems clean because during the update process old kernels are not automatically deleted.<\/p>\n<p>After a while the system runs out of space due to old versions left in the system. Because the <strong>boot partition<\/strong> is normally small in size, about 200 MB, out of space issue related to the partition can heavily affects the system functionality.<\/p>\n<p><!--more--><\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" style=\"margin: 0px auto; padding-left: 0px; padding-right: 0px; float: none; padding-top: 0px; border-width: 0px;\" title=\"removekernelyum02\" alt=\"removekernelyum02\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2013\/12\/removekernelyum02.jpg\" width=\"600\" height=\"150\" border=\"0\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Procedure<\/h2>\n<p>To free some disk space old kernels can be <strong>safely removed<\/strong> from the system. To check installed kernels type the following command:<\/p>\n<p><span style=\"color: #0000a0;\"># rpm -q kernel<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" style=\"margin: 0px auto; padding-left: 0px; padding-right: 0px; float: none; padding-top: 0px; border-width: 0px;\" title=\"removekernelyum03\" alt=\"removekernelyum03\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2013\/12\/removekernelyum03.jpg\" width=\"600\" height=\"121\" border=\"0\" \/><\/p>\n<p>To <strong>remove versions no longer in use<\/strong> using the <em>yum<\/em> command in a \"different way\", we need to install the <strong>yum-utils package<\/strong>.<\/p>\n<p><span style=\"color: #0000a0;\"># yum install yum-utils<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" style=\"margin: 0px auto; padding-left: 0px; padding-right: 0px; float: none; padding-top: 0px; border-width: 0px;\" title=\"removekernelyum04\" alt=\"removekernelyum04\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2013\/12\/removekernelyum04.jpg\" width=\"600\" height=\"470\" border=\"0\" \/><\/p>\n<p>Of course to delete old kernels it's always possible to use the classic <strong>yum remove <\/strong>command.<\/p>\n<blockquote><p>yum remove kernel-xxxxxxxxxxx<\/p><\/blockquote>\n<p><span style=\"color: #0000a0;\"># yum remove kernel-2.6.32-358.6.2.el6.x86_64<\/span><\/p>\n<p>What if you are not aware of old kernels number installed in the system and you want to <strong>remove them leaving only the last two or three versions<\/strong>? A cool solution found in the blog <a href=\"http:\/\/www.if-not-true-then-false.com\/\" target=\"_blank\" rel=\"noopener\">If Not True Then False<\/a> uses the command inside <em>yum-utils<\/em> package to achieve this goal. From the console type the following instruction:<\/p>\n<p># <span style=\"color: #0000a0;\">package-cleanup --oldkernels --count=<strong>2<\/strong><\/span><\/p>\n<p>Where \"<strong>2<\/strong>\" is the number of kernels to leave installed.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" style=\"margin: 0px auto; padding-left: 0px; padding-right: 0px; float: none; padding-top: 0px; border-width: 0px;\" title=\"removekernelyum05\" alt=\"removekernelyum05\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2013\/12\/removekernelyum05.jpg\" width=\"600\" height=\"482\" border=\"0\" \/><\/p>\n<p>Typing <strong>y<\/strong> to confirm, all installed kernels are removed with the exception of the last two versions.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" style=\"margin: 0px auto; padding-left: 0px; padding-right: 0px; float: none; padding-top: 0px; border-width: 0px;\" title=\"removekernelyum06\" alt=\"removekernelyum06\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2013\/12\/removekernelyum06.jpg\" width=\"600\" height=\"304\" border=\"0\" \/><\/p>\n<p>Checking once again the <strong>installed kernels<\/strong>, we found exactly the two packages previously specified.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" style=\"margin: 0px auto; padding-left: 0px; padding-right: 0px; float: none; padding-top: 0px; border-width: 0px;\" title=\"removekernelyum07\" alt=\"removekernelyum07\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/2013\/12\/removekernelyum07.jpg\" width=\"600\" height=\"70\" border=\"0\" \/><\/p>\n<p>This solution allows the administrators to quickly remove old kernels leaving the <strong>system clean<\/strong>\u00a0and keeping performances and disk usage under control.<\/p>\n<p><img decoding=\"async\" alt=\"firma\" src=\"https:\/\/nolabnoparty.com\/wp-content\/uploads\/images\/firma.jpg\" title=\"\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Removing old kernels with yum is a good way to keep Linux systems clean because during the update process old kernels are not automatically deleted. After a while the system runs out of space due to old versions left in the system. Because the boot partition is normally small in size, about 200 MB, out of space issue related to the partition can heavily affects the system functionality.<\/p>\n","protected":false},"author":3,"featured_media":8425,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rop_custom_images_group":[],"rop_custom_messages_group":[],"rop_publish_now":"initial","rop_publish_now_accounts":{"linkedin_93tdZWzMZc_93tdZWzMZc":"","facebook_2879994398731222_17841400390232720":"","twitter_113568041_113568041":"","mastodon_115463926174894442_115463926174894442":""},"rop_publish_now_history":[],"rop_publish_now_status":"pending","footnotes":""},"categories":[892],"tags":[610,702,614],"class_list":["post-8432","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-en","tag-centos-en","tag-remove-en","tag-yum-en","has_thumb"],"_links":{"self":[{"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/posts\/8432","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/comments?post=8432"}],"version-history":[{"count":0,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/posts\/8432\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/media\/8425"}],"wp:attachment":[{"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/media?parent=8432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/categories?post=8432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nolabnoparty.com\/en\/wp-json\/wp\/v2\/tags?post=8432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}