From 3fdfb983c76d9feef179c6ed3e67cf3cac815cec Mon Sep 17 00:00:00 2001 From: Shogo Takata Date: Tue, 19 May 2026 04:18:08 +0900 Subject: [PATCH] nixosTests.pam-zfs-key: fix dataset mounting The test created ZFS datasets with canmount=noauto, but pam_zfs_key's mount_dataset() now checks canmount == ZFS_CANMOUNT_ON and skips mounting otherwise (added in https://github.com/openzfs/zfs/commit/387ed5ca41). Use the default canmount=on and unmount before unloading the key to compensate for the auto-mount that happens when the key is loaded during creation. This also silences the warning for forceImportRoot. Assisted-by: opencode with DeepSeek V4 Flash Free --- nixos/tests/pam/zfs-key.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nixos/tests/pam/zfs-key.nix b/nixos/tests/pam/zfs-key.nix index 9251a3a9173c..b7ef454b67e6 100644 --- a/nixos/tests/pam/zfs-key.nix +++ b/nixos/tests/pam/zfs-key.nix @@ -11,6 +11,7 @@ in { ... }: { boot.supportedFilesystems = [ "zfs" ]; + boot.zfs.forceImportRoot = false; networking.hostId = "12345678"; @@ -42,10 +43,10 @@ in machine.succeed("truncate -s 64M /testpool.img") machine.succeed("zpool create -O canmount=off '${pool}' /testpool.img") machine.succeed("zfs create -o canmount=off -p '${homes}'") - machine.succeed("echo ${userPassword} | zfs create -o canmount=noauto -o encryption=on -o keyformat=passphrase '${homes}/alice'") - machine.succeed("zfs unload-key '${homes}/alice'") - machine.succeed("echo ${mismatchPass} | zfs create -o canmount=noauto -o encryption=on -o keyformat=passphrase '${homes}/bob'") - machine.succeed("zfs unload-key '${homes}/bob'") + machine.succeed("echo ${userPassword} | zfs create -o encryption=on -o keyformat=passphrase '${homes}/alice'") + machine.succeed("zfs unmount '${homes}/alice' && zfs unload-key '${homes}/alice'") + machine.succeed("echo ${mismatchPass} | zfs create -o encryption=on -o keyformat=passphrase '${homes}/bob'") + machine.succeed("zfs unmount '${homes}/bob' && zfs unload-key '${homes}/bob'") with subtest("Switch to tty2"): machine.fail("pgrep -f 'agetty.*tty2'")