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/; " diff --git a/test/verify/check-users b/test/verify/check-users index 0eedc18ef437..ca9d6382279a 100755 --- a/test/verify/check-users +++ b/test/verify/check-users @@ -607,7 +607,11 @@ class TestAccounts(testlib.MachineCase): if not m.ostree_image: # User is not shown as logged in when logged in through Cockpit b.go("#/admin") - b.wait_visible("#account-logout[disabled]") + m.execute("loginctl terminate-user admin || true; loginctl kill-user admin || true") + print(m.execute("loginctl list-sessions")) + with b.wait_timeout(60): + print(m.execute("loginctl list-sessions")) + b.wait_visible("#account-logout[disabled]") (year, month) = m.execute("date +'%Y %b'").strip().split()