Trying to PXE boot nixOS

I’m trying to work out PXE booting the nixOS installation…

So far, the initrd image seems to just load forever… no errors…just never ending “…” from the initrd loading stage.

Has anyone successfully PXE booted nixOS?

I’m using images generated from the utility for nixos-19.03pre153701.46651b82b87

I have to assume at some point this will timeout or die or something…but right now it’s just …

Thanks!

Plain PXE boot is insanely slow. If you can boot over HTTP instead it will be much faster so it’s entirely possible that you simply have to wait.

Are you using iPXE and http or pxe with tftp? I’ve seen the …’s forever with tftp due to its atrocious download speed of like 10mb/minute. If yes, consider first loading iPXE then chain loading NixOS over http.

Graham

So eventually it went through and yes, I’m doing pxe over tftp…but now I’m here:

I’m assuming perhaps the initrd or kernel image is too big perhaps?

Doesn’t seem to be going any further from this point.

Also got this message, which tells me the image is too large. Could this be due to the fact that I generated this image on a nixos-19.03pre kernel?

@xxedgexx You mind sharing an example git-repo with your setup?

Any luckk with this setup? This would be nice as a NixOS module, allowing a different form of “nixos-assimilate” over network boot.

A bit late perhaps and probably not very useful in this case. But I once made a write up for installing NixOS on a 512MiB RAM machine using iPXE together with a USB thumb drive. The instructions are for NixOS 16.09 but I think they still should more or less work.

Thank you for this. I’m going to give it a try. I wasn’t able to get the standard pxe boot to work for the reasons you stated. Initrd that gets generated is too large.

I was able to easily pxe boot using a computer already running NixOS, docker and pixiecore. Note It needs some RAM. A VM with 1GB wasn’t enough.

cd nigxpkgs
git checkout release-18.09
nix-build -A netboot.x86_64-linux nixos/release.nix

# figure out the "init" param using:
cat result/netboot.ipxe

# start the pxe server
docker run --rm \
-v /etc/ssl/certs:/etc/ssl/certs:ro \
-v /nix/store:/nix/store:ro \
-v $(pwd)/result:/image \
--net=host \
pixiecore/pixiecore:master boot \
/image/bzImage /image/initrd \
--cmdline "init=/nix/store/zl3gqcymdwphxm4ksdw5fd302mvr6a19-nixos-system-nixos-18.09beta-20598.gfedcba/init loglevel=4" \
-d --dhcp-no-bind --port 9100 --status-port 9100

-d --dhcp-no-bind --port 9100 --status-port 9100 Is probably not needed.

Note: You need to allow some ports in your firewall:

  • UDP: 67 and 69
  • TCP: 9100 (like in my case)
4 Likes

Fantastic, confirmed to work very fast and smooth. I’ve worked this into a complete example and added it to the Wiki.

4 Likes