1

I just finished updating the linux kernel via APT and restarted my machine. Then I checked for more updates and it said this:

The following packages were automatically installed and are no longer required: linux-headers-5.4.0-100 linux-headers-5.4.0-100-generic linux-image-5.4.0-100-generic linux-modules-5.4.0-100-generic linux-modules-extra-5.4.0-100-generic Use 'sudo apt autoremove' to remove them.

Should I use autoremove or not?

2 Answers 2

0

apt-get autoremove

autoremove is used to remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed as dependencies changed or the package(s) needing them were removed in the meantime.

All unused Linux kernel takes disk space on /boot, hence you should delete them from the system.

In your case, you upgraded your kernel from version 5.4 to a newer version. If you manually install 2 chosen kernels, i.e., the first and the current one, then apt-autoremove will only ever remove the older versions you didn't manually install, so you will always have those 2 options plus whatever the latest one is.

Listing all installed Linux kernel

Firstly, type the following dpkg command along with egrep command to display a list of all installed kernels.

dpkg --list | egrep -i --color 'linux-image|linux-headers'

Only list installed kernels

dpkg --list | grep -i -E --color 'linux-image|linux-kernel' | grep '^ii'

You can also check them manually by navigating to your /boot partition

Check the amount of disk space available on the file system by typing the following df command:

df -H

Removing unused Kernels

Remove unused kernel

sudo apt autoremove

Remove unused kernel and residual files and configurations

sudo apt --purge autoremove
0

You can autoremove, yes. The system keeps the two most recent versions of the kernel (or possibly more if your currently running kernel is old).

If you look in /boot there is probably a 105, 104, and 100 versions of the kernel. The autoremove will remove the oldest 100 version since it's not really needed now.

1
  • I see, well I thought that APT went crazy but I'm glad I was wrong. Thank you very much
    – Croisen
    Mar 22, 2022 at 0:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .