nixos/filesystem: remove mount-pstore
Ever since fb49d81b2541bd06fbaef6f516906381e7356947 we set CONFIG_PSTORE=y in the config because we set CONIFG_ACPI_APEI=y in the kernel. This means we always have pstore built right into the kernel. systemd thus always mounts `/sys/fs/pstore` which makes our custom unit superfluous and redudant.
This commit is contained in:
parent
d409606c43
commit
e9c71d971f
@ -509,45 +509,6 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services = {
|
||||
# Mount /sys/fs/pstore for evacuating panic logs and crashdumps from persistent storage onto the disk using systemd-pstore.
|
||||
# This cannot be done with the other special filesystems because the pstore module (which creates the mount point) is not loaded then.
|
||||
"mount-pstore" = {
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
# skip on kernels without the pstore module
|
||||
ExecCondition = "${pkgs.kmod}/bin/modprobe -b pstore";
|
||||
ExecStart = pkgs.writeShellScript "mount-pstore.sh" ''
|
||||
set -eu
|
||||
# if the pstore module is builtin it will have mounted the persistent store automatically. it may also be already mounted for other reasons.
|
||||
${pkgs.util-linux}/bin/mountpoint -q /sys/fs/pstore || ${pkgs.util-linux}/bin/mount -t pstore -o nosuid,noexec,nodev pstore /sys/fs/pstore
|
||||
# wait up to 1.5 seconds for the backend to be registered and the files to appear. a systemd path unit cannot detect this happening; and succeeding after a restart would not start dependent units.
|
||||
TRIES=15
|
||||
while [ "$(cat /sys/module/pstore/parameters/backend)" = "(null)" ]; do
|
||||
if (( $TRIES )); then
|
||||
sleep 0.1
|
||||
TRIES=$((TRIES-1))
|
||||
else
|
||||
echo "Persistent Storage backend was not registered in time." >&2
|
||||
break
|
||||
fi
|
||||
done
|
||||
'';
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
unitConfig = {
|
||||
ConditionVirtualization = "!container";
|
||||
DefaultDependencies = false; # needed to prevent a cycle
|
||||
};
|
||||
before = [
|
||||
"systemd-pstore.service"
|
||||
"shutdown.target"
|
||||
];
|
||||
conflicts = [ "shutdown.target" ];
|
||||
wantedBy = [ "systemd-pstore.service" ];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /run/keys 0750 root ${toString config.ids.gids.keys}"
|
||||
"z /run/keys 0750 root ${toString config.ids.gids.keys}"
|
||||
|
@ -1437,6 +1437,7 @@ in
|
||||
systemd-nspawn-configfile = runTest ./systemd-nspawn-configfile.nix;
|
||||
systemd-oomd = runTest ./systemd-oomd.nix;
|
||||
systemd-portabled = runTest ./systemd-portabled.nix;
|
||||
systemd-pstore = runTest ./systemd-pstore.nix;
|
||||
systemd-repart = handleTest ./systemd-repart.nix { };
|
||||
systemd-resolved = runTest ./systemd-resolved.nix;
|
||||
systemd-ssh-proxy = runTest ./systemd-ssh-proxy.nix;
|
||||
|
14
nixos/tests/systemd-pstore.nix
Normal file
14
nixos/tests/systemd-pstore.nix
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
name = "systemd-pstore";
|
||||
|
||||
nodes.machine = { };
|
||||
|
||||
testScript = ''
|
||||
with subtest("pstore API fs is mounted"):
|
||||
machine.succeed("stat /sys/fs/pstore")
|
||||
|
||||
with subtest("systemd-pstore.service doesn't run because nothing crashed"):
|
||||
output = machine.execute("systemctl status systemd-pstore.service", check_return=False)[1]
|
||||
t.assertIn("condition unmet", output)
|
||||
'';
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user