[Nix-dev] booting NixOS+Xen from EFI

Tim Cuthbertson tim at gfxmonk.net
Wed Sep 2 14:23:22 CEST 2015


I have a macbook air which I'd love to get a xen+nixos (as dom0)
installation running on. I've got NixOS dual booting with OSX after
not too much trouble, but when I went to enable xen I discovered that
it's not supported on EFI (nixos has an assertion telling me so).

After some research, it seems recent xen versions do support EFI, so
perhaps it's possible but just not yet implemented?

Based on [http://wiki.xenproject.org/wiki/Xen_EFI], I came up with the
following (hacky) changes to try and get this working. There are
minimal changes required to get xen building an .efi image, the main
issue is in getting gummiboot to actually use it:

https://github.com/NixOS/nixpkgs/compare/master...gfxmonk:xen-efi

(aside: the xen build seems to be pretty broken at the moment, many of
the preBuild steps don't actually work. I've commented out the failing
ones, but they seem to be all in tools/ subdir, so I'm hoping those
problems can be ignored until after I have a working boot)

This now seems to be booting xen.efi, and then kicking of the normal
nixos stage1. Unfortunately, at this point it times out waiting for my
root disk to be mounted.

Dropping into a shell, I see that it's populating /etc/fstab with the
right entry, but the problem is that /dev/disk/ is never created. Nor
do /dev/sd* exist. I don't know much about how these are populated,
but it seems like a udev thing, and somehow it's just not seeing my
disks.

I notice that xen comes with udev rules in
etc/udev/rules.d/xen-backend.rules, which may be the culprit - it
seems plausible that xen is exposing these devices as virtual ones,
and without those udev rules installed nixos never sees any disks. I
looked into getting those rules into stage1, but the rules invoke
scripts (also in the xen derivation), and I have no idea how to get
that to work within stage1. Also, presumably this works somehow in
xen+grub - does anyone know how that works, or why it would be
different with efi?

Thanks,
 - Tim.


More information about the nix-dev mailing list