1

The problem stems from running out of disk space on /boot after doing too many updates. I'm doing sudo apt update && sudo apt upgrade && sudo apt dist-upgrade and every time the linux-image updates I run sudo apt autoremove to free up space. I thought that this command removes unused linux-image-x.x.x-xx-generic from the system. Unfortunately I started running into issues with disk space when upgrading and I found this solution which works, but it's really annoying having to do this manual delete of the linux-image-x.x.x-xx-generic every time. So for example I have this command

dpkg -l | grep linux-image
rc  linux-image-5.13.0-27-generic              5.13.0-27.29~20.04.1                                 amd64        Signed kernel image generic
rc  linux-image-5.13.0-28-generic              5.13.0-28.31~20.04.1                                 amd64        Signed kernel image generic
rc  linux-image-5.13.0-30-generic              5.13.0-30.33~20.04.1                                 amd64        Signed kernel image generic
ii  linux-image-5.13.0-35-generic              5.13.0-35.40~20.04.1                                 amd64        Signed kernel image generic
ii  linux-image-5.13.0-37-generic              5.13.0-37.42~20.04.1                                 amd64        Signed kernel image generic
rc  linux-image-5.8.0-43-generic               5.8.0-43.49~20.04.1                                  amd64        Signed kernel image generic
ii  linux-image-generic-hwe-20.04              5.13.0.37.42~20.04.22                                amd64        Generic Linux kernel image

After doing

uname -r
5.13.0-35-generic

I uninstall the one's that I'm not using like in the solution I found, but this is really annoying. Is this a bug in Ubuntu or is something broken in my system?

Pachuca
  • 409

1 Answers1

3

There is no bug involved here: your old linux-image is being deleted automatically. However, its configuration data is not, and continues therefore to be listed in the output of dpkg -l, with rc at the start of the line indicating the status. See this answer for details about the output of dpkg -l.

Config files by default remain in case you reinstall the package, unless the --purge flag is used. Thus, if you want the configuration data also removed, then add that flag as

sudo apt autoremove --purge

or instead use the command

sudo apt autopurge

After the fact, i.e., if the package already is removed, you can still remove its configuration with the command:

sudo dpkg --purge linux-image-5.13.0-27-generic

To remove any residual configuration of any removed package on your system, you can use the command outlined in this answer to remove any residual configuration of packages that have been removed. It can also be done using Synaptic Package manager: list all removed packages for which residual configuration is still present by selecting the category "Not installed (residual config)".

vanadium
  • 97,564