Comment 11 for bug 1675079

Revision history for this message
Balint Reczey (rbalint) wrote : Re: [Bug 1675079] Re: 16.04 LTS Partition /boot fills up with Kernel images, gets underwear in a twist

On Tue, Mar 27, 2018 at 11:46 PM, Steve Langasek
<email address hidden> wrote:
> Why does the update-manager upload include this code?:
>
> + running_kernel_version = subprocess.check_output(
> + ["uname", "-r"], universal_newlines=True).rstrip()
> + self.running_kernel_pkgs_regexp = re.compile("(" + "|".join(
> + [("^" + p + ".*" + running_kernel_version)
> + if not p.startswith(".*") else (running_kernel_version + p)
> + for p in apt_versioned_kernel_pkgs]) + ")")
> [...]
> + if (pkg.is_auto_removable and
> + (cache.versioned_kernel_pkgs_regexp and
> + cache.versioned_kernel_pkgs_regexp.match(pkg.name) and
> + not cache.running_kernel_pkgs_regexp.match(pkg.name))):
> + kernel_autoremove_pkgs.append(pkg)
> + pkg.mark_delete()
>
> apt already has an implementation in /etc/kernel/postinst.d/apt-auto-
> removal which ensures that the currently-running kernel is not
> autoremoved. Why are you duplicating this functionality in update-
> manager?

The code in apt ensures that the kernel running at the time the last
kernel was installed is not offered for autoremoval but it does not
protect the _currently_ running kernel. The issue is tracked in LP:
#1615381 and unattended-upgrades already uses the same method to
protect the _current_ running kernel.
The proper fix for LP: #1615381 would be too intrusive in apt for
inclusion in Bionic at this stage of the cycle.