test "$(systemctl show -P ActiveState TEST-82-SOFTREBOOT-nosurvive-sigterm.service)" != "active"
test "$(systemctl show -P ActiveState TEST-82-SOFTREBOOT-nosurvive.service)" != "active"
+ # Regression test for #41789: the lingering user enabled on the first boot must
+ # have its user@.service started again after the soft reboot. Before the fix it
+ # was GC'd at logind startup and never restarted. Disable lingering again here,
+ # before the nextroot switch below (the third boot runs on a minimal overlay
+ # rootfs that does not have this user). terminate-user is best-effort: it can
+ # race the asynchronous disable-linger/UserStopDelaySec teardown.
+ linger_uid=$(id -u testuser)
+ timeout 30 bash -c "until systemctl is-active --quiet user@${linger_uid}.service; do sleep 1; done"
+ loginctl disable-linger testuser
+ loginctl terminate-user testuser || true
+
# This time we test the /run/nextroot/ root switching logic. (We synthesize a new rootfs from the old via overlayfs)
mkdir -p /run/nextroot /tmp/nextroot-lower /original-root
mount -t tmpfs tmpfs /tmp/nextroot-lower
systemd-run --wait false || true
done
+ # Regression test for #41789: a lingering user's user@.service must come back
+ # after a soft reboot, the same way it does after a hardware reboot. It used
+ # to be garbage-collected at logind startup (before user_start() ran), because
+ # /run/systemd/users is preserved across soft-reboot and fed the user into the
+ # GC queue while its units were not active yet. Enable lingering for the
+ # pre-existing testuser here; the second boot asserts the service is active
+ # again. testuser lives in the persistent rootfs, so it survives the
+ # (non-nextroot) soft reboot into the second boot.
+ loginctl enable-linger testuser
+ linger_uid=$(id -u testuser)
+ timeout 30 bash -c "until systemctl is-active --quiet user@${linger_uid}.service; do sleep 1; done"
+
trigger_uevent
# Now issue the soft reboot. We should be right back soon.