From b4b4751e97ec09e0e7a6c055b700d94969e198f0 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Mon, 15 Jul 2024 05:03:29 -0400 Subject: [PATCH] systemd-stage-1: Use common bin for /sbin util-linux's mount command was only looking in /sbin for mount helpers, which wasn't working. --- nixos/modules/system/boot/systemd/initrd.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix index 6107a2594baf..3c8df8b153d4 100644 --- a/nixos/modules/system/boot/systemd/initrd.nix +++ b/nixos/modules/system/boot/systemd/initrd.nix @@ -102,7 +102,7 @@ let initrdBinEnv = pkgs.buildEnv { name = "initrd-bin-env"; paths = map getBin cfg.initrdBin; - pathsToLink = ["/bin" "/sbin"]; + pathsToLink = ["/bin"]; postBuild = concatStringsSep "\n" (mapAttrsToList (n: v: "ln -sf '${v}' $out/bin/'${n}'") cfg.extraBin); }; @@ -407,7 +407,7 @@ in { fsck = "${cfg.package.util-linux}/bin/fsck"; }; - managerEnvironment.PATH = "/bin:/sbin"; + managerEnvironment.PATH = "/bin"; contents = { "/tmp/.keep".text = "systemd requires the /tmp mount point in the initrd cpio archive"; @@ -416,7 +416,7 @@ in { "/etc/systemd/system.conf".text = '' [Manager] - DefaultEnvironment=PATH=/bin:/sbin + DefaultEnvironment=PATH=/bin ${cfg.extraConfig} ManagerEnvironment=${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "${n}=${lib.escapeShellArg v}") cfg.managerEnvironment)} ''; @@ -431,9 +431,9 @@ in { "/etc/shadow".text = "root:${if isBool cfg.emergencyAccess then optionalString (!cfg.emergencyAccess) "*" else cfg.emergencyAccess}:::::::"; "/bin".source = "${initrdBinEnv}/bin"; - "/sbin".source = "${initrdBinEnv}/sbin"; + "/sbin".source = "${initrdBinEnv}/bin"; - "/etc/sysctl.d/nixos.conf".text = "kernel.modprobe = /sbin/modprobe"; + "/etc/sysctl.d/nixos.conf".text = "kernel.modprobe = /bin/modprobe"; "/etc/modprobe.d/systemd.conf".source = "${cfg.package}/lib/modprobe.d/systemd.conf"; "/etc/modprobe.d/ubuntu.conf".source = pkgs.runCommand "initrd-kmod-blacklist-ubuntu" { } '' ${pkgs.buildPackages.perl}/bin/perl -0pe 's/## file: iwlwifi.conf(.+?)##/##/s;' $src > $out