From b295a55c83c36b5ad0c9a4cc058a71a3aa956d23 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Thu, 19 Mar 2026 12:25:44 +0100 Subject: [PATCH] nixos/tests/systemd-homed: fix firstboot prompt flow for v259 The test has been broken since the 258.3 -> 259 bump. v259 removed the "Press any key to proceed" gate and changed the firstboot unit to pass --prompt-shell=no --prompt-groups=no, so the shell and group prompts the test waits for never appear. Update to the current prompt sequence (username, password, repeat). Add wheel membership via homectl update afterwards since the wizard no longer prompts for groups. Leaving the shell unset also exercises the NixOS default-user-shell meson option. --- nixos/tests/systemd-homed.nix | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/nixos/tests/systemd-homed.nix b/nixos/tests/systemd-homed.nix index 41aff0ecedba..f0a45f21d591 100644 --- a/nixos/tests/systemd-homed.nix +++ b/nixos/tests/systemd-homed.nix @@ -46,27 +46,25 @@ in with subtest("create systemd-homed user on first boot prompt"): machine.wait_for_unit("systemd-homed.service") - machine.wait_until_tty_matches("1", "-- Press any key to proceed --") - machine.send_chars(" ") - machine.wait_until_tty_matches("1", "Please enter user name") + machine.wait_until_tty_matches("1", "Please enter user name to create") machine.send_chars("${username}\n") - machine.wait_until_tty_matches("1", "Please enter an auxiliary group") - machine.send_chars("wheel\n") - machine.wait_until_tty_matches("1", "Please enter an auxiliary group") - machine.send_chars("\n") - machine.wait_until_tty_matches("1", "Please enter the shell to use") - machine.send_chars("/bin/sh\n") - machine.wait_until_tty_matches("1", "Please enter new password") + machine.wait_until_tty_matches("1", "Please enter new password for user ${username}:") machine.send_chars("${initialPassword}\n") machine.wait_until_tty_matches("1", "(repeat)") machine.send_chars("${initialPassword}\n") + machine.wait_for_unit("systemd-homed-firstboot.service") + + # The firstboot wizard doesn't prompt for groups; add wheel here so the + # later sudo subtest works. Leaving the shell unset also exercises the + # NixOS default-user-shell meson option. + machine.succeed("homectl update ${username} --offline -G wheel") with subtest("login as homed user"): machine.wait_until_tty_matches("1", "login: ") machine.send_chars("${username}\n") machine.wait_until_tty_matches("1", "Password: ") machine.send_chars("${initialPassword}\n") - machine.wait_until_succeeds("pgrep -u ${username} -t tty1 sh") + machine.wait_until_succeeds("pgrep -u ${username} -t tty1 bash") machine.send_chars("whoami > /tmp/2\n") machine.wait_for_file("/tmp/2") assert "${username}" in machine.succeed("cat /tmp/2") @@ -122,11 +120,11 @@ in sshClient.send_chars("ssh -o StrictHostKeyChecking=no -i /tmp/id_ed25519 ${username}@machine\n") sshClient.wait_until_tty_matches("1", "Please enter password for user") sshClient.send_chars("${newPassword}\n") - machine.wait_until_succeeds("pgrep -u ${username} sh") + machine.wait_until_succeeds("pgrep -u ${username} bash") sshClient.send_chars("whoami > /tmp/5\n") machine.wait_for_file("/tmp/5") assert "${username}" in machine.succeed("cat /tmp/5") sshClient.send_chars("exit\n") # ssh - sshClient.send_chars("exit\n") # sh + sshClient.send_chars("exit\n") # bash ''; }