What do I need to do to exclude kernel updates from unattended upgrades? I would rather livepatching to update the kernel. Should i simply add "linux-image"; to the package blacklist?
1 Answer
Edit the configuration file, then add all linux kernel related package to blacklist.
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
Add following into blacklist.
linux-headers
linux-image
linux-generic
linux-modules
So the blacklist section would look like this.
Unattended-Upgrade::Package-Blacklist {
"linux-headers";
"linux-image";
"linux-generic";
"linux-modules";
};
This means all package starting with linux-headers
etc. will get blacklisted. NOTE: The configuration file requires regex matching.
You can check if it working by dry running them a.k.a test.
sudo unattended-upgrades --dry-run
This will simulate the whole unattended upgrades process, without actually running it.
-
While this does use regex, the answer above uses them wrong. "linux-headers*" means "linux header" followed by zero or more "s" which isn't terribly useful if not exactly wrong. Additionally, leaving off the "*" would match just as well. If you don't want ot to match a prefix, you have to terminate the string with a "$". Oct 24, 2022 at 23:54
-
It might be better to just match "linux-" instad of all of these... and that's the example that the file comes with. Oct 24, 2022 at 23:55
-
1@user10489 Where is the reference for the
$
? As far as I see in the unattended-upgrades source code, each blacklist entry is treated like a Python regex: git.launchpad.net/ubuntu/+source/unattended-upgrades/tree/…– slhckMay 15 at 9:34 -
My point was that 1) by default, it matches prefixes 2) they use regex not glob, so the strings above are wrong 3) the examples in the file are already correct 4) if you didn't want prefixes, you need
$
but this would also be wrong. May 15 at 11:13 -
Yep, Regex matching is mandated as explained here pimylifeup.com/unattended-upgrades-debian-ubuntu– rboyAug 28 at 11:59