How To Remove An Old Kernel

Table of contents:

How To Remove An Old Kernel
How To Remove An Old Kernel

Video: How To Remove An Old Kernel

Video: How To Remove An Old Kernel
Video: How to remove an old Linux kernel 2024, April
Anonim

A nice feature of operating systems of the Linux family is the ability to flexibly modify them. So, if desired, the user can install a newer kernel. In this case, it will be possible to boot with the kernel of the previous version. However, after confirmation of the stable operation of the system is received, it makes sense to remove the old kernel.

How to remove an old kernel
How to remove an old kernel

Necessary

root user password

Instructions

Step 1

Start a superuser session. Run a shell or console emulator as root. Use the shell capabilities or the sudo command. You can also use the su command on the current console.

Step 2

Find out the version of the loaded kernel. Enter the command in the console:

uname -a

Remember or write down the version number.

Step 3

Get a list of installed kernels. Use the rpm command with the qa option. Filter the command output with grep. For example, you can run the command:

rpm -qa | grep kernel

to get a list of all packages that contain the word kernel in their names. The output lines will contain the names of the packages corresponding to the installed kernels. In some cases, you can filter by kernel-image, linux or linux-image. Write down or remember the package names of the installed kernels. Highlight the ones you want to delete among them. Be guided by the kernel version number. The kernels to be removed should not include the current kernel, the version of which was obtained in the previous step.

Step 4

Remove the old kernel using the Synaptic GUI for the apt package manager. Start Synaptic. Use the graphical shell menu or in the console type synaptic and press Enter. In the first case, you will have to enter the root password again. In the Synaptic window, highlight the section containing the list of packages related to the kernel. Alternatively, search for kernel. In the list of packages displayed, find the ones that correspond to the kernels you want to remove. Mark them as deleted by selecting the appropriate item in the main or context menu. Commit your changes.

Step 5

Remove the old kernel using the apt console package manager if Synaptic cannot be used for some reason. In the console, enter a command like this:

apt-get remove

where replace with the full name of the package corresponding to the kernel to be removed. Press Enter and follow the further instructions of the program.

Step 6

Remove the kernel manually. Enter a command like:

rpm -e

to remove the kernel image. Replace with the full name of the package. Edit the configuration files of the bootloader you are using. Update its configuration to change the boot menu. For example, if you are using lilo, you edit the /etc/lilo.conf file to remove blocks corresponding to no longer existing kernels, and then run the lilo command as root.

Recommended: