make-disk-image: Fix overriding kernel modules - #1277
Conversation
After [#530764](NixOS/nixpkgs#530764) PR kernel modules should be passed as `kernelModules` instead of `kernel`. Fixes error: ``` … while evaluating definitions from `/nix/store/1c1jbpjisa2249vrffd97vmjdflbcprx-source/lib/make-disk-image.nix': (stack trace truncated; use '--show-trace' to show the full, detailed trace) error: vmTools: the `kernel` argument (kernel-modules) has no `target` attribute, so the kernel image filename cannot be determined. If you are passing a module tree (e.g. from `pkgs.aggregateModules`) to make extra modules available, pass it via `kernelModules` instead and keep `kernel` pointing at a real kernel derivation. Alternatively, pass `kernelImage` explicitly with the path of the bootable image relative to the `kernel` derivation output (e.g. "bzImage" or "Image"). ``` This should also fixes tests in [nix-community#1273](nix-community#1273) PR
Co-authored-by: Diffumist <git@diffumist.me>
|
After applying this patch the virtual machine hangs in stage-1 script (from initrd) at kernel module loading, on my machine. In my own scripts I see "loading kernel modules..." printed on the console. That text is not visible in the test output. I'm stuck on this, can't seem to figure out what is going wrong. Reproduction The commit hash is from nixos-unstable (2026-07-19) Logs from test make-disk-imageLogs from my own (similar) host configuration |
Could you provide the configuration or script that reproduces it? I can't reproduce this here. |
|
My dev-stack is windows + hyper-v + nested virtualisation. Below the relevant log output, it explicitly mentions falling back to TCG backend instead of KVM. The command finished and produced a main.raw file successfully. |
Adds modules/hosts/test-vm.nix, a throwaway host for smoke-testing the k3s/system-containerd/zfs-snapshotter wiring via `nix build .#nixosConfigurations.test-vm.config.system.build.vmWithDisko` without needing real hardware. Booting it surfaced two real bugs: - disko's lib/make-disk-image.nix passes an aggregated kernel-modules tree as vmTools' `kernel` arg, which broke against a nixpkgs vmTools API change (kernel/kernelModules split). Pin disko to nix-community/disko#1277 (unmerged fix) until it lands upstream. - k3s-containerd.nix's cni.bin_dir override was right, but dropping the transfer plugin's unpack_config as "redundant" wasn't: `ctr images pull --snapshotter zfs` failed with "no unpack platforms defined" without an explicit entry — the CRI snapshotter default doesn't extend to the transfer plugin's unpacker. Restored it. Also makes zfs-disk-single.nix's boot.zfs.* settings mkDefault (disko's vmVariantWithDisko needs to override devNodes/forceImportAll for qemu, where /dev/disk/by-id is empty) and re-states persist/cache neededForBoot under virtualisation.fileSystems, since vmWithDisko rebuilds fileSystems from scratch and doesn't inherit the host-level overrides. Verified live: booted test-vm, confirmed containerd.service active on the right socket, both local/containerd(/snapshotter) zfs datasets mount correctly, a zfs-snapshotter image pull succeeds, and k3s registers a Node object reporting containerd://2.3.1 as its runtime (NotReady is expected — no CNI in this isolated VM, Cilium ships via GitOps). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
After #530764 PR kernel modules should be passed as
kernelModulesinstead ofkernel.Fixes error:
This should also fixes tests in #1273 PR