The problem is that the old kernels take place in boot folder and cause problems with installetion of new packeges and system upgrade.

Probably the easiest way is to use purge-old-kernels script.
1. First install it.

sudo apt install byobu

2. Then run the script regularly to remove old kernels

sudo purge-old-kernels

If  there is already no free space in /boot folder, you cannot install new packages and have to clean up manually first.

Find you current kernel

uname -r

And then remove some of the older ones from /boot folder using rm command.

Then you can install purge-old-kernels and run it.

After removing the old kernels you might need to run also

sudo apt-get -f install

Some sources recommend the following commands us useful alternatives.

sudo apt-get autoclean
This will eliminate any old files (Including kernel versions) you may have. Note that if you have many old versions, it will take a while since it has to make sure that removing the kernel version has no issues. For me, removing the last 12 kernel versions took about 2 minutes. You can also do the following:

sudo apt-get clean
Which will eliminate everything downloaded and stored in the cache folder of apt. Lastly you have:

sudo apt-get autoremove –purge
which would check for any unused packages and remove them if necessary. This is great for those libraries and dependency packages that are no longer needed byt any app installed.

References
https://help.ubuntu.com/community/RemoveOldKernels

How to Easily Remove Old Kernels in Ubuntu 16.04


http://askubuntu.com/questions/2793/how-do-i-remove-old-kernel-versions-to-clean-up-the-boot-menu

How to remove old kernel to clean up boot folder

Leave a Reply

Your email address will not be published. Required fields are marked *