Ubuntu – `sudo apt autoremove` suggests removing large package

aptdpkgpackage-managementserverupdates

I recently ran sudo apt-get update and sudo apt-get install in Ubuntu server, and APT suggested running sudo apt autoremove. When I run that command, it warns me:

The following packages will be REMOVED:
  linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic linux-headers-4.4.0-57 linux-headers-4.4.0-57-generic linux-headers-4.4.0-62
  linux-headers-4.4.0-62-generic linux-image-4.4.0-31-generic linux-image-4.4.0-57-generic linux-image-4.4.0-62-generic
0 upgraded, 0 newly installed, 9 to remove and 51 not upgraded.

These packages are very big, over 400mb, and I think it's a kind of kernel version. Is okay to confirm deleting those packages?

Best Answer

autoremove is smart. It removes old kernel versions along with all their baggage, leaving the current kernel and one spare. It also runs update-grub to clean the bootloader menu. You should proceed without trepidation :)

However, before running it, you can see your current kernel version with uname -r, then you can see for sure autoremove isn't going to delete your running kernel or any of its files.

You can also do ls /boot to see the kernels you have there and compare with what autoremove is going to do.