Installation with disk encryption

Hello community!

I’m trying to install NixOS again and when I put encryption on the disk it asks for the password and success appears and to decrypt the error saying “r” Reboot or shutdown. and when it restarts it reports kernel panic. NixOS was already installed here and I had to format it.

I’ve seen this behavior too, no idea what the actual issue is. After 22.11 I had a lot of weird encryption issues, and ever since I “fixed” that the drive that was still working has been doing what you describe.

I.e., if I mistype my passphrase:

  1. Prompt for passphrase
  2. Mistype passphrase in response
  3. Succeed (despite wrong passphrase)!
  4. Pass key to other disk
  5. Fail (even though they’re supposed to match)
  6. Prompt for passphrase
  7. Type in right passphrase this time
  8. Succeed!
  9. Start trying to boot
  10. Try really hard to open root disk with the wrong key
  11. Fail to unlock root disk
  12. Rescue shell/reboot prompt/panic depending on config

I think the root cause of this is related to whatever borked my encryption after 22.11, but I failed to debug it back then. The cryptsetup ML may be able to help, but there are some NixOS scripts mixed in so you would first need to isolate the issue, which is… nontrivial.

I suspect a reencrypt would fix it, too, but I have not yet bothered to do so, since it appears harmless, and I don’t want to spend 6 hours burning my drive.

As long as I type the right passphrase initially it works fine. Cryptsetup has some bizarre behaviors.