I am having trouble migrating my ZFS rollback postResumeCommands to the new initrd systemd service.
My service errors with
cannot open 'zroot/root@empty': dataset does not exist
I don’t get prompted for a password.
I have a luks device full disk encrypted with password prompt.
On that I have zfs datasets.
When I disable the zfs-rollback initrd service, I can boot (without rollback of course).
I have the following config:
boot.initrd.luks.devices.luks.device = "/dev/disk/by-label/luks";
boot.initrd.supportedFilesystems = [ "zfs" ];
boot.initrd.systemd.services.zfs-rollback = {
unitConfig.DefaultDependencies = false;
serviceConfig = {
Type = "oneshot";
StandardOutput = "journal+console";
StandardError = "journal+console";
};
requiredBy = [ "initrd.target" ];
before = [ "sysroot.mount" ];
requires = [ "initrd-root-device.target" ];
after = [ "initrd-root-device.target" ];
script = "zfs rollback -r zroot/root@empty";
};
fileSystems = {
"/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
};
"/" = {
device = "zroot/root";
fsType = "zfs";
neededForBoot = true;
};
"/keep" = {
device = "zroot/keep";
fsType = "zfs";
neededForBoot = true;
};
"/nix" = {
device = "zroot/nix";
fsType = "zfs";
neededForBoot = true;
};
};
I am guessing there is some timing issue, where the disk unlock happens too late, but I am not sure how to debug this.