diff --git a/test/common/testlib.py b/test/common/testlib.py index a31bd9cf5728..ce1238d09029 100644 --- a/test/common/testlib.py +++ b/test/common/testlib.py @@ -1697,7 +1697,9 @@ def _terminate_sessions(self) -> None: raise # terminate all systemd user services for users who are not logged in - m.execute("systemctl stop user@*.service") + # since systemd 256 we stop user@*.service now also stops the root session (uid 0) + m.execute("cd /run/systemd/users/; " + "for f in $(ls); do [ $f -le 500 ] || systemctl stop user@$f; done") # Clean up "closing" sessions again, and clean user id cache for non-system users m.execute("systemctl stop systemd-logind; cd /run/systemd/users/; "