Hello, I’ve been facing a problem after updating to the latest 22.05 version of NixOS.
Upon booting the system, it hangs when starting a job for /dev/System/lv_home (which is my home LVM partition). Then it drops into an emergency shell. If I run vgchange -ay and continue the boot process, it works just fine. I tried to add this command to boot.initrd.preDeviceCommands or boot.initrd.preLVMCommands without success.
This LVM configuration worked fine on 21.11.
Do you have any ideas about what could cause this?
I don’t have any LUKS encryption and my hardware-configuration.nix file contains :
The only setting that is not encryption related (I believe ?) is canTouchEFIVariables which I don’t think relates to that but I’ll try putting it to false anyway and give it a try.
/home would be mounted in stage 2, not in initrd, so it makes sense that boot.initrd.preDeviceCommands = "vgchange -ay"; wouldn’t do anything. Without anything other than LVM to speak of though, I’m not sure what could be going wrong…
I found this lvm call in stage-1-init.sh, but I don’t know if it’s not working or not supposed to be triggered for waiting for LVM disks, given the output in the script, we never enter into the code running lvm vgchange -ay…
Would you mind opening an issue on nixpkgs? If LVM is really broken in 22.05 that’s not fun
I don’t think that’s the same issue. @sda’s problem is with /home, which isn’t mounted until well after initrd is done with. So the issue lies in the LVM support in stage 2. So boot.initrd.preLVMCommands would have no effect. Plus, look here. By adding boot.initrd.preLVMCommands = "lvm vgchange -ay";, you’re literally just causing it to run lvm vgchange -ay twice in a row. So it doesn’t really make sense to me that it solved your issue.
EDIT: Actually @Solene, looking at what happens to preLVMCommands when a LUKS device is involved, it looks like you are actually causing it to run vgchange before the LUKS stuff happens. So you must have LUKS on an LVM device, while NixOS assumes by default that it’s the other way around. You’re expected to inform NixOS of this switcharoo with boot.initrd.luks.devices.FOO.preLVM = false;
In the future hopefully the preLVM sorts of things will go away when we switch to a systemd-based initrd. It’s available as an experimental feature today, but the options are hidden from the manual. The way systemd handles devices and mountpoints is much more dynamic, so it’s able to infer how to order these things rather than require the user to write it in their nixos config.