-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos: make iso network bootable #2100
Comments
With syslinux, we should be able to create a hybrid image, which can be copied to a usb-stick using dd or burnt to a CD with: http://www.syslinux.org/wiki/index.php/Doc/isolinux#HYBRID_CD-ROM.2FHARD_DISK_MODE |
Yep, isolinux is one option.
|
Same issue here. The wiki noted that making the image hybrid should be possible, but it is not since the current bootloader on the ISO is grub. I've removed this section from the wiki: https://nixos.org/w/index.php?title=Installing_NixOS_from_a_USB_stick&diff=22883&oldid=22783 Ideally you'd want an image that boots on both CD and USB as well as legacy bioses, UEFI and Mac OSX. From the different distributions that I've tried, ArchLinux does this best. It uses a recent isolinux with some additional work to get different UEFI systems to work using Gummiboot. From what I could tell, NixOS already uses Gummiboot for UEFI. I don't have much experience with PXE, but I know that same image can be used for PXE as well (not sure whether UEFI/legacy is an issue here). It might be a good idea to take a look at how ArchLinux does this. The script for creating their ISOs is located in the archiso project (https://projects.archlinux.org/archiso.git/). More specifically https://projects.archlinux.org/archiso.git/tree/archiso/mkarchiso and https://projects.archlinux.org/archiso.git/tree/configs/releng/build.sh I've once needed an ISO that supported booting on all of the different setups. I made a simple/minimal script based on the code of archiso. You can find this project here: https://github.com/FrozenCow/drivedroid-image The only thing that's missing from this project is support for PXE booting. I'm new to NixOS and the packaging system, so I haven't been able to figure out how to get all this working with Nix. If I could get some pointers where to look at/for, I can try to implement the different booting mechanisms. |
This! Please! I don't have CDs and I don't want to buy CDs. Even if I had one, I don't have anything to burn a CD with any more. All of my options for installing NixOS on hardware are extremely inconvenient right now. |
@vikstrous You could just use unetbootin for writing the current iso to a usb drive until a hybrid iso is made. |
Unetbootin is not working for me on OS X Mavericks. The drives dropdown doesn't have anything in it. I tried two different USB sticks and it doesn't see either one. |
You need to mount the USB somewhere before unetbootin can see it. Make sure you're running it as root. I can only say that unetbootin does work with NixOS ISOs. |
Btw I can say that unetbootin does not always work. Debian since a couple of years has ISOs bootable from usb, and that's very handy. So 👍 for usb-bootable iso images, please. |
It would be very convenient if syslinux could be used and a simple It would also allow me to add NixOS to DriveDroid, which makes it possible I'm willing to dig into this a bit more, but I need some pointers on where |
@FrozenCow I can help with that if you jump on irc. I don't know anything about uefi. |
👍 This would be cool. |
For anyone interested, I've submitted #4678 that uses syslinux instead of grub for the ISO. That way the ISO can be burned to an USB stick using Additionally this enables usage in DriveDroid, so that you can boot NixOS through an Android phone. As for network booting, this isn't in the PR. I don't think an ISO is ideal for PXE booting. I'd rather see some directory being used to install NixOS to with PXE-booting support. NFS can in turn be used to host the directory. Using the ISO for PXE is convoluted (or so I've seen in ArchLinux), where you need to mount the ISO on the PXE server and do some fiddling afterwards. It would be nice to have some nix-build -A pxe_minimal.x86_64-linux that creates a PXE/NFS compatible root directory. |
The usb bootable part has landed in master, I'd remove this issue from the 14.11 milestone. |
I've successfully PXE booted something much like the installer, But its quite a hack, we're going to need network support in the initrd to make it work: #5265 Other than getting the network going, its was trivial to replace the nix store on the PXE client with CIFS rather than squashfs, there isn't much more to do than that. |
Incidentally, it would be awesome if nixos.org could host an iPXE target so e.g. vultr.com VMs could be booted straight from there... |
I have a module to do a little of the PXE hosting configuration. I tried to get generate a squashfs and then insert that into the initrd, but generating the store closure before the initrd causes an infinite recursion. I'm not making a PR for the PXE stuff but its here if someone wants to pick it up. |
i have also been playing with booting normal nixos from the network, and i think ipxe would allow booting a syslinux/grub based iso over the network, but you would need some initrd support to find the network and mount it properly |
Yes, I think the thing to do with the least amount of obscure hackery and the most amount of reuse would be to get the initrd to do networking. |
first thing to decide on is which network protocols to support, nfs would be easy in the initrd, but need a bit more config to make it boot iscsi should be easy, but you would need to install a target daemon like tgtd on the system serving the iso i don't think ftp/http(s) can be loopback mounted, but the initrd could just curl it to a tmpfs and boot that there is also the question of how much network configuration will be required, dhcp, http, iscsi, nfs, tftp ipxe cant boot from nfs, but it can fetch the kernel+initrd over tftp or http, then initrd can mount nfs for the iso |
I think NFS is garbage, so I would say CIFS or diod and 9P, but I've been told that samba seemed to outperform diod. |
I would be happy with kernel+initrd over tftp and iso/root over nfs. Or sqashfs over tftp. |
this is what i have so far: https://gist.github.com/cleverca22/e266881fb6645c126710 bzImage/initrd/nix-store.squashfs are just copied right out of the iso, the init= must match what the squashfs contains, so you have to read the isolinux config file ipxe will load the config+kernel+initrd over http, but tftp could also be used, the initrd should mount the dir over nfs(9P or anything else the kernel supports also work) for the squashfs file, but it currently lacks nfs support |
not directly netboot, but there's a convention for loopback booting via grub: http://www.supergrubdisk.org/wiki/Loopback.cfg perhaps you could generate that along. |
Just saw http://netboot.xyz/#netbootxyz, might be a good use if nixos was hosting kernel, initrd and squashfs. ArchLinux seems to just download squashfs (https://github.com/rcrowley/archiso/blob/master/archiso/initcpio/hooks/archiso_pxe_http#L30-L61) and the url for squashfs is passed as a parameter for the kernel (which could be done from the ipxe file). |
@bobvanderlinden Thanks for mentioning netboot.xyz. Ever since boot.kernel.org was shut down I was searching for an alternative. I'll try to add NixOS next week. |
@fpletz did you manage to? I'd love to use this. |
I've opened an issue in their issue tracker. |
@globin NixOS doesn't have a kernel + initrd + squashfs (or other files that iPXE to boot NixOS) hosted over HTTP as far as I know. It would be nice to have something like that, instead of the ISO (which probably requires fiddling). @cleverca22's work seems like the closest there is, but it needs to be in nixpkgs so that hydra (and others) can reproduce it as well. I think it would be nice if there was one build(-attribute) that would result in these 3 files, but there might be better ways(?). |
It should be possible to factor that outside the ISO generation module. |
Also for reference see https://github.com/sleinen/nixos-pxe-installer |
To get the ISO booting from memdisk via iPXE, have you all looked into the memdiskfind, phram and mtdblock method to identify where the ISO has been mapped in memory and then mount that once the kernels are loaded? I've been poking around the internet a bit collecting info about that method here. |
I have a similar use case, but for a small stripped down system, and I was thinking that it might be interesting to just embed the squashfs inside the initrd. Once the kernel and initrd have been downloaded over the network the system would have everything it needs to boot. If anyone has the time to help me implement that I'd appreciate it. |
Followers of this ticket may be interested in trying out master...nshalman:netboot-v2 |
The PR is submitted: #14740 Suggestions are welcome! |
@offlinehacker could you open a new issue describing exactly what in your case means "network boot"? I'd really like to close this catch-all issue that serves no use. If we want ISO to be network friendly, it's really easy as adding another profile that allows root ssh and sets password to "". |
No description provided.
The text was updated successfully, but these errors were encountered: