6

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
  • 1
    This is completely different. I don't want to disable kernel updates. I don't want unattended updates to update it. That's not the same thing.
    – Deihmos
    Apr 4, 2019 at 2:53

1 Answer 1

8

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.

6
  • 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 "$".
    – user10489
    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.
    – user10489
    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/…
    – slhck
    May 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.
    – user10489
    May 15 at 11:13
  • Yep, Regex matching is mandated as explained here pimylifeup.com/unattended-upgrades-debian-ubuntu
    – rboy
    Aug 28 at 11:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .