From e741e983460195b9e3815a2d24c95c4cd4d16666 Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Thu, 11 Jun 2026 09:55:27 -0700 Subject: [PATCH] vmTools: point in-VM module loading at kernelModules too The previous commit split the module tree out of `kernel` into a new `kernelModules` argument, but only updated the initrd modules closure. Two other places still referenced `kernel` for modules: * `MODULE_DIR` in stage2Init, which backs both the kernel automatic module loader (/proc/sys/kernel/modprobe) and any explicit modprobe run inside the VM; * the `/lib` symlinks in extractFs and extractMTDfs. Before the split these pointed at the aggregated tree whenever callers overrode `kernel` with one, so e.g. `modprobe zfs` inside the VM found the out-of-tree module. Verified by running modprobe of a module present only in `kernelModules` inside runInLinuxVM: it fails with "FATAL: Module zfs not found" before this change and succeeds after. Assisted-by: Claude Code (claude-fable-5) --- pkgs/build-support/vm/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index ad2e50b1a7b7..b508dba83f33 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -235,7 +235,7 @@ let fi # Set up automatic kernel module loading. - export MODULE_DIR=${lib.getOutput "modules" kernel}/lib/modules/ + export MODULE_DIR=${lib.getOutput "modules" kernelModules}/lib/modules/ ${coreutils}/bin/cat < /run/modprobe #! ${bash}/bin/sh export MODULE_DIR=$MODULE_DIR @@ -432,7 +432,7 @@ let name = "extract-file"; buildInputs = [ util-linux ]; buildCommand = '' - ln -s ${kernel}/lib /lib + ln -s ${kernelModules}/lib /lib ${kmod}/bin/modprobe loop ${kmod}/bin/modprobe ext4 ${kmod}/bin/modprobe hfs @@ -464,7 +464,7 @@ let mtdutils ]; buildCommand = '' - ln -s ${kernel}/lib /lib + ln -s ${kernelModules}/lib /lib ${kmod}/bin/modprobe mtd ${kmod}/bin/modprobe mtdram total_size=131072 ${kmod}/bin/modprobe mtdchar