From 04085f46dea9a95dd86123ac00187a63cc4ba2c0 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 17 Dec 2020 13:24:56 +0100 Subject: Determine autoremovable kernels at run-time Our kernel autoremoval helper script protects the currently booted kernel, but it only runs whenever we install or remove a kernel, causing it to protect the kernel that was booted at that point in time, which is not necessarily the same kernel as the one that is running right now. Reimplement the logic in C++ such that we can calculate it at run-time: Provide a function to produce a regular expression that matches all kernels that need protecting, and by changing the default root set function in the DepCache to make use of that expression. Note that the code groups the kernels by versions as before, and then marks all kernel packages with the same version. This optimized version inserts a virtual package $kernel into the cache when building it to avoid having to iterate over all packages in the cache to find the installed ones, significantly improving performance at a minor cost when building the cache. LP: #1615381 --- doc/examples/configure-index | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/examples/configure-index') diff --git a/doc/examples/configure-index b/doc/examples/configure-index index b73166082..571bf2369 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -54,6 +54,9 @@ APT Build-Profiles ""; NeverAutoRemove ""; // list of package name regexes + LastInstalledKernel ""; // last installed kernel version + VersionedKernelPackages ""; // regular expressions to be protected from autoremoval (kernel uname will be appended) + Protect-Kernels ""; // whether to protect installed kernels against autoremoval (default: true) // Options for apt-get Get -- cgit v1.2.3 From 944baec85a7496c1595242a31f6b1b37530451a5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 17 Dec 2020 15:19:53 +0100 Subject: Automatically remove unused kernels on dist-upgrade Kernels clutter /boot and /boot is small size, so we need to take extra care to remove kernels when possible. --- doc/examples/configure-index | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/examples/configure-index') diff --git a/doc/examples/configure-index b/doc/examples/configure-index index 571bf2369..15b020198 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -80,7 +80,9 @@ APT Remove ""; AllowUnauthenticated ""; // skip security - AutomaticRemove ""; + AutomaticRemove "" { + "Kernels" ""; // Allow removing kernels even if not removing other packages (true for dist-upgrade) + }; HideAutoRemove ""; // yes, no, small Simulate ""; -- cgit v1.2.3