From 480756f887bb960584776f78855daa628a28cf1c Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 20 Nov 2026 10:49:13 +0100 Subject: [PATCH] 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- 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. --- tests/bcachefs.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/bcachefs.nix b/tests/bcachefs.nix index 97cca3b..b671551 100644 --- a/tests/bcachefs.nix +++ b/tests/bcachefs.nix @@ -6,14 +6,14 @@ diskoLib.testLib.makeDiskoTest { inherit pkgs; name = "bcachefs"; 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 = '' - machine.wait_for_text("enter passphrase for /"); - machine.send_chars("secretsecret\n"); - machine.wait_for_text("enter passphrase for /home"); - machine.send_chars("secretsecret\n"); - machine.wait_for_text("enter passphrase for /nix"); - machine.send_chars("secretsecret\n"); + while True: + machine.wait_for_console_text("Starting password query on /dev/ttyS0|Reached target Initrd File Systems") + if "Reached target Initrd File Systems" in machine.get_console_log(): + break + machine.send_console("secretsecret\n") ''; extraInstallerConfig = { boot = {