nixos: iso-image: use syslinux bootloader for USB booting support#4678
nixos: iso-image: use syslinux bootloader for USB booting support#4678bobvanderlinden wants to merge 20 commits intoNixOS:masterfrom
Conversation
|
Closes #2100 |
nixos/lib/make-iso9660-image.sh
Outdated
There was a problem hiding this comment.
Add the /g flag to sed?
|
To test this, I've used the following: As for real hardware: I've tested this on an Asus 1215N. It has a legacy bios and it booted the ISO from USB as well as CD-rom. |
|
I'm in full support of this, the generated ISO from my machine works as intended. |
|
@MP2E Awesome, thanks for testing! What did you use to test the ISO? Virtual or physical system? CD/USB? UEFI or legacy bios? I'm fairly certain all combinations should work, but it would be nice to have all combinations checked one way or another. |
|
I tested it with legacy BIOS on my real machine via a random 8GB USB drive I had lying around |
|
Note that we actually used isolinux in the past, but we replaced it by GRUB to have a unified boot configuration. For instance, we can have memtest86 both on the ISO and on installed systems using the same memtest86 module, rather than needing separate memtest86 support for the ISO. Maybe we can introduce some abstraction (say |
|
@edolstra I believe having a working iso installer outweighs the need to have common boot entries, since it happens (also happened to me) that unetbootin iso does not work at all. |
|
+1 for easier USB booting |
|
@MP2E Sounds good. I guess it's also the most used setup for the ISO. |
|
I enabled bootable, efiBootable and usbBootable by default. It might be better to just remove these options and/or move the functionality to something like Edit: hmm, I had mistaken that the assertions (https://github.com/bobvanderlinden/nixpkgs/blob/e3409ae541c1f9f346224052d920c61b278c09a7/nixos/lib/make-iso9660-image.nix#L45) are in place. Bad idea to enable these by default (build fails). |
a5f9fdc to
e3409ae
Compare
There was a problem hiding this comment.
In the nixos release we should enable makeUsbBootable, otherwise the nixos installer in the homepage won't be usb bootable. The file is installer/cd-dvd/installation-cd-base.nix, there makeUsbBootable must be true.
There was a problem hiding this comment.
The same goes for EFI bootable. Should EFI also be enabled by default? Most modern motherboards and laptops are using UEFI to boot nowadays, so this is also most preferable I'd presume.
There was a problem hiding this comment.
It's already enabled for the installer. It's that you added the usb, and now needs to be enabled for the installer.
There was a problem hiding this comment.
Ah good point. I've added the option to installation-cd-base.nix
|
This is ready. @edolstra do you think the shared boot entries are a blocker? Can you point to a use case where that's necessary currently? |
|
@bobvanderlinden last thing, did you actually need that /g for the sed? That thing is broken anyway, so I'd rather leave that change out. |
|
@lethalman Agreed, I've removed it. In the off-chance that there are files with '=' in them, the ISO generation will fail. I think this is the proper behavior until proper escaping is in place. |
|
I've left the old sed code. The escaping must be done when adding files, not after with sed. Merged thanks!!! |
|
Awesome, thanks! |
|
Wrote something in the wiki here, feel free to improve: https://nixos.org/wiki/Installing_NixOS_from_a_USB_stick |
|
Does Unetbootin still work with this? @lethalman I'd prefer if you had waited for an explicit +1 for a major change like this, since in a sense this is a regression to the bad old situation of having to maintain multiple boot loader infrastructures... |
|
@edolstra it's sad you want to revert, I think isolinux offers more for booting live cd than grub and that's why most major distros use it. I can revert and we'll rework on it after 14.11 |
|
There seems to be a problem with the VM tests: Is isolinux configured to auto-boot after a few seconds? |
|
Tested unetbootin on a few computers, some with EFI and some without. NixOS boots fine (memtest boots NixOS, which isn't changed by this PR, as noted above). Now there's nothing left to be tested/improved in this PR and it should get merged to master, agreed? |
|
@chisheel @vcunat Thanks for testing. Yes, I think all problematic cases have been covered now with the latest ISO. I'm all for getting this merged well before the next milestone is released (15.05). That way there is a bigger chance people come across potential problems. If there are problems I'm guessing it is in incompatiblities in options. I think those are covered, but it's hard to be sure without people trying it with their own configurations. So, yes, merging would be a good option at this time I think. |
|
I think it can be merged, @edolstra ? On Sat, Mar 7, 2015 at 4:19 PM, bobvanderlinden notifications@github.com
NixOS Linux http://nixos.org |
|
Btw let's not merge this before hydra is fixed, so we can test with latest unstable changes. |
There was a problem hiding this comment.
BTW, we might better increase this limit, as some people tend to get disk-full here.
There was a problem hiding this comment.
What limit would you suggest? 20M? 50M?
Or should we calculate what is needed to fit ${efiDir} in there?
There was a problem hiding this comment.
Anyway, it's a thing unrelated to merging this PR.
I would personally prefer to be adaptive, as various per-user config changes may affect the needed size (e.g. kernel modules). Perhaps run du on the things we want there and add several percent for overhead. (We could even re-iterate on each failure with several percent added.) I will produce some code and file a separate PR for anyone interested to review.
There was a problem hiding this comment.
There was a problem hiding this comment.
If i may, increasing this to 100MB or 512MB would be ideal, on install the EFI Parition needs to be 512MB to allow for multiple initrd's etc and also its more the defacto see: http://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#Linux
Will also allow people to put other images on to the USB stick should people want to dual boot it. Just an opinion.
There was a problem hiding this comment.
Yes, but that would mean all ISO images will increase in size quite a bit. Ideal would be to measure how much is needed and create an image that fits those needs. Not sure if du is reliable for that (now much does FAT metadata use?), but it's a good step in the right direction I think.
Also, I've created #6796, so that we have a better place for this conversation. (I have trouble finding these in-code conversations each time ;)).
|
It seems the evaluation errors on hydra are resolved: http://hydra.nixos.org/jobset/nixos/trunk-combined#tabs-errors Is everything ready for a merge? |
|
👍 for me because installer tests passed the last few days, e.g. http://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.installer.simple.x86_64-linux |
by using syslinux (i.e. support the dd-method in addition to unetbootin). @vcunat tidied the PR by squashing closely related changes together.
|
Unfortunately, atop current master the dd-method no longer works for me: it claims there's no bootable media. (I tested with cleaned history of the PR https://github.com/vcunat/nixpkgs/commits/v/iso-full, but I verified the tree is the same as with merge.) |
|
I'm getting a brief flash of "isolinux.bin is missing or corrupt". I see the file "/isolinux/isolinux.bin" on the media; it has several bytes on the start different from |
|
@vcunat Since you mention I also see differences in the first bytes of isolinux.bin on the ISO compared to the original file. I don't know the details, but it could be intentional. It could have something to do with EDIT: I removed all I tried it with qemu using: (qemu wants a writable ISO file if it emulates USB, that's why I first copied it) |
|
I tried the two USB disks on an UEFI system now, and it failed (just black screen). Note that one of the images linked above did work on that machine before, just as it did on my main notebook where it fails now. (I'm sorry for my slow latency these weeks.) EDIT: after the first failures, I was testing the parent of the commit you did 1d649edf2b to rule out an error in the last one (I didn't find that likely and now that commit was picked to master). |
|
It seems that I get different results from the build process than @vcunat or @lethalman. I presume it has something to do with @vcunat Presuming it won't boot through Qemu. Is there a way to verify that we are indeed building the exact same system with exactly the same environment? What path does your build result in? Is it also |
|
OK, so now I created clean clone, then removed the .git directory as it seems to affect the derivation names (!), and checked for nonexistence of ./result. I used the same commit v/iso-full e19ac24 to have the determinism changes. which links to @bobvanderlinden (or others): can you reproduce this? (if you remove .git... I tested that touching files shouldn't affect the derivation names at least, and probably not even the contents) |
|
Oh, that iso does boot for me with dd + both UEFI and non-UEFI. I have no idea what was wrong before, probably some random error or a mistake of mine. |
|
Re-tested also unetbootin + UEFI. I think we can merge the branch. |
by using syslinux (i.e. support the dd-method in addition to unetbootin). @vcunat tidied the PR by squashing closely related changes together.
|
In master now! @bobvanderlinden: great many thanks for you half-year effort. |
|
Thanks a lot @bobvanderlinden that was a great contribution. Hopefully I don't have to revert this again :P |
|
🎉 Yay! Thanks for the merge! @lethalman Yes, let's hope so ;) I'm still interested why @vcunat had different results earlier. @vcunat Are you sure it was an error on your side and not something else? It seems in the course of this PR there have been instances where I didn't know how to reproduce an error because of the image that was built. Also (maybe related), do we consider having .git (or even 'result') in the repo non-deterministic? It's only for ISO generation (right?), but it still doesn't seem right. |
|
I could try to find the old ISO on the other computer (not near me now), but finding what exactly differs etc. is likely to be quite complex. I think this non-determinism all comes from the fact that the source directory is copied into the ISO as the default channel, and the copy includes everything in the directory. We should at least remove .git. |
|
Related: any idea on #7132 (comment)? |
|
I don't think its' related in any way to this PR. It's known that sometimes the installer boot fails to find the iso image for mounting. The random fails people see is because something went randomly wrong at burning, or at booting. Nothing related to syslinux or grub. |
This changes the bootloader for iso generation from Grub to syslinux. In addition this adds USB booting support, so that "dd" can be used to burn the generated ISO to USB thumbdrives
instead of needing applications like UnetBootin.
Most of this is based on the ISO generation methods that is used for ArchLinux.
Prebuilt iso by @lethalman, updated 26 Feb 2015, based on unstable release of 25 Feb 2015 (commit a869c83):
Shared doc for tests: https://docs.google.com/spreadsheets/d/103doEIjC_Sk_nkmSq9stkVD3tbh4st_4JKYLlXAel84/edit#gid=1631478778