PDA

View Full Version : Automatically Remove GRUB Entries



donkeyend
2nd February 2011, 01:51 AM
I'm trying to automatically remove some of the old GRUB entries that pile up after a few updates and just want to leave live 2 or 3 there along with my Win7 entry. I was looking and saw that there is a utility for Ubuntu but I couldn't find anything for Fedora. Anyone know how to do this? Thank you!

stoat
2nd February 2011, 02:00 AM
You shouldn't need to do that. The rpm script that installs or uninstalls a kernel also takes care of the grub.conf file. And removing an unwanted kernel is easy to do with rpm or yum. But manually deleting menu entries for installed kernels from the grub.conf without actually uninstalling the kernels is a bad idea IMO. Besides, just doing that would not remove the 100 MB or so of disk space being used by a kernel. You can, however, configure yum to retain fewer installed kernels than the default three.

bodhi.zazen
2nd February 2011, 02:05 AM
I'm trying to automatically remove some of the old GRUB entries that pile up after a few updates and just want to leave live 2 or 3 there along with my Win7 entry. I was looking and saw that there is a utility for Ubuntu but I couldn't find anything for Fedora. Anyone know how to do this? Thank you!

Even better, Fedora only keeps 2 old kernels by default, so as you receive updated kernels, the old will be removed and grub updated.

donkeyend
2nd February 2011, 02:11 AM
But manually deleting kernels from the grub.conf without actually uninstalling the kernel is a bad idea IMO.
hmm never thought about that, sounds good though lol.


You can, however, configure yum to retain fewer or more kernels than the default three.
how could i go about doing that?

---------- Post added at 05:11 PM ---------- Previous post was at 05:06 PM ----------


Even better, Fedora only keeps 2 old kernels by default, so as you receive updated kernels, the old will be removed and grub updated.
i must have accidentally configured something differently then because i have a bunch lol

stoat
2nd February 2011, 02:13 AM
Edit /etc/yum.conf and decrease (or increase) the value of installonly_limit. The default is three which causes yum to hang on to the two most recent old kernels. Those two plus the current kernel are the three that installonly_limit means.




i must have accidentally configured something differently then because i have a bunch lol After checking /etc/yum.conf, then find out if all of those really are installed...
rpm -qa | grep kernel | sortIf you're willing, post that. Also post the grub.conf file. It might be interesting.

donkeyend
2nd February 2011, 02:15 AM
awesome! thank you all very much :-)

giulix
2nd February 2011, 10:55 AM
There's also a utility that is installed as part of yum-utils called package-cleanup that has a specific option for removing old kernels:


su - -c "package-cleanup --oldkernels --count=n"

will remove old kernels keeping the last n (default=2)

sidebrnz
2nd February 2011, 10:13 PM
Thank you. I recently upgraded to F 14 and ended up with the F 14 kernel in grub.conf and the last three F 13 kernels. It's not a matter of space, but it's sloppy and I wanted to tidy things up.