Friday, 1 August 2014

Fix for full /boot partition: How to remove all kernels not in use

List all installed kernels (not necessary, just for informational purposes):
dpkg -l linux-image-\* | grep ^ii

Restart to make sure you use the newest kernel, then:
sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

If /boot is full, then just do a sudo apt-get remove on whichever package it's complaining about having a conflict with, then re-run the above and reinstall the packages you removed when it's done. This works even if the package in question is linux-server.

You may want to run:
dpkg -l linux-image-\* | grep ^ii
again afterwards to make sure only one kernel (plus linux-image-server) is installed.

No comments:

Post a Comment