nixos-generators
nixos-generators copied to clipboard
`raw-efi` flashed onto usb drive does not boot on physical machine
Issue:
booting a physical machine (Asus Zenbook UAK330UA) using a usb drive flashed with a freshly built nixos raw-efi
image brings up the gray splash screen with logo, but does not progress further. All controls are unresponsive and the machine is locked. Hard reboot necessary.
reproducing with the following flake:
{
description = "test image";
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.05";
nixos-generators = {
url = "github:nix-community/nixos-generators/1.6.0";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixos-generators, ... }: {
packages.x86_64-linux = {
kiosk =
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
nixos-generators.nixosGenerate {
inherit pkgs;
format = "raw-efi";
};
default = self.packages.x86_64-linux.kiosk;
};
};
}
Then nix build
. The resulting result/nixos.img
is flashed onto a usb drive via: (change sdX to appropriate device)
% dd if=result/nixos.img of=/dev/sdX bs=16M oflag=sync status=progress
The partition layout looks fine, with a 230 MB ESP partition, and roughly 2 GB primary partition for nixos.
I tried this today and found two issues:
- raw-efi has a fstab entry for mounting an ESP at /dev/vda1, which doesn't exist on hardware. I opened a PR to fix this: #198
- The grub config for raw and raw-efi adds
console=ttyS0
to the kernel command line, which redirects all console output to a (likely non-existent) serial console instead of your monitor. This can be worked around by addingboot.kernelParams = [ "console=tty0" ];
to your configuration; this will be added afterconsole=ttyS0
, overriding it.