nixosTests.systemd-initrd-luks-password: test mounting device unlocked in initrd after switching root
This commit is contained in:
parent
51e4bd298f
commit
46328f5596
1 changed files with 5 additions and 0 deletions
|
@ -23,6 +23,8 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: {
|
||||||
cryptroot2.device = "/dev/vdd";
|
cryptroot2.device = "/dev/vdd";
|
||||||
};
|
};
|
||||||
virtualisation.bootDevice = "/dev/mapper/cryptroot";
|
virtualisation.bootDevice = "/dev/mapper/cryptroot";
|
||||||
|
# test mounting device unlocked in initrd after switching root
|
||||||
|
virtualisation.fileSystems."/cryptroot2".device = "/dev/mapper/cryptroot2";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,6 +33,8 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: {
|
||||||
machine.wait_for_unit("multi-user.target")
|
machine.wait_for_unit("multi-user.target")
|
||||||
machine.succeed("echo -n supersecret | cryptsetup luksFormat -q --iter-time=1 /dev/vdc -")
|
machine.succeed("echo -n supersecret | cryptsetup luksFormat -q --iter-time=1 /dev/vdc -")
|
||||||
machine.succeed("echo -n supersecret | cryptsetup luksFormat -q --iter-time=1 /dev/vdd -")
|
machine.succeed("echo -n supersecret | cryptsetup luksFormat -q --iter-time=1 /dev/vdd -")
|
||||||
|
machine.succeed("echo -n supersecret | cryptsetup luksOpen -q /dev/vdd cryptroot2")
|
||||||
|
machine.succeed("mkfs.ext4 /dev/mapper/cryptroot2")
|
||||||
|
|
||||||
# Boot from the encrypted disk
|
# Boot from the encrypted disk
|
||||||
machine.succeed("bootctl set-default nixos-generation-1-specialisation-boot-luks.conf")
|
machine.succeed("bootctl set-default nixos-generation-1-specialisation-boot-luks.conf")
|
||||||
|
@ -44,5 +48,6 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: {
|
||||||
machine.wait_for_unit("multi-user.target")
|
machine.wait_for_unit("multi-user.target")
|
||||||
|
|
||||||
assert "/dev/mapper/cryptroot on / type ext4" in machine.succeed("mount")
|
assert "/dev/mapper/cryptroot on / type ext4" in machine.succeed("mount")
|
||||||
|
assert "/dev/mapper/cryptroot2 on /cryptroot2 type ext4" in machine.succeed("mount")
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue