nixos/plymouth: Fix emergency / rescue mode. (#439447)

Changed files
+23 -2
nixos
modules
system
+23 -2
nixos/modules/system/boot/plymouth.nix
···
exit 1
fi
'';
+
+
# 'emergency.serivce' and 'rescue.service' have
+
# 'ExecStartPre=-plymouth quit --wait', but 'plymouth' is not on
+
# their 'ExecSearchPath'. We could set 'ExecSearchPath', but it
+
# overrides 'DefaultEnvironment=PATH=...', which is trouble for the
+
# initrd shell. It's simpler to just reset 'ExecStartPre' with an
+
# empty string and then set it to exactly what we want.
+
preStartQuitFixup = {
+
serviceConfig.ExecStartPre = [
+
""
+
"${plymouth}/bin/plymouth quit --wait"
+
];
+
};
+
in
{
···
systemd.services.plymouth-poweroff.wantedBy = [ "poweroff.target" ];
systemd.services.plymouth-reboot.wantedBy = [ "reboot.target" ];
systemd.services.plymouth-read-write.wantedBy = [ "sysinit.target" ];
-
systemd.services.systemd-ask-password-plymouth.wantedBy = [ "multi-user.target" ];
-
systemd.paths.systemd-ask-password-plymouth.wantedBy = [ "multi-user.target" ];
+
systemd.services.systemd-ask-password-plymouth.wantedBy = [ "sysinit.target" ];
+
systemd.paths.systemd-ask-password-plymouth.wantedBy = [ "sysinit.target" ];
# Prevent Plymouth taking over the screen during system updates.
systemd.services.plymouth-start.restartIfChanged = false;
+
systemd.services.rescue = preStartQuitFixup;
+
systemd.services.emergency = preStartQuitFixup;
+
boot.initrd.systemd = {
extraBin.plymouth = "${plymouth}/bin/plymouth"; # for the recovery shell
storePaths = [
···
"${plymouth}/sbin/plymouthd"
];
packages = [ plymouth ]; # systemd units
+
+
services.rescue = preStartQuitFixup;
+
services.emergency = preStartQuitFixup;
+
contents = {
# Files
"/etc/plymouth/plymouthd.conf".source = configFile;