Failed to mount ZFS root after update to 25.11

I’ve been running NixOS with encrypted ZFS on this Laptop for a while now without issues. I tried updating to NixOS 25.11 today, and booting from my ZFS root now seems to fail. I am still asked for the passphrase and after entering it, I get the following error:

filesystem 'rpool/nixos/root' cannot be mounted using 'mount'.
Use 'zfs set mountpoint=legacy' or 'zfs mount rpool/nixos/root'.
See zfs(8) for more information.

It looks less like an actual issue with ZFS and possibly more like using the wrong tool for doing the mount?

My NixOS configuration is here: https://github.com/polygon/dotfiles

The most relevant files for this machine (nixbrett) should in this folder: https://github.com/polygon/dotfiles/tree/master/systems/nixbrett

The ZPOOL was created like so:

2025-11-03.16:26:12 zpool create -o ashift=12 -o autotrim=on -R /mnt -O acltype=posixacl -O canmount=off -O compression=zstd -O dnodesize=auto -O normalization=formD -O relatime=on -O xattr=sa -O mountpoint=/ -f rpool /dev/disk/by-id/nvme-SAMSUNG_MZVLC2T0HBLD-00BLL_S7SFNF0Y713564-part2
2025-11-03.16:26:40 zfs create -o canmount=off -o mountpoint=none -o encryption=on -o keylocation=prompt -o keyformat=passphrase rpool/nixos
2025-11-03.16:26:47 zfs create -o canmount=on -o mountpoint=/ rpool/nixos/root
2025-11-03.16:26:51 zfs create -o canmount=on -o mountpoint=/home rpool/nixos/home
2025-11-03.16:26:59 zfs create -o canmount=off -o mountpoint=/var rpool/nixos/var
2025-11-03.16:27:04 zfs create -o canmount=on rpool/nixos/var/lib
2025-11-03.16:27:12 zfs create -o canmount=on rpool/nixos/var/log
2025-11-03.16:27:26 zfs create -o canmount=off -o mountpoint=/nix rpool/nixos/nix
2025-11-03.16:27:31 zfs create -o canmount=on rpool/nixos/nix/store

I’ve been running a similar configuration for years on a previous Laptop and it’s quite surprising that it falls apart now. Anyone knows what might be wrong here?

Looks like you need to run zfs set mountpoint=legacy for the / dataset. I don’t know what changed, but you shouldn’t have NixOS (your filesystems config) and the zfs systemd services (which are looking at canmount and mountpoint properties) both trying to mount root.

That’s right. You can (and I do) have non-legacy mountpoints for your root dataset and stuff, but the ones that need to be mounted by initrd (these ones https://github.com/NixOS/nixpkgs/blob/f61125a668a320878494449750330ca58b78c557/nixos/lib/utils.nix#L56-L67) need to be in your fileSystems config with the zfsutil option, and none of the other non-legacy ones should be. The reason to do this is just so that you can do zfs create pool/root/subdir to create mounted child datasets without hassle and without regenerating hardware-configuration.nix. But it does require knowing these things, whereas mountpoint=legacy for everything keeps it nice and simple.

1 Like

Thank you, adding zfsutil to all of the mountpoints in my config did the trick.

Changing the mountpoint to legacy would have probably also worked. But I was more comfortable changing something exclusively in the NixOS config than modifying my filesystem properties. The former I can rollback by booting an older generation, the latter might need a trip to rescue system country.