NixOS LUKS encryption using a YubiKey

The error message is too generic to know where the problem lies. If initrd thinks the root disk is /dev/sdb and there is no /dev/sdb, this error would likely present, so the error message doesn’t provide any details specific to where the failure lies. E.g. Is initrd looking for a missing disk? Is initrd able to find the YubiKey? Can it talk to the YubiKey? Did initrd access the correct YubiKey slot? Etc.

Provide a detailed write up of the process you followed with secrets redacted. Then we could compare what you did with the two references you provided and get an idea of any steps you missed. Or sgillespie, or someone else with working LUKS + YubiKey, could better identify where your configuration went wrong if this catches their attention.

At first glance, I figured you might be missing the modules necessary for the initrd to find/talk with the YubiKey. Both references include the same kernel modules.

The config setting for boot.initrd.luks.cryptoModules appears to be absent from the github tutorial. You mention the Wiki [1], which the github tutorial is based on, so I presume you noticed the slight, and compensated, but I’m just guessing in the dark at this point with so little info to work with.

Cheers.

[1]: Yubikey based Full Disk Encryption (FDE) on NixOS - NixOS Wiki