Changing kernel: The kernel module and the userspace tooling versions are not matching

I want to try an older version of the kernel (6.12.34 instead of 6.12.60), so I added in my flake:

boot.kernelPackages = inputs.nixpkgsKernelThatWorked.legacyPackages.${pkgs.system}.linuxPackages_6_12;

but when I compile, I get an error:

The kernel module and the userspace tooling versions are not matching, this is an unsupported usecase.

or more precisely:

┏━ 1 Errors: 
┃ error:
┃        … while calling the 'head' builtin
┃          at /nix/store/hv1dx0bah4m1mw2asfrg29wl17by9ngd-source/lib/attrsets.nix:1696:13:
┃          1695|           if length values == 1 || pred here (elemAt values 1) (head values) then
┃          1696|             head values
┃              |             ^
┃          1697|           else
┃ 
┃        … while evaluating the attribute 'value'
┃          at /nix/store/hv1dx0bah4m1mw2asfrg29wl17by9ngd-source/lib/modules.nix:1118:7:
┃          1117|     // {
┃          1118|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
┃              |       ^
┃          1119|       inherit (res.defsFinal') highestPrio;
┃ 
┃        … while evaluating the option `system.build.toplevel':
┃ 
┃        … while evaluating definitions from `/nix/store/hv1dx0bah4m1mw2asfrg29wl17by9ngd-source/nixos/modules/system/activation/top-level.nix':
┃ 
┃        (stack trace truncated; use '--show-trace' to show the full, detailed trace)
┃ 
┃        error:
┃        Failed assertions:
┃        - The kernel module and the userspace tooling versions are not matching, this is an unsupported usecase.
┣━━━                                                            
┗━ ∑ ⚠ Exited with 1 errors reported by nix at 19:24:44 after 2s

I suspect ZFS to be the userspace tool that produces this version mismatch, but I don’t know how to fix this. Any ideas?

EDIT

I tried this (unfree needed as I use nvidia… even if I have open = true):

  # I get issues with latest kernels with nvidia, let's used one that used to work
  boot.kernelPackages = (import inputs.nixpkgsKernelThatWorked {
    inherit system; config = {allowUnfree = true;};}
  ).linuxPackages_6_12;
  boot.zfs.package = (import inputs.nixpkgsKernelThatWorked {
    inherit system; config = {allowUnfree = true;};}
  ).zfs;

and it seems to work so far (at least it compiles…). Is it the recommanded solution? How am I supposed to match the versions here between zfs and linuxPackages (I think here I’m just lucky that they match since this is the default kernel in this nixpkgs)?

1 Like

Any reference to kernels should always be based off config.boot.kernelPackages. I assume you have a bad value in boot.zfs.package or boot.zfs.modulePackage, currently.

1 Like