NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.08k stars 14.13k forks source link

NixOS Live USB/DVD fails in UEFI mode #7132

Closed OOPMan closed 3 years ago

OOPMan commented 9 years ago

Hi guys

Recently I decided try NixOS. First I downloaded the 14.12 x86_64 graphical ISO and tested it in virtualbox. Everything worked nicely so I decided to give it a go on my base hardware.

Currently my system is dual-booting Windows 7 Ultimate x86_64 and Sabayon Linux x86_64 (A deriviative of Gentoo Linux). My intention is to replace Sabayon with NixOS.

However, when booting from either a DVD or USB stick in UEFI mode, the boot process stalls at a random point. The system still responds to CTRL+ALT+DEL but boot proceeds no further and no error significant messages are displayed. Booting from the DVD in BIOS mode works fine however :-/

I modified the kernel parameters on the USB stick to using loglevel 7 (maximum logging) and tried booting three times in UEFI mode. Each team, the boot stalled at a different stage and no common logging messages where displayed that could indicate why. I used a phone to screencap each time, you can see the results at https://plus.google.com/photos/116682673061080912644/albums/6132475820380017041

Just to be sure, I also tested the latest ChakraOS live ISO via UEFI USB and it works fine.

I'd love to be able to give you guys better information on what's going wrong if you can give me some idea as to what information would prove useful.

domenkozar commented 9 years ago

Did you follow http://nixos.org/nixos/manual/sec-installation.html#sec-uefi-installation?

PS: We've just merged dd support for ISO images, we should have those available in a few days online.

OOPMan commented 9 years ago

I did follow those instructions and label the USB drive as NIXOS_ISO.

As I said, I am able to complete the bootup process in BIOS mode from DVD but UEFI mode on either DVD or USB the boot stalls randomly.

I also tested the DVD and USB in UEFI mode on my laptop (Which currently dual-bools Windows 8 and Sabayon) and the boot completed with no issues.

I suspect this is some kind of hardware issue. Is there a specific tool you'd like me to use to provide some hardware info?

vcunat commented 9 years ago

I expect the dd-related commits might help this, but note: those won't appear in 14.12, only in unstable (once the channel updates finally).

vcunat commented 9 years ago

In the meantime you might want to try one of the ISOs published during testing those changes, e.g. https://github.com/NixOS/nixpkgs/pull/4678#issuecomment-76628582. Once you boot, you should be able to install any version you like (even 14.12).

OOPMan commented 9 years ago

The ISO published in the comment you referenced freezes in UEFI mode for me, just as the older ones do.

bobvanderlinden commented 9 years ago

What we know:

When the system fails, it doesn't freeze completely (Ctrl+Alt+Delete still works). So I'm assuming systemd is still working and there is no (hidden) kernel panic.

I presume you do enter gummiboot (the boot menu before the system starts). In there, you can press e to temporarily alter the kenel command-line. Can you add debug to the end of that line?

If you boot with this change, it'll show debug information from both systemd as well as the kernel. Hopefully it'll give some better understanding to the problem.

OOPMan commented 9 years ago

If by gummiboot you refer to the menu with 3 items, the top one being NixOS and the bottom one being EFI firmware interface then yes I do enter that.

I'll try the debug trick shortly and let you know what turns up :-)

OOPMan commented 9 years ago

I tried the debug trick and snapped the following after it locked up:

Capture

Not sure if anything stands out there, although I did already try unplugging my XBox 360 Wireless dongle and disable the on-board sound to see if it made a difference (It didn't :-/ )

lucabrunox commented 9 years ago

It's weird, that's stage 2 and shouldn't be affected by this PR (in theory).

Edit: ignore this comment, I've been confused by the title of this issue.

bobvanderlinden commented 9 years ago

(@lethalman this isn't a PR ;) It's an issue regardless of the new boot system or the old) From what I've seen, ChakraOS (the ISO that did work) has a somewhat similar kernel command line compared to NixOS.

It must be some incompatiblity with UEFI and something that's loaded in stage 2... somehow. Too bad the debug output didn't give us much. I'm still wondering how to determine whether this is a kernel-freeze or whether this has something to do with some systemd service.

Just to be sure, I presumed the system will not show something after 90 seconds? Is this indeed correct? I noticed in the screenshots that the last line isn't interrupted abruptly.

Could you add the following to the commandline: systemd.unit=rescue.target? That way systemd will only try to start a shell. Maybe it's best to come on IRC #nixos on freenode for further help. I'm usually on in the evening GMT+1.

OOPMan commented 9 years ago

I have left the system sitting in the "locked" state for 5 minutes just to make sure there wasn't anything loading really slowly but no luck :-/

This issue is most noticeable in that the command prompt cursor the follows that bottom of the scroll which is usually flashing sticks and the system becomes unresponsive.

I will try the systemd.unit command suggested and see what happens.

If I get a chance to come on IRC at that time I will :-)

OOPMan commented 9 years ago

I tried loglevel=7 debug systemd.unit=rescue.target

Once again, the lock-up occurred. Here's snapshot of the freeze.

vcunat commented 9 years ago

I wonder if nouveau(fb) could cause this. Some people complained about these. For some it helped to add "modprobe.blacklist=nouveau" as a boot option, but for some it didn't #5829.

OOPMan commented 9 years ago

I will try the setting the modprobe blacklist option and see what happens. Although I should not that this problem also happens on the minimal ISO. Not sure of noveau is included with that one?

vcunat commented 9 years ago

The part for KMS console is probably in there.

OOPMan commented 9 years ago

Okay, I tested using that mobprobe.blacklist setting and the system seemed to get to the point that X would be started (Systemd output was cleared away and only cursor left at top of screen) and the machine then hard-locked and had to be switched off. I tried this again with the systemd.unit=rescue.target and the machine once again hard-locked.

As an experiment, I entered my BIOS and enable the on-board Intel IGP and set it to be activated first and tried booting into NixOS again (Without the blacklist options though). Once again the machine hard-locked completely at the point where X would start.

:-/

matthiasbeyer commented 9 years ago

Hi.

I know I'm rather late to the party, but I have an issue which looks really equivalent to this one:

I've tried to install NixOS 14 and the pre 15 ISO on my ThinkPad X220. It fails withe the following lines in stage 1:

File descriptor 3 (/nix/store/...-initrd-fsinfo) leaked on lvm invocation. Parent PID 1: /nix/store/myj2p16wdpnbmb53iib3
No volume groups found
.

The above is listed ... 20 times or something... after that:

mounting /dev/root on /iso...
mount: mounting /dev/root on /mnt-root/iso failed: No such file or directory

An error occured in stage 1 of the boot process, which must mount the root filesystem on /mnt-root and then start stage 2. Press one of the following keys:

r) to reboot immediately
*) to ignore the error and continue

The above errors are printed with the 14.04 image as well as with the pre 15 image (The hashes are from pre 15).

I tried several things, all resulting in this:

none succeeded.

Can I somehow mount the /mnt-root by hand? If yes, how to?

Profpatsch commented 8 years ago

(triage) bug still existent?

grahamc commented 8 years ago

Closing in the hopes of numerous kernel updates having solved the problem. We can re-open if it isn't solved.

michalrus commented 8 years ago

It still happens with 16.03 LiveUSB (ISO dd’ed directly to /dev/sdb) on my mom’s old netbook. Hmm. A pity it can’t be booted in non-UEFI mode. Instead of debugging this, I think I’ll get her hdd connected to my laptop and install from there. Will be less boring. =)

globin commented 8 years ago

I booted both in UEFI and in legacy mode yesterday from a freshly built ISO image from our company master which shouldn't have any relevant changes to code regarding the ISO.

Fuuzetsu commented 8 years ago

I saw https://github.com/NixOS/nixpkgs/issues/7132#issuecomment-115802320 about a week ago (with master at the time) but eventually I got it going with dd method.

globin commented 8 years ago

I dded the iso directly to a USB device.

chris-martin commented 8 years ago

Regarding @matthiasbeyer's comment on the error message

mount: mounting /dev/root on /mnt-root/iso failed: No such file or directory

I believe this is actually offtopic, but this issue comes up in a Google search, so I want to repeat the solution here.

I get that error when trying to boot from a USB drive where the label isn't NIXOS_ISO. You can set that using mlabel (which from the mtools package).

sudo mlabel -i <device> -s ::"NIXOS_ISO  "

Note the spaces that pad the label name to exactly 11 characters.

vaibhavsagar commented 7 years ago

Changing the label to "NIXOS_ISO" fixed the issue for me as well.

bjeanes commented 5 years ago

I am having this same mount: mounting /dev/root on /mnt-root/iso failed: No such file or directory error.

I am on macOS so am not sure how to rename the partition. I tried diskutil rename but that only works with mounted partitions, but macOS can't read this disk to mount it.

I tried brew install mtools to get mlabel but it seems to have a different set of flags than what @chris-martin posted and trying to go based on the man pages isn't leading me anywhere. I'm just getting a non-0 exit status without any useful error message...

bjeanes commented 5 years ago

Never mind, I was able to change the label with:

sudo mlabel -i /dev/rdisk2s2 ::"NIXOS_ISO  "

However, I still get the same mounting error after booting into it, so it didn't seem to have the desired effect. /dev/rdisk2s2 was the only partition or device identifier that it would accept). Adding -s to print the identifier after removing and re-inserting the media confirms that the label was applied. I also tried applying a label with and without the trailing whitespace to reach 11 chars.

Nonetheless, I still get mount: mounting /dev/root on /mnt-root/iso failed: No such file or directory.

EDIT: This is with nixos-graphical-18.09.2456.43ba99fa035-x86_64-linux.iso, FYI. I am also seeing #5829, but I can get some output by going to rEFInd option, then booting from there, which is what is landing me here.

bjeanes commented 5 years ago

By using rEFInd to alter the boot options (I looked at https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/stage-1-init.sh to get a sense of what they were) to:

initrd=boot\initrd boot.shell_on_fail

I was able to see that /dev/root was not defined. However, any of the following boot variants allowed the ISO to be mounted:

initrd=boot\initrd root=/dev/sda1 # In _my_ case
initrd=boot\initrd root=/dev/disk/by-label/NIXOS_ISO
initrd=boot\initrd root=LABEL=NIXOS_ISO

However, this brings me to a totally different error immediately:

switch_root: can't execute '/init': No such file or directory

This is followed immediately by kernel panic.

eugenezastrogin commented 5 years ago

This is followed immediately by kernel panic.

I have that same exact problem on Acer Swift 3 SF314-56-5403. Followed the same steps, ended up with the kernel panic. Unfortunately, legacy boot is not an option on my model, so I have to make it work somehow... :(

Kernel panic message

UPDATE: After battling with NixOS for 4 days, I ended up installing it via Ubuntu LiveCD using this instruction.

BTW, there is a relevant issue here but no advice from there helped in my case.

sveitser commented 5 years ago

Nonetheless, I still get mount: mounting /dev/root on /mnt-root/iso failed: No such file or directory.

I was having this problem too and eventually "solved" it by using an external SSD as bootable medium. I think there was something wrong with my USB stick. I ran into a similar sounding problem when trying to boot ubuntu from said USB stick.

sonowz commented 4 years ago

I just failed installing NixOS 19.09 using USB stick.

Booting to USB immediately hangs with blank screen (with just one underbar character).

So I ran EFI Shell and manually selected rEFInd.efi to boot. Not sure if this is correct way. Selecting NIXOS_ISO from rEFInd made boot sequence to show up, but got error mount: mounting /dev/root on /mnt-root/iso failed: No such file or directory.

I found instruction as @aethelz did, and successfully installed NixOS.

FYI, here's my environment when I booted with Ubuntu 18.04 live CD:

stale[bot] commented 4 years ago

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.

landm commented 4 years ago

If anyone is still running into this issue, the workaround is to edit the grub command prior to boot (press e while highlighting the default selection), or edit grub.cfg in the ISO. Change: root=LABEL=nixos-minimal-XX.XX-x86_64 to root=LABEL=NIXOS_ISO

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

mystica555 commented 2 years ago

Still happening today, nixos-minimal-22.05.3147.b47d4447dc2-x86_64-linux.iso I'll try changing the boot label ... but really this shouldn't keep happning :(

mystica555 commented 2 years ago

Nope, i cant hit 'e' to change anything. Once i see the weird graphical boot menu with oversized text and very slow to respond keystrokes, it just goes black screen as if i've selected something with enter. And i havent...

Fractal147 commented 1 year ago

I confirm this still happens on nixos-minimal-23.05-x86_64 (23.05.2084.08700de174b), and an Asus transformer T100HA. Setting line 2 of EFI/boot/grub.cfg to set textmode=true allows it to be usable, but yeah nothing apart from arrow keys (slowly) worked in graphical grub - everything else crashed to reboot. Reopen?

notisrac commented 8 months ago

On my T100HA with nixos-gnome-23.11-x86_64 (23.11.5060.617579a78725) when I select anything from the menu it just reboots. However the speed of the boot GUI was decent. The set textmode=true trick worked for me as well.