diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index 9bcbe291aad..3f34a1ae6a5 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -365,6 +365,6 @@ mount --move /sys $targetRoot/sys mount --move /dev $targetRoot/dev mount --move /run $targetRoot/run -exec switch_root "$targetRoot" "$stage2Init" +exec env -i $(type -P switch_root) "$targetRoot" "$stage2Init" fail # should never be reached diff --git a/modules/system/boot/systemd.nix b/modules/system/boot/systemd.nix index d3340988092..4024838555d 100644 --- a/modules/system/boot/systemd.nix +++ b/modules/system/boot/systemd.nix @@ -224,6 +224,7 @@ let [Service] Environment=PATH=${def.path} + Environment=LD_LIBRARY_PATH= ${let env = cfg.globalEnvironment // def.environment; in concatMapStrings (n: "Environment=${n}=${getAttr n env}\n") (attrNames env)} ${optionalString (!def.restartIfChanged) "X-RestartIfChanged=false"}