NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.22k stars 14.21k forks source link

Cannot boot with LVM + LUKS #33565

Open jluttine opened 6 years ago

jluttine commented 6 years ago

Issue description

I have a few disks on my computer and one of them has an LVM partition with one volume group containing one logical volume. This logical volume is LUKS encrypted containing ext4 file system. My other disks/partitions are LUKS (except /boot is not encrypted).

When I'm booting, I can enter passphrases to all my other LUKS partitions but the one inside LVM doesn't work

Here is a photo of the boot failure (note: labels are a bit different than in my below example): https://matrix.org/_matrix/media/v1/download/matrix.org/JxNhHxGnRZenwUTWsTSqMovI

Steps to reproduce

Maybe I should create steps for some virtual machine? Not sure how to do it. I'll provide rough sketch what I did:

Then I mounted all file systems to correct locations, ran automatic hardware configuration and installed NixOS. When booting to my system, I got the error: /dev/vg-nixos/lv-nixos doesn't exist or access denied. It just times out.

Any ideas what is wrong?

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the results.

I'm not currently able to boot to my system. I can provide this information somehow if necessary.

jluttine commented 6 years ago

Looking at the photo, it looks like device mapper and LVM are started after asking for passphrases, whereas I would need LVM before asking for passphrases. Could this be the reason? Any idea how to fix?

jluttine commented 6 years ago

Could this be somehow related: https://github.com/NixOS/nixpkgs/blob/fb2e3e9d5ef5068b1c90e4d24f81fe1701f27ef9/nixos/modules/system/boot/stage-1-init.sh#L188

jluttine commented 6 years ago

Yey, setting preLVM = false to that LUKS device fixed the issue!

https://github.com/NixOS/nixpkgs/blob/fb2e3e9d5ef5068b1c90e4d24f81fe1701f27ef9/nixos/modules/system/boot/luksroot.nix#L315

However,

aexoxea commented 6 years ago

I'm worried about the comment # FIXME: get rid of this option.. Indeed, I needed this option so I hope it won't be removed.

As do I; indeed, I found this issue when working out how to do a LUKS-on-LVM setup. I also found #24289; while I'm not experiencing that issue (and it's not directly related to this), it does demonstrate there are at least a few users out there with this need.

Hopefully, the intent of the FIXME was that the correct order to boot would be recognised automatically without the need for that option. If not, then I wanted to second your comment, as there's no reason I can think of to stop allowing LUKS-on-LVM setups, and I wouldn't want to be left with a choice between a bootable system and an update-able one.

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
jluttine commented 4 years ago

Still important to me.

aexoxea commented 3 years ago

Still important to me as well. I'll defer to @jluttine's view as to when it's appropriate to close (since they raised it), but their points in comment #355821839 above seem reasonable.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info