nixos/tests/machinectl: Create /usr directory

Since #488508 was merged, systemd nspawn now expects /usr to exist
in the rootfs before it will start a container.

Create the /usr directory in the relevant containers throughout this
test.
This commit is contained in:
Lucas Savva
2026-07-05 00:56:26 +01:00
parent 2eaa6e4954
commit 4702662bb8
+4 -1
View File
@@ -106,6 +106,8 @@ let
}
];
extraCommands = "mkdir -p usr";
contents = [
{
source = containerSystem + "/etc/os-release";
@@ -171,6 +173,7 @@ in
systemd.tmpfiles.rules = [
"d /var/lib/machines/shared-decl 0755 root root - -"
"d /var/lib/machines/shared-decl/usr 0755 root root - -"
];
systemd.nspawn.shared-decl = {
execConfig = {
@@ -228,7 +231,7 @@ in
machine.wait_until_succeeds("systemctl -M shared-decl is-active default.target");
machine.succeed("machinectl stop shared-decl");
machine.succeed("mkdir -p ${containerRoot}");
machine.succeed("mkdir -p ${containerRoot}/usr");
# start container with shared nix store by using same arguments as for systemd-nspawn@.service
machine.succeed("systemd-run systemd-nspawn --machine=${containerName} --network-veth -U --bind-ro=/nix/store ${containerSystem}/init")