Ask Your Question
7

How to delete old kernel version from grub.

asked 2013-02-26 06:42:32 -0500

abracadabra gravatar image

updated 2014-05-11 13:57:38 -0500

mether gravatar image

Hi guys i have one questions. How to delete old kernel version from grub.

Thank you.

edit retag flag offensive close merge delete

Comments

rpm -q kernel

  • package kernel is not installed. What now?
andrejci gravatar imageandrejci ( 2015-10-04 17:24:22 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
11

answered 2013-02-26 07:15:21 -0500

FranciscoD_ gravatar image

Answering the grub2 question since that's what your heading refers to. (Please ask another question about kate and we'll answer that one too :)).

You have two kernels in grub because there are two kernels installed. One is the original that was installed when you installed fedora, another that was installed during a software update. I have two of them too:

[ankur@dhcppc1  tabs]$ rpm -q kernel
kernel-3.7.8-202.fc18.x86_64
kernel-3.7.9-201.fc18.x86_64
[ankur@dhcppc1  tabs]$

By default, Fedora will retain the three latest kernels. This is to ensure that you always have a working kernel installed, in case the latest update breaks something. To change the number of kernels you have installed, change the value of the installonly_limit variable in /etc/yum.conf. It would be 3 by default.

You can remove the older kernel by using:

sudo yum remove kernel

Yum does not remove the kernel currently in use.

If you want to be extra careful, you can instead provide the entire version of the kernel package you want removed:

sudo yum remove kernel-3.7.8-202.fc18.x86_64

You can see what kernel you're using currently using the uname command:

[ankur@dhcppc1  tabs]$ uname -r
3.7.9-201.fc18.x86_64

If you have enough space on disk, I'd suggest you keep at least 2 kernels around. I generally keep 4 ;)

edit flag offensive delete link more

Comments

Ok thank you. I will try to change topic name. To "how to delete the old kernel". Anyway i cant use kedit. Cant found it. And after installing kate i can use kate with my account (not sudo) so i cant edit file, and when i use su and enter my su password i can't use kate give me some errors:

abracadabra gravatar imageabracadabra ( 2013-02-26 07:21:29 -0500 )edit
1

Thanx for this information, I also had this same question;]

hawkfeather gravatar imagehawkfeather ( 2013-04-25 22:44:40 -0500 )edit

always saving my life. I would erase instead is that I a little harsh? srsrs

Andre Ferreira gravatar imageAndre Ferreira ( 2013-06-19 19:52:20 -0500 )edit

I think yum erase and yum remove do the same thing. Not sure though. Will have to confirm from the yum folks.

FranciscoD_ gravatar imageFranciscoD_ ( 2013-06-19 22:33:46 -0500 )edit

how about to remove old kernel, i want to use just the latest kernel that i have. i am using fedora 22, i had updated 2 times, so i have fedora 4.0.x ; 4.1.3 ; and the latest version today 4.1.5. how to remove them, and delete it on boot menu.

yonkyunior gravatar imageyonkyunior ( 2015-08-24 16:51:20 -0500 )edit
0

answered 2017-11-09 03:26:26 -0500

jjmonrod gravatar image

Another way to do it:

dnf install yum-utils
package-cleanup --oldkernels --count=2

This will leave the last 2 kernels and remove all the old ones.

edit flag offensive delete link more
-1

answered 2013-11-24 02:14:16 -0500

techtonik gravatar image

updated 2013-12-14 06:14:58 -0500

yum automatically keeps only 3 last kernels, but it may miss info about kernels that are left after going from from F18 to F19 by reinstalling. In that case /boot partition will still contain old files.

To remove old distribution kernels from /boot, you may use the following:

cd /boot; sudo rm -fr $(ls|grep fc18)

Took it from hxxp://fedoraforum.org/forum/showthread.php?t=287162
And you may want to regenerate the menu afterwards:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg
edit flag offensive delete link more

Comments

Don't know why this has been down voted. As clearly indicated some kernels get left over when upgrading, from f23 to f24 in my case. The solution works perfectly and I would have up voted if I had enough points

marcosaluzzo gravatar imagemarcosaluzzo ( 2016-12-12 13:19:57 -0500 )edit

Your answer helped me, it was exactly what I was looking for. thank you. It don't deserve to be downvoted.

apieum gravatar imageapieum ( 2018-10-07 04:06:21 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2013-02-26 06:42:32 -0500

Seen: 47,641 times

Last updated: Dec 14 '13