diff --git a/man/systemd-soft-reboot.service.xml b/man/systemd-soft-reboot.service.xml index 5960cf90a6..711cd6e3e9 100644 --- a/man/systemd-soft-reboot.service.xml +++ b/man/systemd-soft-reboot.service.xml @@ -122,14 +122,6 @@ url="https://systemd.io/PORTABLE_SERVICES">Portable Services, but make sure no resource from the host's root filesystem is pinned via BindPaths= or similar unit settings, otherwise the old root filesystem will be kept in memory as long as the unit is running. - - If units shall be left running until the very end of shutdown during a soft reboot operation, but - shall be terminated regularly during other forms of shutdown, it's recommended to set - DefaultDependencies=no and then place - Conflicts=/Before= onto reboot.target, - kexec.target, poweroff.target and - halt.target (but not onto - soft-reboot.target). diff --git a/src/core/main.c b/src/core/main.c index 7094be8dba..613783fd70 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1871,6 +1871,9 @@ static int do_reexecute( * SIGCHLD for them after deserializing. */ if (IN_SET(objective, MANAGER_SWITCH_ROOT, MANAGER_SOFT_REBOOT)) broadcast_signal(SIGTERM, /* wait_for_exit= */ false, /* send_sighup= */ true, arg_default_timeout_stop_usec); + /* On soft reboot really make sure nothing is left */ + if (objective == MANAGER_SOFT_REBOOT) + broadcast_signal(SIGKILL, /* wait_for_exit= */ false, /* send_sighup= */ false, arg_default_timeout_stop_usec); if (!switch_root_dir && objective == MANAGER_SOFT_REBOOT) { /* If no switch root dir is specified, then check if /run/nextroot/ qualifies and use that */ diff --git a/test/units/testsuite-82.sh b/test/units/testsuite-82.sh index a1c82a9fc9..9e37d0c06f 100755 --- a/test/units/testsuite-82.sh +++ b/test/units/testsuite-82.sh @@ -20,14 +20,10 @@ if [ -f /run/testsuite82.touch3 ]; then read -r x <&5 test "$x" = "oinkoink" - # Check that the surviving service is still around - test "$(systemctl show -P ActiveState testsuite-82-survive.service)" = "active" + # Check that no service is still around + test "$(systemctl show -P ActiveState testsuite-82-survive.service)" != "active" test "$(systemctl show -P ActiveState testsuite-82-nosurvive.service)" != "active" - # Take out the big guns now, and kill the service via SIGKILL (SIGTERM is blocked after all, see below) - systemctl --signal=KILL kill testsuite-82-survive.service - systemctl stop testsuite-82-survive.service - # All succeeded, exit cleanly now elif [ -f /run/testsuite82.touch2 ]; then @@ -47,8 +43,8 @@ elif [ -f /run/testsuite82.touch2 ]; then systemd-notify --fd=3 --pid=parent 3<"$T" rm "$T" - # Check that the surviving service is still around - test "$(systemctl show -P ActiveState testsuite-82-survive.service)" = "active" + # Check that no service is still around + test "$(systemctl show -P ActiveState testsuite-82-survive.service)" != "active" test "$(systemctl show -P ActiveState testsuite-82-nosurvive.service)" != "active" # Test that we really are in the new overlayfs root fs @@ -86,8 +82,8 @@ elif [ -f /run/testsuite82.touch ]; then systemd-notify --fd=3 --pid=parent 3<"$T" rm "$T" - # Check that the surviving service is still around - test "$(systemctl show -P ActiveState testsuite-82-survive.service)" = "active" + # Check that no service survived, regardless of the configuration + test "$(systemctl show -P ActiveState testsuite-82-survive.service)" != "active" test "$(systemctl show -P ActiveState testsuite-82-nosurvive.service)" != "active" # This time we test the /run/nextroot/ root switching logic. (We synthesize a new rootfs from the old via overlayfs)