Package ‘zfs-kernel-2.0.6-5.15.2’ in ... is marked as broken, refusing to evaluate

Edit: I just realized that kernelPackages = pkgs.linuxPackages_5_14; is available, and using that in my config instead of pkgs.linuxPackages or pkgs.linuxPackages_latest solves the problem for now. Hopefully 5.14 isn’t EoL’d until a ZFS version compatible with linuxPackages_latest makes into Nixpkgs.


Looks like it’s that time in the release cycle when ZFS builds temporarily fail to build. Based on last time I expect this will resolve itself soon. Just recording here for posterity, and perhaps discussion on ways of preventing this temporary breakage.

$> nixos-rebuild -v --show-trace dry-build
...
evaluating file '/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/security/wrappers/wrapper.nix'
evaluating file '/nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/os-specific/linux/kmod/aggregator.nix'
error: while evaluating the attribute 'buildCommand' of the derivation 'nixos-system-z11pa-d8-21.05.4116.46251a79f75' at /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating 'optionalString' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/strings.nix:202:5, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:36:9:
while evaluating the attribute 'passAsFile' of the derivation 'kernel-modules' at /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'passAsFile' at /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/build-support/buildenv/default.nix:77:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:358:14, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:570:27:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:559:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:559:12:
while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:349:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:559:22:
while evaluating the attribute 'handled' at /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/stdenv/generic/check-meta.nix:302:7:
while evaluating 'handleEvalIssue' at /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/stdenv/generic/check-meta.nix:188:38, called from /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/stdenv/generic/check-meta.nix:303:14:
Package ‘zfs-kernel-2.0.6-5.15.2’ in /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/os-specific/linux/zfs/default.nix:175 is marked as broken, refusing to evaluate.

a) To temporarily allow broken packages, you can use an environment variable
   for a single invocation of the nix tools.

     $ export NIXPKGS_ALLOW_BROKEN=1

b) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

$> 

Relevant configuration.nix settings:


  boot = {
    kernelPackages = pkgs.linuxPackages_latest;  
    supportedFilesystems = [ "vfat" "zfs" ];
    initrd = {
      network.ssh.enable = true;
      supportedFilesystems = [ "vfat" "zfs" ];
    };
    zfs = {
      requestEncryptionCredentials =
        true;  
    };
    loader = {
      systemd-boot.enable = true;
      efi = {
        canTouchEfiVariables =
          true; # required for mirroredBoots;  must be disabled if efiInstallAsRemovable=true
        efiSysMountPoint =
          "/boot1"; # /boot is default for single-drive boot config, /boot1 or /boot2 for mirrored boots
      };
      grub = {
        version = 2;
        enable = true;
        device = "nodev"; # "/dev/sdx", or "nodev" for efi only
        efiSupport = true;
        zfsSupport = true;
        copyKernels = true; # https://nixos.wiki/wiki/NixOS_on_ZFS
        mirroredBoots = [
          {
            devices = [ "nodev" ];
            path = "/boot1";
          }
          {
            devices = [ "nodev" ];
            path = "/boot2";
          }
        ];
      };
    };
  };

Current versions:

$> zfs version
zfs-2.0.6-1
zfs-kmod-2.0.6-1

$> uname -a
Linux z11pa-d8 5.14.16 #1-NixOS SMP Tue Nov 2 18:51:02 UTC 2021 x86_64 GNU/Linux

It’s not really preventable for linuxPackages_latest. ZFS purposefully advertises which kernel versions it supports in a given release. When the latest release of ZFS doesn’t support the latest linux kernel, there’s nothing for NixOS to do. If you want to prevent it, use the stable kernel.

Thanks, I just realized that kernelPackages = pkgs.linuxPackages_5_14; is available. That solves the problem for now, and I suppose will continue to until the Linux Foundation EoL’s 5.14.

Mainly I just didn’t want to have to revert from a working linux 5.14 + ZFS 2.0.6 config, to a 5.10 config, as using the stable kernel would do.

I recently learned about this one: zfs.latestCompatibleLinuxPackages

Thanks, I’ve tried several variations of that but they all appear broken:

kernelPackages = config.zfs.package.latestCompatibleLinuxPackages;
kernelPackages = config.zfs.pkgs.latestCompatibleLinuxPackages;
kernelPackages = zfs.package.latestCompatibleLinuxPackages;
kernelPackages = zfs.pkgs.latestCompatibleLinuxPackages;
kernelPackages = zfs.latestCompatibleLinuxPackages;

They all return an error “attribute zfs is missing”, “undefined variable ‘zfs’”, or similar.

Should be pkgs.zfs.latestCompatibleEtc as it is a packageset. Not an option.

(From upcoming 21.11 release notes):

  • Zfs: latestCompatibleLinuxPackages is now exported on the zfs package. One can use boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; to always track the latest compatible kernel with a given version of zfs.
2 Likes

(From upcoming 21.11 release notes):

Great news, thanks!

1 Like

Oh, that would be a nice thing for the nvidia drivers too. Maybe I should open an issue :slight_smile:

3 Likes