[systemd-devel] Running a service *just* before unmounting filesystems

Jérémy Rosen jeremy.rosen at smile.fr
Mon Jun 11 15:48:27 UTC 2018


We solve a problem which is kinda similar in the embedded world when we 
do A/B update

I'll describe how we do it so you see if this can help

* Have a single "last boot went wrong" flag
When grub starts
* if the flag is set, show the boot menu (or a timer)
* if the flag is not set
   * skip the menu, don't initialize USB, fastboot
   * set the flag.
* At some point during the boot (late enough that it is possible to get 
a console) reset the flag.

this way, your system is "unstable" : either you reach the point where a 
console is available or you will have a menu at the next reboot.


The trick is to have grub first read the flag then set it to "bad" for 
the next boot. Linux set it to "good" if the boot was good enough

Hope this help...


Jérémy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180611/4dc7fb6d/attachment.html>


More information about the systemd-devel mailing list