When Ubuntu Livepatch has patched the kernel but recommends restarting to boot into the new version, a message appears in the motd like this:
*** Livepatch has fixed kernel vulnerabilities. System restart recommended on the closest maintenance window
It doesn't touch /run/reboot-required
, even when apt upgrade
has installed the new kernel.
I'm in the fortunate situation of having a weekly maintenance window, and I would like the system to reboot automatically when Livepatch recommends it. In other words, I want Livepatch's immediate patch functionality, but I don't need marathon uptime.
What's the best way of achieving this? As far as I can tell, there are four possibilities:
- Is there a way to set Livepatch to touch
/run/reboot-required
?
- Is there a way to set apt to touch
/run/reboot-required
after a kernel upgrade, even though Livepatch is active?
- Is there a way to set unattended-upgrades to reboot when recommended by Livepatch, even when
/run/reboot-required
isn't present?
- Is there a way to test whether Livepatch is recommending a restart, programmatically?
canonical-livepatch kernel-upgrade-required
appears to produce specific return codes, but these don't seem to be documented officially.