From 865723cd53a5f8758e00d09dab76b636c2460976 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 2 Jan 2023 21:35:35 +0100 Subject: [PATCH] Revert "nixos/stage-1: fix `modprobe` in initial ramdisk on systems w/glibc-2.34" This reverts commit da905d4cf918e28f924bab99c6f2a4012d55410d. See the commit linked above for further information on why this was needed. Apparently this is not needed anymore because the need for LD_LIBRARY_PATH (which is needed for `modprobe(8)` to find `libpthread.so.0`) doesn't exist anymore. Since d33e52b2539c5b36a5a876df9006a7145efd42ea the library path of each binary in extra-utils is patched correctly. --- nixos/modules/system/boot/stage-1-init.sh | 3 +-- nixos/modules/system/boot/stage-1.nix | 20 -------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh index 4596c160a957..0158c6ef31f3 100644 --- a/nixos/modules/system/boot/stage-1-init.sh +++ b/nixos/modules/system/boot/stage-1-init.sh @@ -234,8 +234,7 @@ done mkdir -p /lib ln -s @modulesClosure@/lib/modules /lib/modules ln -s @modulesClosure@/lib/firmware /lib/firmware -# see comment in stage-1.nix for explanation -echo @extraUtils@/bin/modprobe-kernel > /proc/sys/kernel/modprobe +echo @extraUtils@/bin/modprobe > /proc/sys/kernel/modprobe for i in @kernelModules@; do info "loading module $(basename $i)..." modprobe $i diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 95dcdfd7fbe1..33a7be0b6896 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -150,26 +150,6 @@ let copy_bin_and_libs ${pkgs.kmod}/bin/kmod ln -sf kmod $out/bin/modprobe - # Dirty hack to make sure the kernel properly loads modules - # such as ext4 on demand (e.g. on a `mount(2)` syscall). This is necessary - # because `kmod` isn't linked against `libpthread.so.0` anymore (since - # it was merged into `libc.so.6` since version `2.34`), but still needs - # to access it for some reason. This is not an issue in stage-1 itself - # because of the `LD_LIBRARY_PATH`-variable and anytime later because the rpath of - # kmod/modprobe points to glibc's `$out/lib` where `libpthread.so.6` exists. - # However, this is a problem when the kernel calls `modprobe` inside - # the initial ramdisk because it doesn't know about the - # `LD_LIBRARY_PATH` and the rpath was nuked. - # - # Also, we can't use `makeWrapper` here because `kmod` only does - # `modprobe` functionality if `argv[0] == "modprobe"`. - cat >$out/bin/modprobe-kernel <