[SRU] kernel package names ending with version without flavor are not matched by generated patterns

Bug #1828200 reported by Balint Reczey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
unattended-upgrades (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

 * Most of the unused kernel packages are automatically removed by u-u, but kernel packages not including the flavor in the name are not removed taking up significant space after some time:
 $ sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-gcp-headers-4.15.0-1018 linux-gcp-headers-4.15.0-1019 linux-gcp-headers-4.15.0-1021 linux-gcp-headers-4.15.0-1024 linux-gcp-headers-4.15.0-1025 linux-gcp-headers-4.15.0-1026 linux-gcp-headers-4.15.0-1027
  linux-gcp-headers-4.15.0-1028 linux-gcp-headers-4.15.0-1029 linux-gcp-headers-4.15.0-1030 linux-gcp-headers-4.15.0-1032 linux-gcp-headers-4.15.0-1033 linux-gcp-headers-4.15.0-1034 linux-gcp-headers-4.15.0-1036
  linux-gcp-headers-4.15.0-1037 linux-gcp-headers-4.15.0-1042 nplan
0 upgraded, 0 newly installed, 17 to remove and 16 not upgraded.
After this operation, 1234 MB disk space will be freed.
Do you want to continue? [Y/n]

[Test Case]

 * A new test case is added to autopkgtest (test/autopkgtest_kernel_patterns.py) to verify that all kernel-related packages are covered having the same version of the running kernel.

 * Install linux-gcp-headers-4.15.0-1042 and make it autoremovable
 * Run unattended-upgrades
 * Observe linux-gcp-headers-4.15.0-1042 being autoremoved with fixed u-u versions.

[Regression Potential]

 * With the file name patterns changing u-u may select packages with names matching the patterns but not being versioned kernel packages. In case those packages are autoremovable they are removed by u-u.
To avoid this problem the fix for LP: #1848706 ensures that only linux-related packages are autoremoved in the kernel autoremoval phase.

[Original Bug Text]

Apt ships VersionedKernelPackages regex patterns in /etc/apt/apt.conf.d/01autoremove from which /etc/kernel/postinst.d/apt-auto-removal generates kernel package name patterns by appending the running kernel version including the flavor like linux-.*-4.15.0-1010-kvm but those generated patterns don't cover versioned kernel package names including the version without the flavor, such as linux-kvm-tools-4.15.0-1012.

Unattended-upgrades generates the patterns in a similar way and also don't cover linux-kvm-tools-4.15.0-1012 and similar packages.

Balint Reczey (rbalint)
description: updated
Revision history for this message
Balint Reczey (rbalint) wrote :
tags: added: id-5cd32966e09b5e33d7d193fc
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unattended-upgrades - 1.13

---------------
unattended-upgrades (1.13) unstable; urgency=medium

  [ Alban VIDAL ]
  * Update french translation.
    Signed-off-by: Alban VIDAL <email address hidden>

  [ Balint Reczey ]
  * Don't crash collecting transitive dependencies when package has no
    candidate (LP: #1825886)
  * Use mark_install_adjusted() in rewind_cache()
    The original cache had packages marked with adjustments thus rewinding
    should also do adjustments to reach the same state. Not using
    mark_install_adjusted() also crashes when apt raises error on held
    packages. (LP: #1826157)
  * test_rewind: Update test to check if adjustend rewinding took place
  * Only allow removals in valid autoremoval sets
  * Fix one more log location in the man page (Closes: #928601)
  * Factor out kernel regexp generation to functions
  * Packages including kernel version without flavor in their name may be
    kernel packages. Also add autopkgtest for checking if the generated
    patterns cover the currently running kernel. (LP: #1828200)
  * Skip upgrade-all-security test when there are no updates to test with.
    Shortly after a release there may not be security updates against the
    packages used in the chroot used for the test.
  * Test with latest stable in upgrade-all-security on testing
  * Fix testing Debian's updates in upgrade-all-security
  * Store list of kept packages and report the number of them in motd
    (LP: #1823070)
  * Mention APT's apt-daily-upgrade.service in the man page
  * 50unattended-upgrades.md5sum add MD5 of current files
  * PEP8: Fix breaking line after binary operator
  * debian/tests/control: Fix Depends: of upgrade-between-snapshots
  * debian/tests/control: Allow stderr in kernel-patterns

  [ Gordon Lack ]
  * Replace boolean Unattended-Upgrade::MailOnlyOnError2 mail reporting setting
    with multi-valued (string) Unattended-Upgrade::MailReport.

  [ Jaime Hablutzel ]
  * Error message improved on very improbable condition

  [ Clint Armstrong ]
  * Fix showing multi-line strings on Plymouth.
    When unattended-upgrades sends it's status to plymouth it sends a
    multi-line string which causes plymouth to display overlapping text,
    because plymouth only scrolls one line when the message is sent.
    (LP: 1826406)

 -- Balint Reczey <email address hidden> Mon, 08 Jul 2019 11:08:30 +0200

Changed in unattended-upgrades (Ubuntu):
status: New → Fix Released
Balint Reczey (rbalint)
description: updated
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.