Can I configure Unattended Upgrades to not upgrade packages that require a reboot?

Solution 1:

The problem with pinning packages to prevent them from upgrading is that to upgrade them you need to unpin them again.

The file /var/run/reboot-required.pkgs contains a list of packages that trigger the request for a reboot after unattended-upgrade has run.

Inside the configuration file for unattended-upgrades in /etc/apt/apt.conf.d/50unattended-upgrades there is a section dedicated to preventing some packages from being upgraded automatically that looks like this

Unattended-Upgrade::Package-Blacklist{
    foo_package1;
    foo_package2;
    foo_package3;
}

Edit the list to prevent those packages from being upgraded automatically.

I would start by blacklisting the usual suspects: kernel, libc, gcc, etc and every time you see the computer is asking for a reboot check /var/run/reboot-required.pkgs and add those packages to the unattended upgrades blacklist.