purge-old-kernels - safe way to remove old kernelsSection: System | Actuality: Unspecified
Every month are new kernel updates, bug fixes and patches security system. If you regularly update your system, then your system gradually accumulates more the number of unused old kernels.
Thus, it is likely that the boot partition /boot on the hard drive will be filled in a certain period of time. If your /boot partition is full, you will not be able to upgrade, or can't even do a kernel upgrade to any latest available version. In this case, it is very important to regularly update the kernel and software. For this you must have enough free space in the /boot partition. To system to function correctly, you must have enough free space on the /boot and /root partitions.
We can easily remove the accumulated system cache, unwanted packages and dependencies using the following commands:
sudo apt-get autoremove sudo apt-get autoclean
But the problem is that this works only if the kernel was installed automatically, or if you installed them using the Update Manager. Using these commands will not delete the kernel manually installed. However, you can use some third-party programs such as Ubuntu Tweak (This project is no longer under maintenance) for the safe disposal of unused cores, packages and their dependencies that are no longer needed. But Ubuntu Tweak is a graphical program which cannot be used on servers without a graphical mode.
One of the developers of Ubuntu, Dustin Kirkland, responsible for the development and the product strategy was created utility purge-old-kernels, which is the safest way removes from the system the unused kernel packages of desktop and server systems, Ubuntu and therefore Linux Mint.
Installation latest version into Linux Mint:
sudo apt-get install -y bikeshed byobu
Now, to remove old, unused kernels, run in terminal the following command:
If there is no older kernels in your system, this utility will display the following message:
The safety of the use of this utility is that it will never remove the last installed kernel, or rather, utility purge-old-kernels removes all the unused kernels, except for the last TWO - the current and the previous. But the user can override this value using the option --keep.
For example, to remove all old kernels except the 3 last, run the following command:
sudo purge-old-kernels --keep 3 -qy
For more information about purge-old-kernels, see the user manual: