nix-community / nixos-generators

Collection of image builders [maintainer=@Lassulus]
MIT License
1.79k stars 142 forks source link

Raw-efi images unbootable/require manual intervention on real hardware #244

Open arbv opened 1 year ago

arbv commented 1 year ago

I have tried to boot a raw-efi image and got similar situation to the one described here:

https://github.com/nix-community/nixos-generators/issues/192

I had to manually mount /boot in order to continue (it worked fine). It appears to be cause by the fact that mounting /dev/vda1 to /boot is hardcoded somewhere during image building step. That is, these images appear to be bootable only on KVM. Take a look at /etc/fstab to from the image to give you some clues:

# This is a generated file.  Do not edit!
#
# To make changes, edit the fileSystems and swapDevices NixOS options
# in your /etc/nixos/configuration.nix file.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

# Filesystems.
/dev/disk/by-label/nixos / ext4 x-nixos.autoresize,x-initrd.mount 0 1
/dev/vda1 /boot vfat defaults 0 2

# Swap devices.

It appears that for /boot the right line should be /dev/disk/by-label/ESP /boot vfat defaults 0 2.

Please take a look at that. I have produced the image for rescue purposes but it turned out the the rescue image itself needs to be rescued first :)

At any rate, I am very impressed by how easy it is to build an image using this project. Thank you!

arbv commented 1 year ago

One important (or not) addition: I have built the image for ARM64 using flakes (--system aarch64-linux) parameter.

I have used nixos-generators from nixpkgs (23.05).