Software Updater does not guide user to remove excessive kernels when there is too little space on /boot to install a kernel update.

Bug #1460396 reported by Tyler Dinsmoor on 2015-05-31
28
This bug affects 6 people
Affects Status Importance Assigned to Milestone
update-manager (Ubuntu)
Medium
Unassigned

Bug Description

Description: Ubuntu 14.04.2 LTS
Release: 14.04

update-manager:
  Installed: 1:0.196.13
  Candidate: 1:0.196.13
  Version table:
 *** 1:0.196.13 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1:0.196.11 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

After running Trusty for about a year, I had easily 3GB worth of old kernels sitting in my /boot folder.

For users that don't know about pruning old kernel versions, much less what kernels are, this is a problem since update-manager refuses to continue the update process when /boot doesn't have enough space.

My friend who I had installed Ubuntu for was complaining about updates not working, so I took a look and this is what was happening. His /boot partition is too small to have so many ~200mb kernel images.

We need a user-friendly way to inform the user that this is happening, and then suggest an automated course of action (apt-get remove oldest kernel + ensure at least one previous verified working kernel (such as purge_old_kernels in https://launchpad.net/ubuntu/+source/bikeshed)), and if it fails, a link to detailed instructions on how to remove old kernels manually.

Attachment is updated ~/update-manager-0.196.13/UpdateManager/Core/utils.py that includes function ensure_enough_room_for_kernel() that only informs the user if there isn't enough space for a kernel upgrade.
It has not been implemented in _main_, I figure the main package devs would want to do that themselves, be it to use for removing the oldest kernel version, or having the user pick from a list of installed kernels which to remove.

Thanks.
    -Tyler Dinsmoor <email address hidden>

The attachment "update-manger/UpdateManager/Core/utils.py added func. ensure_enough_room_for_kernel() to be used in bugfix." seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Tyler Dinsmoor (pappad) wrote :

Not sure what format the bugtracker/devs like to use for submitted patches.

Here's the diff output between original and updated utils.py uploaded earlier.

Changed in update-manager (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Brian Murray (brian-murray) wrote :

The old kernels should actually be autoremoved and that not happening is being tracked in the following bug:

https://bugs.launchpad.net/ubuntu/+source/update-manager/+bug/1439769

Tyler Dinsmoor (pappad) wrote :

The reasons to why old kernels are not intentionally being marked for autoremoval (as of 2008-11-04) is because it was considered too dangerous and apt has an exception to not tag linux-image-* packages for autoremoval because we had no idea which kernels actually worked for a system.

However, I had thought that this problem had been addressed using last-good-boot for grub after runlevel 2 was reached, here:

https://wiki.ubuntu.com/KernelTeam/removing-old-kernels

But since the wiki hasn't been updated since '08, maybe that is not true anymore.

Joel Brobecker (joel-brobecker) wrote :

FWIW, I also tend to think that removing old kernels automatically is a little on the scary side, so would continue leaving things as is, and would focus instead on helping make this happen much less often. Currently, the /boot partition is very very very very small. A 5GB /boot partition (for instance) would allow many old kernels before cleanup has to be done again, and with today's hard-drives, I wouldn't even notice the difference.

Jarno Suni (jarnos) on 2016-05-27
summary: - Old kernels filling up /boot, causing failed updates
+ Software Updater does not guide user to remove old kernels when /boot is
+ about to get full, causing failed updates

In 14.04 there is a dialog that appears informing you should free space on /boot, if there is too little free space, when using Software Updater. Not sure, if it works on later releases.

Jarno Suni (jarnos) wrote :

This link shows what kind of dialog there is: http://elementaryos.stackexchange.com/q/1634
The issue is that the dialog tells to empty trash and use 'sudo apt-get clean' which may help only, if /boot is on same partition than some of the files in trash, the /var/cache/apt/archives/ or /var/cache/apt/archives/partial/.

In Ubuntu 16.04 and later a more helpful advise would be to run "sudo apt-get autoremove --purge". (That might not do the trick in 14.04 due to Bug #1439769)

For more control on which kernels to purge, this utility would be useful: https://www.bountysource.com/issues/38300038-feature-request-the-command-should-work-like-this

Jarno Suni (jarnos) on 2017-03-20
summary: - Software Updater does not guide user to remove old kernels when /boot is
- about to get full, causing failed updates
+ Software Updater does not guide user to remove excessive kernels when
+ there is too little space on /boot to install a kernel update.
Jarno Suni (jarnos) wrote :

Please note that even in 16.04- "sudo apt-get autoremove --purge" will not purge kernels that user has installed manually.

Jarno Suni (jarnos) wrote :

Even worse problem: Software Updater can not foresee lack of enough free inodes in which case it starts updating, but fails to do its job: Bug #1089195

Jarno Suni (jarnos) wrote :

At least Software Updater could point user to the Ubuntu Community Help Wiki page about kernel removing: https://help.ubuntu.com/community/RemoveOldKernels

Jarno Suni (jarnos) wrote :

Tyler Dinsmoor, nowadays
apt(-get) autoremove --purge
should purge excessive kernels, at least in Ubuntu 16.04 and later.

spike speigel (frail-knight) wrote :

Related to bug 1515513

Jarno Suni (jarnos) wrote :

As for #12, the auto removing does not remove kernels marked as being manually installed. That is not an issue usually, but there may be cases that the command can not free enough space to fit yet another kernel.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers