PDA

View Full Version : Remove old Kernels?



thebean
15th June 2004, 12:20 PM
Hey all, if there were steps I should take to remove older kernel versions? I'd hate to keep them from piling up.

I guess I should first be asking if it's safe to remove the old kernel?

Right now I just edit /etc/grub.conf and remove the boot option for the previous kernel. Anything else I can do?

Thanks

TheBean

Jman
15th June 2004, 02:42 PM
If you can boot from the new one, it should be safe. Keeping the old one leaves it for backup if something should go wrong.

To remove it run as root
rpm -e kernel-version in a terminal (Main Menu > System Tools > Terminal) where version is the full release number. Enter
rpm -q kernel to get the installed kernels.

crackers
15th June 2004, 05:11 PM
Using the rpm command will also clean up your grub.conf, by the way...

thebean
15th June 2004, 06:30 PM
thanks!

ashmew2
20th May 2009, 07:41 AM
Such an old thread but still works like a charm...Thank You :)

pixaroglets
27th June 2009, 08:24 PM
damn right! :)

Diomedea
1st October 2009, 11:47 AM
One observation: those who have the nvidia driver installed have to first remove the kmod package for the kernel version they want to eliminate. That can be done with Add/Remove Software.

JuanC
2nd December 2009, 07:37 AM
One observation: those who have the nvidia driver installed have to first remove the kmod package for the kernel version they want to eliminate. That can be done with Add/Remove Software.
You can do better by using yum:

yum remove kernel-version it will also remove dependencies like nvidia kmods

smurffit
10th December 2009, 11:01 PM
Does someone has an idea how to remove self-compiled kernel which were made with make && make_modules && make install?

marko
10th December 2009, 11:37 PM
Another good way is to have yum remove the oldest Nth kernel whenever the next kernel is installed by editing the /etc/yum.conf file
to put in (3 kernels retained for an example)


installonlyn = 3

or you can edit the file in
/etc/yum/pluginconf.d/installonlyn.conf

to set the number you want.

sambo
19th December 2010, 08:23 PM
I had previously updated from FC10 to FC11. Now I'm wanting to continue updating to newer kernels but attempts to remove old kernels are unsucessful due to failed depedencies as yum remove and rpm -e both fail with a diagnostic message.

rpm -e kernel-2.6.30.9-102.fc11.x86_64
error: Failed dependencies:
kernel-uname-r = 2.6.27.29-170.2.78.fc10.x86_64 is needed by (installed) kmod-nvidia-2.6.27.29-170.2.78.fc10.x86_64-180.60-1.fc10.1.x86_64
kernel-uname-r = 2.6.27.30-170.2.82.fc10.x86_64 is needed by (installed) kmod-nvidia-2.6.27.30-170.2.82.fc10.x86_64-180.60-1.fc10.3.x86_64

What do I need to do in order to successfully remove the old kernel?

forkbomb
21st December 2010, 08:47 AM
I had previously updated from FC10 to FC11.[...]
What do I need to do in order to successfully remove the old kernel?If that means you're now running F11, the best course of action would be to just update to a supported version....
http://fedoraproject.org/wiki/LifeCycle/EOL

GeekGirl1
11th June 2011, 09:46 PM
Thanks. This old thread is still working for Fedora 15.

To see what you have:

yum info kernel

Then, remove the old ones you don't want. Version is the number reported by yum info kernel, such as kernel-2.6.38.6:

sudo yum remove kernel-version

The uninstall process did remove a dependency on kmod-nVidia, as well as update /boot/grub.conf.

PiElle
17th June 2011, 03:28 PM
Very useful! Thank You! :)

PiElle
12th July 2011, 06:56 PM
If you run a Kernel PAE, don't forget:
yum info kernel-PAE
and
sudo yum remove kernel-PAE-version

I wrote this, because having now installed a kernel PAE I couldn't find any voice, until I typed:
rpm -qa *\kernel\*|sort :doh:
all's well that ends well ... :)

scaryAardvark
28th September 2011, 04:31 PM
I always use

$ package-cleanup --oldkernels --count 1

leosubhadeep
22nd August 2012, 12:49 AM
Old thread, but became very useful. Thanks. :)

theking2
3rd February 2014, 10:02 PM
In attempting to remove an old kernel I tried
$ rpm -e kernel-3.11.10-301.fc20.x86_64
with the following result
Failed dependencies:
kernel-uname-r = 3.11.10-301.fc20.x86_64 is needed by (genstalleerd) kernel-modules-extra-3.11.10-301.fc20.x86_64

the output from
$ rpm -q kernel
is

kernel-3.11.10-301.fc20.x86_64
kernel-3.12.8-300.fc20.x86_64
kernel-3.12.9-301.fc20.x86_64


should I do
yum upgrade kernal-modules-extra first? Or will this break my installation?

dobbi
3rd February 2014, 11:07 PM
No, you should do


$ rpm -qa | egrep -i kernel | sort

or


$ rpm -qa kernel*

Which show more than just "rpm -q kernel"

lsatenstein
3rd February 2014, 11:23 PM
If you installed a fresh version of Fedora20, then yum, the fedora command line updater will keep a maximum of 1 recovery kernel, one current kernel and two previous versions. As new updates are released, the oldest kernel is automatically removed.

There is no need to play with grub to edit away the older kernels. By default, the new one is at the top of the list, and it is the one that grub points to when booting, unless of course, you change the "default=" in the grub.cfg.

Grub allows for main and sub-menu where the recovery and older kernels are grouped together as "other" or similar title.

theking2
4th February 2014, 08:24 AM
The reason I asked is that I do have more then one kernel and a rescue kernel

vmlinuz-0-rescue-4d8b5f38cdec4c92bd7dc03a351984eb
vmlinuz-3.11.10-301.fc20.x86_64
vmlinuz-3.12.8-300.fc20.x86_64
vmlinuz-3.12.9-301.fc20.x86_64


But I understand now that as soon as a new kernel comes out the 3.11 will be removed, right?

In arch I would do (and have done for many years)
$ pacman -Syu

is the equivalent
$ yum update

?

EDIT: I think I can say: "affirmative!" `yum update` is the equivalent with pacman -Syu

I just did and now my kernels look like this

abrt-addon-kerneloops-2.1.12-1.fc20.x86_64
kernel-3.11.10-301.fc20.x86_64
kernel-3.12.8-300.fc20.x86_64
kernel-3.12.9-301.fc20.x86_64
kernel-devel-3.12.9-301.fc20.x86_64
kernel-headers-3.12.9-301.fc20.x86_64
kernel-modules-extra-3.11.10-301.fc20.x86_64
kernel-modules-extra-3.12.8-300.fc20.x86_64
kernel-modules-extra-3.12.9-301.fc20.x86_64
libreport-plugin-kerneloops-2.1.12-1.fc20.x86_64

PiElle
4th February 2014, 08:53 AM
In attempting to remove an old kernel I tried
$ rpm -e kernel-3.11.10-301.fc20.x86_64 ...
To manually remove a kernel it would be better:

yum remove kernel-3.11.10-301.fc20.x86_64