nix-community / nixos-generators

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

Can not boot raw-efi image #192

Open ashraffouda opened 1 year ago

ashraffouda commented 1 year ago

I was trying to build a raw-efi image using nixos-generators, and when I tried to boot it using cloud-hyvervisor it always giving this error and I have no clue what to do to make it bootable built it like this NIX_PATH=nixpkgs=channel:nixos-22.05 nix-shell -p nixos-generators --run "nixos-generate --format raw-efi -o result" and booted it with cloud-hypervisor cloud-hypervisor --kernel ./hypervisor-fw --disk path=nixos.img --cpus boot=4 --memory size=1024M --console off --serial tty --cmdline "boot.debug1 debug1" Screenshot from 2022-11-18 16-41-48

Lassulus commented 1 year ago

hmm, will have to investigate that deeper I guess. what kind of bootloader are you using? I'm not sure where the initrd is coming from in your example? is it not needed?

ashraffouda commented 1 year ago

i'm using this https://github.com/cloud-hypervisor/cloud-hypervisor/ to boot the image now I'm kinda did a work around to boot it, I made efi enabled qcow image then converted it to raw and it works that way

ashraffouda commented 1 year ago

btw, I added a qcow-efi to make this work for me, should I add a pr here? or it is not needed?

Lassulus commented 1 year ago

we can add that for now, It would also be nice to find out why raw does not work :)

Lassulus commented 1 year ago

at some point in the far future I would like to refactor the nixpkgs images to do more of the abstraction which is currently done in this repo

ashraffouda commented 1 year ago

d that for now, It would also be nice to find out why raw does not work :

will try to find out why, but was kinda in hurry to make something work for us

RaitoBezarius commented 1 year ago

The image is missing the following kernel modules I believe:

boot.initrd.kernelModules = [
    "virtio_blk"
    "virtio_pmem"
    "virtio_console"
    "virtio_pci"
    "virtio_mmio"
  ];

Probably some of them are not needed all the time, but I believe virtio_pci is the critical one in this context.

RaitoBezarius commented 1 year ago

(I succeeded into booting a raw-efi image with this adjustement.)