linux remove old kernels

Recently Ubuntu-based linux SO doesn’t remove automatically old kernels, with the command

sudo apt-get autoremove --purge

This because kernels, even automatically installed, are considered manually installed, and so they are not automatically removed.

To solve this, you should do beforehand this command

sudo apt-mark auto $(apt-mark showmanual | grep -E "^linux-([[:alpha:]]+-)+[[:digit:].]+-[^-]+(|-.+)$")

With this command you say that all kernels are automatically installed, and therefore the previuous command (sudo apt-get autoremove –purge) will work.

Lascia un commento

Il tuo indirizzo email non sarĂ  pubblicato. I campi obbligatori sono contrassegnati *