Ubuntu 18.04 remove all unused old kernels

Ubuntu 18.04 remove all unused old kernels

To remove all unused old kernels on Ubuntu 18.04, you can use the following steps:

  1. First, check which kernels are installed on your system by running the following command:
dpkg -l | grep linux-image
So‮‬urce:www.lautturi.com

This will list all of the Linux kernel images that are installed on your system.

  1. Identify the kernels that you want to remove. The kernel that is currently running is indicated by the * character in the output of the above command. You should not remove the currently running kernel.

  2. Uninstall the kernels that you want to remove using the apt-get command. For example, to remove the kernel with package name linux-image-4.15.0-101-generic, you can run the following command:

sudo apt-get remove linux-image-4.15.0-101-generic

Repeat this process for each kernel that you want to remove.

  1. Clean up the package manager's cache by running the following command:
sudo apt-get autoremove

This will remove any unnecessary dependencies that are no longer needed after the kernels were removed.

  1. Finally, update the boot loader configuration to remove references to the kernels that you removed. You can do this by running the following command:
sudo update-grub

This will update the boot menu to remove any entries for the kernels that you removed.

Keep in mind that removing kernels can be risky, as it is possible that the currently running kernel may have a bug or issue that you are unaware of. If this is the case, removing the kernel may cause your system to become unstable. It is always a good idea to make a backup of your system before removing any important packages.

Created Time:2017-10-30 14:27:24  Author:lautturi