manager_startup() runs manager_gc(m, /* drop_not_started= */ false) before the user_start() loop. user_may_gc()'s linger guard requires user_unit_active() to be true to keep a user, but at this point the per-user units have not been started yet, so for any lingering user that ended up in the user_gc_queue the guard falls through and manager_gc frees the User struct before user_start() ever runs. This only manifests after `systemctl soft-reboot`, because /run is tmpfs and survives soft-reboot: /run/systemd/users/UID files persist, and manager_enumerate_users() in src/login/logind.c explicitly calls user_add_to_gc_queue() for every UID it loads from there. Cold boot is unaffected because /run is empty, so the linger users that come in via manager_enumerate_linger_users() never enter the GC queue at all and reach user_start() directly. Special-case the startup-time GC: if a linger file exists, keep the user regardless of unit state — user_start() is about to run and will queue the appropriate jobs. Steady-state GC (drop_not_started=true, in the event loop) still requires user_unit_active() so we don't hold on to records for lingering users whose units genuinely died. Fixes: https://github.com/systemd/systemd/issues/41789 Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
System and Service Manager
Details
Most documentation is available on systemd's web site.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
Repositories with distribution packages built from git main are available on OBS, and also repositories with packages built from the latest stable release
