From 462c2bc5d678628a5ec9112d1adcf61663fbee27 Mon Sep 17 00:00:00 2001 From: andre4ik3 Date: Fri, 20 Mar 2026 06:45:42 +0000 Subject: [PATCH] nixos/tests/pam-lastlog: use user account instead of run0 Fixes the test, it has been broken for a while now on master. --- nixos/tests/pam/pam-lastlog.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/nixos/tests/pam/pam-lastlog.nix b/nixos/tests/pam/pam-lastlog.nix index 70bb74a055c5..4d1dab8e7150 100644 --- a/nixos/tests/pam/pam-lastlog.nix +++ b/nixos/tests/pam/pam-lastlog.nix @@ -6,10 +6,7 @@ nodes.machine = { ... }: { - # we abuse run0 for a quick login as root as to not require setting up accounts and passwords - security.pam.services.systemd-run0 = { - lastlog.enable = true; - }; + imports = [ ../common/user-account.nix ]; }; testScript = '' @@ -23,8 +20,13 @@ with subtest("Test lastlog entries are created by logins"): machine.wait_for_unit("multi-user.target") - machine.succeed("run0 --pty true") # perform full login - print(machine.succeed("lastlog2 --active --user root")) + machine.wait_until_tty_matches("1", "login: ") + machine.send_chars("alice\n") + machine.wait_until_tty_matches("1", "Password: ") + machine.send_chars("foobar\n") + machine.wait_until_succeeds("pgrep -u alice bash") + print(machine.succeed("lastlog2 --active --user alice")) machine.succeed("stat /var/lib/lastlog/lastlog2.db") + machine.send_chars("exit\n") ''; }