On Thu, May 11, 2023 at 6:19 PM Major Hayden <major(a)mhtx.net> wrote:
Hey there,
I was reading through BZ 2192127[0] and it's a request for enhancement to recognize
when a system needs a reboot after package updates. Here's the scenario:
1) User launches an instance and requests package updates on boot
2) Instance boots and dnf updates packages
3) Some of the packages (openssl perhaps) need a reboot to take effect
4) cloud-init recognizes that the system needs a reboot after the package update
5) cloud-init reboots the system
On Debian/Ubuntu systems, apt will write a file to /var/run/reboot-required that provides
a hint that a reboot is needed. After cloud-init finishes its run, it checks to see if
that file is present and then reboots the system immediately[1].
We can use `tracer` in Fedora to determine if a reboot is needed. When you run it, it
prints out what needs to be done after the most recent dnf update. It has some exit codes
that tell you what needs to be done. The biggest two are:
103: You need to restart your user session
104: The whole machine needs a reboot
Adding tracer includes a few Python dependencies that aren't terribly large. However,
there may be an easier way to do this that I'm not considering. Does anyone else have
any lightweight ways that cloud-init could determine if a reboot is needed?
[0]
https://bugzilla.redhat.com/show_bug.cgi?id=2192127
[1]
https://github.com/canonical/cloud-init/blob/main/cloudinit/config/cc_pac...
I think it would be reasonable and useful to preload tracer and the
dnf plugin for it.
--
真実はいつも一つ!/ Always, there's only one truth!