Подробнее на сайте: http://maintain-health.ru http://tryjoomla.net http://repair-dwelling.ruhttp://leadnews.ruhttp://choose-house.ruhttp://kupil-jilie.ru http://my-immobility.ru http://joomspider.comhttp://body-treatment.ru
http://dohodok.ru http://health-treatment.ru http://my-houseroom.ruGo to top of pagehttp://buy-immobility.ru http://java-code.ru http://grand-finance.ru

TOPIC: Remove the unwanted kernel in CentOS

Remove the unwanted kernel in CentOS 8 years 3 months ago #4

  • zokkie
  • zokkie's Avatar
  • Offline
  • Administrator
  • Posts: 2
  • Karma: 0
I recently noticed that my /boot partition was at 95% full, so I investigated to see what was causing it. Apparently, it was filling up with older versions of the linux kernel as a result of upgrades.

Because my system has been very stable, I decided to keep only the current version of the kernel (duh) plus one previous version to fall back on. Following are the steps I used to remove the older kernels.

Step 1: Find the current kernel

It would be a very silly thing to try and remove the kernel you’re currently running, so show the current kernel with:

uname -r

The output should look something like this:

2.6.27.41-170.2.117.fc10.i686.PAE

The 2.6.27.41-170.2.117 is the kernel version number, the fc10 means I’m running Fedora Core 10, the i686 means I’m running the Intel 686 processor version, and the PAE means I’m running a PAE-enabled version of the kernel (so that I can run more than 4GB of RAM on a 32-bit OS). Remember the version number of your currently-running kernel, because we want to avoid it.

Step 2: Find the filename(s) you want to delete

The second step is to find the filename(s) of the old kernel(s). If you’re running a “standard” kernel, query the package manager for the filenames with:

rpm -q kernel

The output should show you the filenames of all installed packages that match. On a CentOS/RHEL 5 system it might look like this:

kernel-2.6.18-164.el5

kernel-2.6.18-164.6.1.el5

kernel-2.6.18-164.9.1.el5

If you get a message saying “package kernel is not installed,” then you may be running a PAE version of the kernel (like I am). Try:

rpm -q kernel-PAE

On a Fedora Core 10 system running a PAE kernel, the output will look something like this:

kernel-PAE-2.6.27.30-170.2.82.fc10.i686

kernel-PAE-2.6.27.38-170.2.113.fc10.i686

kernel-PAE-2.6.27.41-170.2.117.fc10.i686

If you still don’t get any output, then do:

yum list kernel-*

to give you an idea of what the what the package names are. The output will show the installed kernel’s package name in the first column (such as kernel.i686 or kernel-PAE.i686), and the version number in the second column (it will also show packages available to install, but ignore those for now). Take note of the first part of the package name (before any dots). That’s what you should use in your rpm -q command to query for installed pacakges.

Once you know the filename of the package(s) you want to uninstall, you can move to the final step.

Step 3: Remove the unwanted files

In my case, I had three kernels installed: the current and two older ones. I wanted to keep one older kernel around just in case I needed to revert back for any reason. Your needs may be different, but I recommend keeping at least one old kernel just to be safe.

Delete the old kernels one at a time. As root, do:

yum remove <kernel>

where the <kernel> is the old kernel you identified above. In my case, I did:

yum remove kernel-PAE-2.6.27.30-170.2.82.fc10.i686

Yum will ask you to confirm. Check one last time to verify this is a version you no longer need (and make double-sure it’s not the one you’re running) and press y to confirm.

Repeat as necessary for any other old kernel version you want to remove.

NOTE: Using yum for this procedure will automatically update your /boot/grub/menu.lst file and remove the entry for the removed kernel.
Last Edit: 8 years 3 months ago by zokkie.
The administrator has disabled public write access.
Time to create page: 0.126 seconds