tests/bcachefs: handle systemd initrd unlock prompts

nixpkgs dropped the scripted stage 1 for bcachefs (8cadc5ac03), so the
systemd initrd is always used. It starts one unlock-bcachefs-<mnt> unit
per mount point; /, /home and /nix share one encrypted filesystem, so the
units race on the device (EBUSY) and the number and order of passphrase
prompts varies (1-3, any order). The fixed OCR sequence then waited for
a /home prompt that never came.

Answer every password query on the serial console until the initrd
reaches initrd-fs.target, which pending queries block. OCR is no longer
needed.
This commit is contained in:
lassulus committed 2026-11-20 10:49:13 +01:00
1 parent f363468964
commit 480756f887
1 file changed
+7 -7
+7 -7
View File
@@ -6,14 +6,14 @@ diskoLib.testLib.makeDiskoTest {
inherit pkgs; inherit pkgs;
name = "bcachefs"; name = "bcachefs";
disko-config = ../example/bcachefs.nix; disko-config = ../example/bcachefs.nix;
enableOCR = true; # One unlock unit per mount point races on the shared filesystem, so the
# number and order of prompts varies: answer them until initrd-fs.target.
bootCommands = '' bootCommands = ''
machine.wait_for_text("enter passphrase for /"); while True:
machine.send_chars("secretsecret\n"); machine.wait_for_console_text("Starting password query on /dev/ttyS0|Reached target Initrd File Systems")
machine.wait_for_text("enter passphrase for /home"); if "Reached target Initrd File Systems" in machine.get_console_log():
machine.send_chars("secretsecret\n"); break
machine.wait_for_text("enter passphrase for /nix"); machine.send_console("secretsecret\n")
machine.send_chars("secretsecret\n");
''; '';
extraInstallerConfig = { extraInstallerConfig = {
boot = { boot = {