NixOS Stage 1 is failing to boot with “cannot import ‘zroot’: no such pool available” when attempting to boot from a newly installed nixos (in a qemu VM), but when I boot from the ISO image again I’m able to successfully import the pool:
[nixos@nixos:~]$ sudo zpool import zroot
[nixos@nixos:~]$ sudo zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zroot 126G 6.51G 119G - - 0% 5% 1.00x ONLINE -
[nixos@nixos:~]$ sudo zfs list
NAME USED AVAIL REFER MOUNTPOINT
zroot 6.51G 116G 6.51G /zroot
zroot/alistair 24K 116G 24K /zroot/alistair
zroot/alistaircache 24K 116G 24K /zroot/alistaircache
zroot/home 24K 116G 24K /zroot/home
Disko and grub definition:
{ config, pkgs, ... }:
{
imports =
[ ./nixosvm-hardware-configuration.nix
"${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix"
./nixosvm-disko.nix
];
boot.initrd.supportedFilesystems = [ "zfs" ];
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.enableUnstable = true;
services.zfs.autoScrub.enable = true;
boot.loader.systemd-boot.enable = false;
boot.loader.grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
devices = [ "nodev" ];
};
...
nixosvm-disko.nix (adapted from https://github.com/nix-community/disko/blob/98ab91109716871f50ea8cb0e0ac7cc1e1e14714/example/zfs.nix):
{ disks ? [ "/dev/vda" ], swapsize ? "2GB", ... }:
{
disko.devices = {
disk = {
vda = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
};
zpool = {
zroot = {
type = "zpool";
rootFsOptions = {
compression = "zstd";
"com.sun:auto-snapshot" = "false";
};
mountpoint = "/";
datasets = {
home = {
type = "zfs_fs";
mountpoint = "/home";
};
alistair = {
type = "zfs_fs";
mountpoint = "/home/alistair";
};
alistaircache = {
type = "zfs_fs";
mountpoint = "/home/alistair/.cache";
};
};
};
};
};
}
This is in a flake with nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"
.
I’ve tried about 20 variations (systemd vs. grub, generate the hardware config directly, efiInstallAsRemovable=false, etc.) without success.
Thanks in advance for any suggestions,
Alistair