After the Kernel is updated, the old unused kernels in Ubuntu are not removed by default. To clean them, you can do the following actions.
Added on 2018-03-16: I find a better method to do the same thing from here. What you do is just install the “byobu” package and run the “purge-old-kernels” command like below:
1 | sudo apt-get install byobu |
I test this solution on Mint 18.3. It should also work on Ubuntu.
Here is the previous solution.
Run “apt autoremove”:
1 | ~> sudo apt autoremove --purge |
For some kernels cannot be removed by the “apt autoremove” command, you can run the following command to list them first(from here):
1 | ~> dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r) |
Note that in the above command, the “grep -Fv $(uname -r)” section makes sure that you won’t remove the current used kernel, without which you may remove the current used kernel and Ubuntu will not be able to boot.
Then remove the kernels by the following commands:
1 | sudo dpkg --purge linux-image-4.4.0-53-generic linux-headers-4.4.0-53 linux-headers-4.4.0-53-generic linux-image-extra-4.4.0-53-generic |