Update-manager does not remove autoremovable kernel packages _before_installing new (kernel) packages

Bug #1803587 reported by Steve Langasek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
unattended-upgrades (Ubuntu)
Invalid
Undecided
Unassigned
update-manager (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

I happened to run apt manually on my system this morning to remove a package, and I was informed:

The following packages were automatically installed and are no longer required:
  linux-image-4.15.0-36-generic linux-modules-4.15.0-36-generic
  linux-modules-extra-4.15.0-36-generic

This was surprising, since I have run update-manager yesterday (with no intervening reboot), and unattended-upgrades is enabled, and both of those packages should have already removed this stale kernel before now.

After apt autoremove, my current installed packages are:

$ dpkg -l linux-image'*' | grep ^ii
ii linux-image-4.18.0-10-generic 4.18.0-10.11 amd64 Signed kernel image generic
ii linux-image-4.18.0-11-generic 4.18.0-11.12 amd64 Signed kernel image generic
ii linux-image-generic 4.18.0.11.12 amd64 Generic Linux kernel image
$

Revision history for this message
Balint Reczey (rbalint) wrote :

Could you please attach the relavant part of dpkg history log a and dpkg terminal log?

It is possible, that the last run of u-u/u-m installed kernel packages triggering /etc/kernel/postinst.d/apt-auto-removal which resulted kernels to be removed in the _next_ apt/u-u/u-m run.

Revision history for this message
Steve Langasek (vorlon) wrote :

History log:

Start-Date: 2018-11-14 17:21:44
Commandline: aptdaemon role='role-commit-packages' sender=':1.5400'
Install: linux-headers-4.18.0-11:amd64 (4.18.0-11.12, automatic), linux-image-4.
18.0-11-generic:amd64 (4.18.0-11.12, automatic), linux-modules-extra-4.18.0-11-g
eneric:amd64 (4.18.0-11.12, automatic), linux-modules-4.18.0-11-generic:amd64 (4
.18.0-11.12, automatic), linux-headers-4.18.0-11-generic:amd64 (4.18.0-11.12, au
tomatic)
Upgrade: evince:amd64 (3.30.1-1ubuntu1, 3.30.1-1ubuntu1.2), linux-headers-generic:amd64 (4.18.0.10.11, 4.18.0.11.12), linux-libc-dev:amd64 (4.18.0-10.11, 4.18.0-11.12), linux-libc-dev:i386 (4.18.0-10.11, 4.18.0-11.12), libevdocument3-4:amd64 (3.30.1-1ubuntu1, 3.30.1-1ubuntu1.2), linux-image-generic:amd64 (4.18.0.10.11, 4.18.0.11.12), linux-signed-image-generic:amd64 (4.18.0.10.11, 4.18.0.11.12), libpq5:amd64 (10.5-1, 10.6-0ubuntu0.18.10.1), evince-common:amd64 (3.30.1-1ubuntu1, 3.30.1-1ubuntu1.2), libevview3-3:amd64 (3.30.1-1ubuntu1, 3.30.1-1ubuntu1.2), linux-tools-common:amd64 (4.18.0-10.11, 4.18.0-11.12), postgresql-client-10:amd64 (10.5-1, 10.6-0ubuntu0.18.10.1), linux-generic:amd64 (4.18.0.10.11, 4.18.0.11.12)
End-Date: 2018-11-14 17:24:10

Start-Date: 2018-11-15 08:39:50
Commandline: apt autoremove --purge
Requested-By: vorlon (1000)
Purge: linux-modules-extra-4.15.0-36-generic:amd64 (4.15.0-36.39), linux-modules-4.15.0-36-generic:amd64 (4.15.0-36.39), linux-image-4.15.0-36-generic:amd64 (4.15.0-36.39)
End-Date: 2018-11-15 08:40:08

So yes, it's possible that this was only a candidate for autoremoval /after/ the previous run of update-manager had finished.

Revision history for this message
Steve Langasek (vorlon) wrote :

(In which case, I think this still warrants improvement, since AIUI the next run of update-manager will do removals after installations, which means a high water mark of 4 kernels rather than 3 which is what we want)

Revision history for this message
Balint Reczey (rbalint) wrote :

@vorlon: OK, let's use this bug to track the improvement for u-m.

While triaging I found LP: #1803749 , which you may have hit if you have Unattended-Upgrade::Remove-New-Unused-Dependencie set to False. Is that the case on your system?

Revision history for this message
Steve Langasek (vorlon) wrote :

$ grep -r Remove-New /etc/apt
/etc/apt/apt.conf.d/50unattended-upgrades://Unattended-Upgrade::Remove-New-Unused-Dependencies "false";
$

So it appears this is commented out.

Revision history for this message
Balint Reczey (rbalint) wrote :

In my tests u-u successfully removed the kernels as new unused packages even when hitting LP: #1803749 for the record.

Revision history for this message
Balint Reczey (rbalint) wrote :

@vorlon: OK, being commented out (and not set elsewhere) makes it default to True.
The misleading comment is fixed in later releases.

Changed in update-manager (Ubuntu):
importance: Undecided → Wishlist
summary: - kernel from bionic did not get autoremoved by either unattended-upgrades
- or update-manager
+ Update-manager does not remove autoremovable kernel packages
+ _before_installing new (kernel) packages
Changed in update-manager (Ubuntu):
status: New → Triaged
Changed in unattended-upgrades (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.