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_package_update_upgrade_install.py#L119-L140

--
Major Hayden
_______________________________________________
cloud mailing list -- cloud@lists.fedoraproject.org
To unsubscribe send an email to cloud-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/cloud@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to