From db50a2b55c277b3006430258e8980fdfec4a4aaa Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Fri, 7 Jun 2024 13:49:20 +0100 Subject: [PATCH] man: beef up soft-reboot example unit Note that journal sockets have to be mounted for softreboot surviving units, as per thread on the ML, otherwise logging does not work afterwards: https://lists.freedesktop.org/archives/systemd-devel/2024-June/050382.html Remove the oneshot, as it didn't actually make sense for a sleep infinity. And run in a separate image, to showcase that the unit should really be disconnected from the rootfs. --- man/systemd-soft-reboot.service.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/man/systemd-soft-reboot.service.xml b/man/systemd-soft-reboot.service.xml index 9b29a5d68a7..bdbdb9cde42 100644 --- a/man/systemd-soft-reboot.service.xml +++ b/man/systemd-soft-reboot.service.xml @@ -106,7 +106,10 @@ normal shutdown, reboot and maintenance mode. Finally, they have to be ordered after basic.target to ensure correct ordering on boot. Note that in case any new or custom units are used to isolate to, or that implement an equivalent shutdown functionality, they will - also have to be configured manually for correct ordering and conflicting. For example: + also have to be configured manually for correct ordering and conflicting. In addition, to ensure the + service is disconnected from the rootfs resources (see next paragraph), it should run from a separate + image, but with the journal sockets mounted so that it is still allowed to log to the system journal. + For example: [Unit] Description=My Surviving Service @@ -118,7 +121,9 @@ Conflicts=reboot.target kexec.target poweroff.target halt.target rescue.target e Before=shutdown.target rescue.target emergency.target [Service] -Type=oneshot +RootImage=/var/lib/root.raw +TemporaryFileSystem=/run +BindReadOnlyPaths=/run/systemd/journal/socket /run/systemd/journal/stdout ExecStart=sleep infinity