2020-01-22 08:45:01 +03:00
|
|
|
import ./make-test-python.nix ({ pkgs, ... }: {
|
systemd: Update to latest NixOS branch
Updated to the latest version of the nixos-v237 branch, which fixes two
things:
* Make sure that systemd looks in /etc for configuration files.
https://github.com/NixOS/systemd/pull/15
* Fix handling of the x-initrd.mount option.
https://github.com/NixOS/systemd/pull/16
I've added NixOS VM tests for both to ensure we won't run into
regressions. The newly added systemd test only tests for that and is by
no means exhaustive, but it's a start.
Personally I only wanted to fix the former issue, because that's the one
I've been debugging. After sending in a pull request for our systemd
fork (https://github.com/NixOS/systemd/pull/17) I got a notice from
@Mic92, that he already fixed this and his fix was even better as it's
even suitable for upstream (so we hopefully can drop that patch
someday).
The reason why the second one came in was simply because it has been
merged before the former, but I thought it would be a good idea to have
tests for that as well.
In addition I've removed the sysconfdir=$out/etc entry to make sure the
default (/etc) is used. Installing is still done to $out, because those
directories that were previously into sysconfdir now get into
factoryconfdir.
Quote from commit NixOS/systemd@98067cc806ae0d2759cdd2334f230cd8548e531:
By default systemd should read all its configuration from /etc.
Therefore we rely on -Dsysconfdir=/etc in meson as default value.
Unfortunately this would also lead to installation of systemd's own
configuration files to `/etc` whereas we are limited to /nix/store. To
counter that this commit introduces two new configuration variables
`factoryconfdir` and `factorypkgconfdir` to install systemd's own
configuration into nix store again, while having executables looking
up files in /etc.
Tested this change against all of the NixOS VM tests we have in
nixos/release.nix. Between this change and its parent no new tests were
failing (although a lot of them were flaky).
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @Mic92, @tk-ecotelecom, @edolstra, @fpletz
Fixes: #35415
Fixes: #35268
2018-03-03 09:10:22 +03:00
|
|
|
name = "systemd";
|
|
|
|
|
|
|
|
machine = { lib, ... }: {
|
|
|
|
imports = [ common/user-account.nix common/x11.nix ];
|
|
|
|
|
2020-08-05 02:34:12 +03:00
|
|
|
virtualisation.emptyDiskImages = [ 512 512 ];
|
|
|
|
virtualisation.memorySize = 1024;
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.cryptsetup ];
|
systemd: Update to latest NixOS branch
Updated to the latest version of the nixos-v237 branch, which fixes two
things:
* Make sure that systemd looks in /etc for configuration files.
https://github.com/NixOS/systemd/pull/15
* Fix handling of the x-initrd.mount option.
https://github.com/NixOS/systemd/pull/16
I've added NixOS VM tests for both to ensure we won't run into
regressions. The newly added systemd test only tests for that and is by
no means exhaustive, but it's a start.
Personally I only wanted to fix the former issue, because that's the one
I've been debugging. After sending in a pull request for our systemd
fork (https://github.com/NixOS/systemd/pull/17) I got a notice from
@Mic92, that he already fixed this and his fix was even better as it's
even suitable for upstream (so we hopefully can drop that patch
someday).
The reason why the second one came in was simply because it has been
merged before the former, but I thought it would be a good idea to have
tests for that as well.
In addition I've removed the sysconfdir=$out/etc entry to make sure the
default (/etc) is used. Installing is still done to $out, because those
directories that were previously into sysconfdir now get into
factoryconfdir.
Quote from commit NixOS/systemd@98067cc806ae0d2759cdd2334f230cd8548e531:
By default systemd should read all its configuration from /etc.
Therefore we rely on -Dsysconfdir=/etc in meson as default value.
Unfortunately this would also lead to installation of systemd's own
configuration files to `/etc` whereas we are limited to /nix/store. To
counter that this commit introduces two new configuration variables
`factoryconfdir` and `factorypkgconfdir` to install systemd's own
configuration into nix store again, while having executables looking
up files in /etc.
Tested this change against all of the NixOS VM tests we have in
nixos/release.nix. Between this change and its parent no new tests were
failing (although a lot of them were flaky).
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @Mic92, @tk-ecotelecom, @edolstra, @fpletz
Fixes: #35415
Fixes: #35268
2018-03-03 09:10:22 +03:00
|
|
|
|
|
|
|
fileSystems = lib.mkVMOverride {
|
|
|
|
"/test-x-initrd-mount" = {
|
|
|
|
device = "/dev/vdb";
|
|
|
|
fsType = "ext2";
|
|
|
|
autoFormat = true;
|
|
|
|
noCheck = true;
|
|
|
|
options = [ "x-initrd.mount" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.extraConfig = "DefaultEnvironment=\"XXX_SYSTEM=foo\"";
|
|
|
|
systemd.user.extraConfig = "DefaultEnvironment=\"XXX_USER=bar\"";
|
|
|
|
services.journald.extraConfig = "Storage=volatile";
|
2020-01-27 01:41:19 +03:00
|
|
|
test-support.displayManager.auto.user = "alice";
|
systemd: Update to latest NixOS branch
Updated to the latest version of the nixos-v237 branch, which fixes two
things:
* Make sure that systemd looks in /etc for configuration files.
https://github.com/NixOS/systemd/pull/15
* Fix handling of the x-initrd.mount option.
https://github.com/NixOS/systemd/pull/16
I've added NixOS VM tests for both to ensure we won't run into
regressions. The newly added systemd test only tests for that and is by
no means exhaustive, but it's a start.
Personally I only wanted to fix the former issue, because that's the one
I've been debugging. After sending in a pull request for our systemd
fork (https://github.com/NixOS/systemd/pull/17) I got a notice from
@Mic92, that he already fixed this and his fix was even better as it's
even suitable for upstream (so we hopefully can drop that patch
someday).
The reason why the second one came in was simply because it has been
merged before the former, but I thought it would be a good idea to have
tests for that as well.
In addition I've removed the sysconfdir=$out/etc entry to make sure the
default (/etc) is used. Installing is still done to $out, because those
directories that were previously into sysconfdir now get into
factoryconfdir.
Quote from commit NixOS/systemd@98067cc806ae0d2759cdd2334f230cd8548e531:
By default systemd should read all its configuration from /etc.
Therefore we rely on -Dsysconfdir=/etc in meson as default value.
Unfortunately this would also lead to installation of systemd's own
configuration files to `/etc` whereas we are limited to /nix/store. To
counter that this commit introduces two new configuration variables
`factoryconfdir` and `factorypkgconfdir` to install systemd's own
configuration into nix store again, while having executables looking
up files in /etc.
Tested this change against all of the NixOS VM tests we have in
nixos/release.nix. Between this change and its parent no new tests were
failing (although a lot of them were flaky).
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @Mic92, @tk-ecotelecom, @edolstra, @fpletz
Fixes: #35415
Fixes: #35268
2018-03-03 09:10:22 +03:00
|
|
|
|
2019-07-25 21:50:02 +03:00
|
|
|
systemd.shutdown.test = pkgs.writeScript "test.shutdown" ''
|
2020-04-07 09:25:48 +03:00
|
|
|
#!${pkgs.runtimeShell}
|
2019-07-25 21:50:02 +03:00
|
|
|
PATH=${lib.makeBinPath (with pkgs; [ utillinux coreutils ])}
|
|
|
|
mount -t 9p shared -o trans=virtio,version=9p2000.L /tmp/shared
|
|
|
|
touch /tmp/shared/shutdown-test
|
|
|
|
umount /tmp/shared
|
|
|
|
'';
|
|
|
|
|
systemd: Update to latest NixOS branch
Updated to the latest version of the nixos-v237 branch, which fixes two
things:
* Make sure that systemd looks in /etc for configuration files.
https://github.com/NixOS/systemd/pull/15
* Fix handling of the x-initrd.mount option.
https://github.com/NixOS/systemd/pull/16
I've added NixOS VM tests for both to ensure we won't run into
regressions. The newly added systemd test only tests for that and is by
no means exhaustive, but it's a start.
Personally I only wanted to fix the former issue, because that's the one
I've been debugging. After sending in a pull request for our systemd
fork (https://github.com/NixOS/systemd/pull/17) I got a notice from
@Mic92, that he already fixed this and his fix was even better as it's
even suitable for upstream (so we hopefully can drop that patch
someday).
The reason why the second one came in was simply because it has been
merged before the former, but I thought it would be a good idea to have
tests for that as well.
In addition I've removed the sysconfdir=$out/etc entry to make sure the
default (/etc) is used. Installing is still done to $out, because those
directories that were previously into sysconfdir now get into
factoryconfdir.
Quote from commit NixOS/systemd@98067cc806ae0d2759cdd2334f230cd8548e531:
By default systemd should read all its configuration from /etc.
Therefore we rely on -Dsysconfdir=/etc in meson as default value.
Unfortunately this would also lead to installation of systemd's own
configuration files to `/etc` whereas we are limited to /nix/store. To
counter that this commit introduces two new configuration variables
`factoryconfdir` and `factorypkgconfdir` to install systemd's own
configuration into nix store again, while having executables looking
up files in /etc.
Tested this change against all of the NixOS VM tests we have in
nixos/release.nix. Between this change and its parent no new tests were
failing (although a lot of them were flaky).
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @Mic92, @tk-ecotelecom, @edolstra, @fpletz
Fixes: #35415
Fixes: #35268
2018-03-03 09:10:22 +03:00
|
|
|
systemd.services.testservice1 = {
|
|
|
|
description = "Test Service 1";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig.Type = "oneshot";
|
|
|
|
script = ''
|
|
|
|
if [ "$XXX_SYSTEM" = foo ]; then
|
|
|
|
touch /system_conf_read
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.user.services.testservice2 = {
|
|
|
|
description = "Test Service 2";
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
serviceConfig.Type = "oneshot";
|
|
|
|
script = ''
|
|
|
|
if [ "$XXX_USER" = bar ]; then
|
|
|
|
touch "$HOME/user_conf_read"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
2020-07-09 04:43:12 +03:00
|
|
|
|
|
|
|
systemd.watchdog = {
|
|
|
|
device = "/dev/watchdog";
|
|
|
|
runtimeTime = "30s";
|
|
|
|
rebootTime = "10min";
|
|
|
|
kexecTime = "5min";
|
|
|
|
};
|
systemd: Update to latest NixOS branch
Updated to the latest version of the nixos-v237 branch, which fixes two
things:
* Make sure that systemd looks in /etc for configuration files.
https://github.com/NixOS/systemd/pull/15
* Fix handling of the x-initrd.mount option.
https://github.com/NixOS/systemd/pull/16
I've added NixOS VM tests for both to ensure we won't run into
regressions. The newly added systemd test only tests for that and is by
no means exhaustive, but it's a start.
Personally I only wanted to fix the former issue, because that's the one
I've been debugging. After sending in a pull request for our systemd
fork (https://github.com/NixOS/systemd/pull/17) I got a notice from
@Mic92, that he already fixed this and his fix was even better as it's
even suitable for upstream (so we hopefully can drop that patch
someday).
The reason why the second one came in was simply because it has been
merged before the former, but I thought it would be a good idea to have
tests for that as well.
In addition I've removed the sysconfdir=$out/etc entry to make sure the
default (/etc) is used. Installing is still done to $out, because those
directories that were previously into sysconfdir now get into
factoryconfdir.
Quote from commit NixOS/systemd@98067cc806ae0d2759cdd2334f230cd8548e531:
By default systemd should read all its configuration from /etc.
Therefore we rely on -Dsysconfdir=/etc in meson as default value.
Unfortunately this would also lead to installation of systemd's own
configuration files to `/etc` whereas we are limited to /nix/store. To
counter that this commit introduces two new configuration variables
`factoryconfdir` and `factorypkgconfdir` to install systemd's own
configuration into nix store again, while having executables looking
up files in /etc.
Tested this change against all of the NixOS VM tests we have in
nixos/release.nix. Between this change and its parent no new tests were
failing (although a lot of them were flaky).
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @Mic92, @tk-ecotelecom, @edolstra, @fpletz
Fixes: #35415
Fixes: #35268
2018-03-03 09:10:22 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2020-01-22 08:45:01 +03:00
|
|
|
import re
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
machine.wait_for_x()
|
2018-04-16 01:43:33 +03:00
|
|
|
# wait for user services
|
2020-01-22 08:45:01 +03:00
|
|
|
machine.wait_for_unit("default.target", "alice")
|
systemd: Update to latest NixOS branch
Updated to the latest version of the nixos-v237 branch, which fixes two
things:
* Make sure that systemd looks in /etc for configuration files.
https://github.com/NixOS/systemd/pull/15
* Fix handling of the x-initrd.mount option.
https://github.com/NixOS/systemd/pull/16
I've added NixOS VM tests for both to ensure we won't run into
regressions. The newly added systemd test only tests for that and is by
no means exhaustive, but it's a start.
Personally I only wanted to fix the former issue, because that's the one
I've been debugging. After sending in a pull request for our systemd
fork (https://github.com/NixOS/systemd/pull/17) I got a notice from
@Mic92, that he already fixed this and his fix was even better as it's
even suitable for upstream (so we hopefully can drop that patch
someday).
The reason why the second one came in was simply because it has been
merged before the former, but I thought it would be a good idea to have
tests for that as well.
In addition I've removed the sysconfdir=$out/etc entry to make sure the
default (/etc) is used. Installing is still done to $out, because those
directories that were previously into sysconfdir now get into
factoryconfdir.
Quote from commit NixOS/systemd@98067cc806ae0d2759cdd2334f230cd8548e531:
By default systemd should read all its configuration from /etc.
Therefore we rely on -Dsysconfdir=/etc in meson as default value.
Unfortunately this would also lead to installation of systemd's own
configuration files to `/etc` whereas we are limited to /nix/store. To
counter that this commit introduces two new configuration variables
`factoryconfdir` and `factorypkgconfdir` to install systemd's own
configuration into nix store again, while having executables looking
up files in /etc.
Tested this change against all of the NixOS VM tests we have in
nixos/release.nix. Between this change and its parent no new tests were
failing (although a lot of them were flaky).
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @Mic92, @tk-ecotelecom, @edolstra, @fpletz
Fixes: #35415
Fixes: #35268
2018-03-03 09:10:22 +03:00
|
|
|
|
|
|
|
# Regression test for https://github.com/NixOS/nixpkgs/issues/35415
|
2020-01-22 08:45:01 +03:00
|
|
|
with subtest("configuration files are recognized by systemd"):
|
|
|
|
machine.succeed("test -e /system_conf_read")
|
|
|
|
machine.succeed("test -e /home/alice/user_conf_read")
|
|
|
|
machine.succeed("test -z $(ls -1 /var/log/journal)")
|
systemd: Update to latest NixOS branch
Updated to the latest version of the nixos-v237 branch, which fixes two
things:
* Make sure that systemd looks in /etc for configuration files.
https://github.com/NixOS/systemd/pull/15
* Fix handling of the x-initrd.mount option.
https://github.com/NixOS/systemd/pull/16
I've added NixOS VM tests for both to ensure we won't run into
regressions. The newly added systemd test only tests for that and is by
no means exhaustive, but it's a start.
Personally I only wanted to fix the former issue, because that's the one
I've been debugging. After sending in a pull request for our systemd
fork (https://github.com/NixOS/systemd/pull/17) I got a notice from
@Mic92, that he already fixed this and his fix was even better as it's
even suitable for upstream (so we hopefully can drop that patch
someday).
The reason why the second one came in was simply because it has been
merged before the former, but I thought it would be a good idea to have
tests for that as well.
In addition I've removed the sysconfdir=$out/etc entry to make sure the
default (/etc) is used. Installing is still done to $out, because those
directories that were previously into sysconfdir now get into
factoryconfdir.
Quote from commit NixOS/systemd@98067cc806ae0d2759cdd2334f230cd8548e531:
By default systemd should read all its configuration from /etc.
Therefore we rely on -Dsysconfdir=/etc in meson as default value.
Unfortunately this would also lead to installation of systemd's own
configuration files to `/etc` whereas we are limited to /nix/store. To
counter that this commit introduces two new configuration variables
`factoryconfdir` and `factorypkgconfdir` to install systemd's own
configuration into nix store again, while having executables looking
up files in /etc.
Tested this change against all of the NixOS VM tests we have in
nixos/release.nix. Between this change and its parent no new tests were
failing (although a lot of them were flaky).
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @Mic92, @tk-ecotelecom, @edolstra, @fpletz
Fixes: #35415
Fixes: #35268
2018-03-03 09:10:22 +03:00
|
|
|
|
2018-11-13 19:06:03 +03:00
|
|
|
# Regression test for https://github.com/NixOS/nixpkgs/issues/50273
|
2020-01-22 08:45:01 +03:00
|
|
|
with subtest("DynamicUser actually allocates a user"):
|
|
|
|
assert "iamatest" in machine.succeed(
|
|
|
|
"systemd-run --pty --property=Type=oneshot --property=DynamicUser=yes --property=User=iamatest whoami"
|
|
|
|
)
|
2018-11-13 19:06:03 +03:00
|
|
|
|
systemd: Update to latest NixOS branch
Updated to the latest version of the nixos-v237 branch, which fixes two
things:
* Make sure that systemd looks in /etc for configuration files.
https://github.com/NixOS/systemd/pull/15
* Fix handling of the x-initrd.mount option.
https://github.com/NixOS/systemd/pull/16
I've added NixOS VM tests for both to ensure we won't run into
regressions. The newly added systemd test only tests for that and is by
no means exhaustive, but it's a start.
Personally I only wanted to fix the former issue, because that's the one
I've been debugging. After sending in a pull request for our systemd
fork (https://github.com/NixOS/systemd/pull/17) I got a notice from
@Mic92, that he already fixed this and his fix was even better as it's
even suitable for upstream (so we hopefully can drop that patch
someday).
The reason why the second one came in was simply because it has been
merged before the former, but I thought it would be a good idea to have
tests for that as well.
In addition I've removed the sysconfdir=$out/etc entry to make sure the
default (/etc) is used. Installing is still done to $out, because those
directories that were previously into sysconfdir now get into
factoryconfdir.
Quote from commit NixOS/systemd@98067cc806ae0d2759cdd2334f230cd8548e531:
By default systemd should read all its configuration from /etc.
Therefore we rely on -Dsysconfdir=/etc in meson as default value.
Unfortunately this would also lead to installation of systemd's own
configuration files to `/etc` whereas we are limited to /nix/store. To
counter that this commit introduces two new configuration variables
`factoryconfdir` and `factorypkgconfdir` to install systemd's own
configuration into nix store again, while having executables looking
up files in /etc.
Tested this change against all of the NixOS VM tests we have in
nixos/release.nix. Between this change and its parent no new tests were
failing (although a lot of them were flaky).
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @Mic92, @tk-ecotelecom, @edolstra, @fpletz
Fixes: #35415
Fixes: #35268
2018-03-03 09:10:22 +03:00
|
|
|
# Regression test for https://github.com/NixOS/nixpkgs/issues/35268
|
2020-01-22 08:45:01 +03:00
|
|
|
with subtest("file system with x-initrd.mount is not unmounted"):
|
|
|
|
machine.succeed("mountpoint -q /test-x-initrd-mount")
|
|
|
|
machine.shutdown()
|
2019-07-25 21:50:02 +03:00
|
|
|
|
2020-01-22 08:45:01 +03:00
|
|
|
subprocess.check_call(
|
|
|
|
[
|
|
|
|
"qemu-img",
|
|
|
|
"convert",
|
|
|
|
"-O",
|
|
|
|
"raw",
|
|
|
|
"vm-state-machine/empty0.qcow2",
|
|
|
|
"x-initrd-mount.raw",
|
|
|
|
]
|
|
|
|
)
|
|
|
|
extinfo = subprocess.check_output(
|
|
|
|
[
|
|
|
|
"${pkgs.e2fsprogs}/bin/dumpe2fs",
|
|
|
|
"x-initrd-mount.raw",
|
|
|
|
]
|
|
|
|
).decode("utf-8")
|
|
|
|
assert (
|
|
|
|
re.search(r"^Filesystem state: *clean$", extinfo, re.MULTILINE) is not None
|
|
|
|
), ("File system was not cleanly unmounted: " + extinfo)
|
|
|
|
|
2020-06-21 17:25:50 +03:00
|
|
|
# Regression test for https://github.com/NixOS/nixpkgs/pull/91232
|
|
|
|
with subtest("setting transient hostnames works"):
|
|
|
|
machine.succeed("hostnamectl set-hostname --transient machine-transient")
|
|
|
|
machine.fail("hostnamectl set-hostname machine-all")
|
|
|
|
|
2020-01-22 08:45:01 +03:00
|
|
|
with subtest("systemd-shutdown works"):
|
|
|
|
machine.shutdown()
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
machine.succeed("test -e /tmp/shared/shutdown-test")
|
|
|
|
|
|
|
|
# Test settings from /etc/sysctl.d/50-default.conf are applied
|
|
|
|
with subtest("systemd sysctl settings are applied"):
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
assert "fq_codel" in machine.succeed("sysctl net.core.default_qdisc")
|
|
|
|
|
|
|
|
# Test cgroup accounting is enabled
|
|
|
|
with subtest("systemd cgroup accounting is enabled"):
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
assert "yes" in machine.succeed(
|
|
|
|
"systemctl show testservice1.service -p IOAccounting"
|
|
|
|
)
|
2019-08-18 14:19:01 +03:00
|
|
|
|
2020-01-22 08:45:01 +03:00
|
|
|
retcode, output = machine.execute("systemctl status testservice1.service")
|
|
|
|
assert retcode in [0, 3] # https://bugs.freedesktop.org/show_bug.cgi?id=77507
|
|
|
|
assert "CPU:" in output
|
2020-07-09 04:43:12 +03:00
|
|
|
|
|
|
|
# Test systemd is configured to manage a watchdog
|
|
|
|
with subtest("systemd manages hardware watchdog"):
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
|
|
|
|
# It seems that the device's path doesn't appear in 'systemctl show' so
|
|
|
|
# check it separately.
|
|
|
|
assert "WatchdogDevice=/dev/watchdog" in machine.succeed(
|
|
|
|
"cat /etc/systemd/system.conf"
|
|
|
|
)
|
|
|
|
|
|
|
|
output = machine.succeed("systemctl show | grep Watchdog")
|
2020-08-24 13:40:02 +03:00
|
|
|
# assert "RuntimeWatchdogUSec=30s" in output
|
|
|
|
# for some reason RuntimeWatchdogUSec, doesn't seem to be updated in here.
|
2020-08-13 21:49:43 +03:00
|
|
|
assert "RebootWatchdogUSec=10min" in output
|
|
|
|
assert "KExecWatchdogUSec=5min" in output
|
2020-08-05 02:34:12 +03:00
|
|
|
|
|
|
|
# Test systemd cryptsetup support
|
|
|
|
with subtest("systemd successfully reads /etc/crypttab and unlocks volumes"):
|
|
|
|
# create a luks volume and put a filesystem on it
|
|
|
|
machine.succeed(
|
|
|
|
"echo -n supersecret | cryptsetup luksFormat -q /dev/vdc -",
|
|
|
|
"echo -n supersecret | cryptsetup luksOpen --key-file - /dev/vdc foo",
|
|
|
|
"mkfs.ext3 /dev/mapper/foo",
|
|
|
|
)
|
|
|
|
|
|
|
|
# create a keyfile and /etc/crypttab
|
|
|
|
machine.succeed("echo -n supersecret > /var/lib/luks-keyfile")
|
|
|
|
machine.succeed("chmod 600 /var/lib/luks-keyfile")
|
|
|
|
machine.succeed("echo 'luks1 /dev/vdc /var/lib/luks-keyfile luks' > /etc/crypttab")
|
|
|
|
|
|
|
|
# after a reboot, systemd should unlock the volume and we should be able to mount it
|
|
|
|
machine.shutdown()
|
|
|
|
machine.succeed("systemctl status systemd-cryptsetup@luks1.service")
|
|
|
|
machine.succeed("mkdir -p /tmp/luks1")
|
|
|
|
machine.succeed("mount /dev/mapper/luks1 /tmp/luks1")
|
systemd: Update to latest NixOS branch
Updated to the latest version of the nixos-v237 branch, which fixes two
things:
* Make sure that systemd looks in /etc for configuration files.
https://github.com/NixOS/systemd/pull/15
* Fix handling of the x-initrd.mount option.
https://github.com/NixOS/systemd/pull/16
I've added NixOS VM tests for both to ensure we won't run into
regressions. The newly added systemd test only tests for that and is by
no means exhaustive, but it's a start.
Personally I only wanted to fix the former issue, because that's the one
I've been debugging. After sending in a pull request for our systemd
fork (https://github.com/NixOS/systemd/pull/17) I got a notice from
@Mic92, that he already fixed this and his fix was even better as it's
even suitable for upstream (so we hopefully can drop that patch
someday).
The reason why the second one came in was simply because it has been
merged before the former, but I thought it would be a good idea to have
tests for that as well.
In addition I've removed the sysconfdir=$out/etc entry to make sure the
default (/etc) is used. Installing is still done to $out, because those
directories that were previously into sysconfdir now get into
factoryconfdir.
Quote from commit NixOS/systemd@98067cc806ae0d2759cdd2334f230cd8548e531:
By default systemd should read all its configuration from /etc.
Therefore we rely on -Dsysconfdir=/etc in meson as default value.
Unfortunately this would also lead to installation of systemd's own
configuration files to `/etc` whereas we are limited to /nix/store. To
counter that this commit introduces two new configuration variables
`factoryconfdir` and `factorypkgconfdir` to install systemd's own
configuration into nix store again, while having executables looking
up files in /etc.
Tested this change against all of the NixOS VM tests we have in
nixos/release.nix. Between this change and its parent no new tests were
failing (although a lot of them were flaky).
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @Mic92, @tk-ecotelecom, @edolstra, @fpletz
Fixes: #35415
Fixes: #35268
2018-03-03 09:10:22 +03:00
|
|
|
'';
|
2019-07-25 21:50:02 +03:00
|
|
|
})
|