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_packag...
-- Major Hayden
On Thu, May 11, 2023 at 6:19 PM Major Hayden major@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:
- User launches an instance and requests package updates on boot
- Instance boots and dnf updates packages
- Some of the packages (openssl perhaps) need a reboot to take effect
- cloud-init recognizes that the system needs a reboot after the package update
- 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_packag...
I think it would be reasonable and useful to preload tracer and the dnf plugin for it.
Dne 12. 05. 23 v 5:38 Neal Gompa napsal(a):
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].
This can be added to tracer so you will have the same interface. Please open RFE at https://github.com/FrostyX/tracer
Miroslav
On Fri, May 12, 2023, at 03:23, Miroslav Suchý wrote:
Dne 12. 05. 23 v 5:38 Neal Gompa napsal(a):
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].
This can be added to tracer so you will have the same interface. Please open RFE at https://github.com/FrostyX/tracer
Done! Thank you.
https://github.com/FrostyX/tracer/issues/195