NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.94k stars 13.96k forks source link

Cannot boot live cd #6265

Closed lucabrunox closed 9 years ago

lucabrunox commented 9 years ago

So I hear this from people from time to time, and it happened to me as well with usb stick. Then I rebooted twice and it happened to work. It's kind of random, I think some timing issue in the initrd or such.

The error I got was something like:

mount: mounting /mnt-root/iso/nix-store.squashfs on /mnt-root/nix/.ro-store failed: No such file or directory

I think musicmatze on irc got a similar message, and still cannot boot the live cd. Together with this also a warning about lvm leaking some file descriptors like:

File descriptor 3 (/nix/store/something-initrd-fsinfo) leaked on lvm invocation. Parent PID 1:...

So maybe the two are related.

cc @edolstra may know more.

This is a serious issue.

sdobz commented 4 years ago

I ran into this issue trying to boot nixos-minimal-20.03.1942.6d68b920eb2-x86_64-linux.iso installed via a fat32 usb3 stick created with unetbootin on a new lenovo thinkpad.

After disabling secure boot in the BIOS...

(this is typed by hand, may contain typos and omissions)

...
mount: mounting /dev/root on /mnt-root/iso failed: No such file or directory
...
f) to start an interactive shell having pid 1
f
...
/ # ls /mnt-root/iso
/ # ls -la /dev/root
/dev/root -> /dev/disk/by-label/nixos-minimal-20.03-x86_64
/ # ls /dev/disk
by-id    by-partuuid    by-path    by-uuid
/ # ls /dev/disk/by-uuid
E888-A999
/ # mount /dev/disk/by-uuid/E888-A999 /mnt-root/iso
/ # ls /mnt-root/iso
EFI    boot    menu.c32    syslinux.cfg    ubninit    unbpath1.txt
...

For some reason /dev/disk/by-label does not exist. Is there an aspect of the disk image copy process that is failing to add the label to the disk?

On a host operating system (nixos 19.09)

➜ sudo fdisk -l /dev/sdh
Disk /dev/sdh: 14.4 GiB, 15502147584 bytes, 30277632 sectors
Disk model: DataTraveler 3.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xaaa937de

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdh1  *     2048 30277631 30275584 14.4G  b W95 FAT32

➜ sudo fatlabel /dev/sdh1 nixos-minimal-20.03-x86_64
fatlabel: labels can be no longer than 11 characters

OK FINE the manual suggests dd

➜ sudo dd if=./nixos-minimal-20.03.1942.6d68b920eb2-x86_64-linux.iso of=/dev/sdh conv=fdatasync status=progress
559198720 bytes (559 MB, 533 MiB) copied, 37 s, 15.1 MB/s
1107968+0 records in
1107968+0 records out
567279616 bytes (567 MB, 541 MiB) copied, 71.4711 s, 7.9 MB/s
➜ sudo fdisk -l /dev/sdh
Disk /dev/sdh: 14.4 GiB, 15502147584 bytes, 30277632 sectors
Disk model: DataTraveler 3.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc8e0e6ee

Device     Boot Start     End Sectors  Size Id Type
/dev/sdh1  *        0 1105919 1105920  540M  0 Empty
/dev/sdh2        9528   52535   43008   21M ef EFI (FAT-12/16/32)
➜ sudo e2label /dev/sdh
e2label: Bad magic number in super-block while trying to open /dev/sdh
/dev/sdh contains a iso9660 file system labelled 'nixos-minimal-20.03-x86_64'

And that booted fine. If you're having trouble try installing using dd?

bobvanderlinden commented 4 years ago

Unetbootin does a lot of interesting things where we have no control over. From what I remember it tries to hook up the kernel and initrd its own. It detects which distro it is handling and since it doesn't have explicit support for NixOS it does some generic things that may not work. It might be convenient to not reformat an usb stick, but it's just very hard to assure it keeps working.

codygman commented 4 years ago

I have the same issue with the 20.03 iso from above using unetbootin. Will try formatting usb drive and using dd.

placeybordeaux commented 3 years ago

I tried to use unetbootin with 20.09. I only had a windows OS booting so I figured it was the best path.

It booted fine via BIOS, it failed to mount /dev/root in UEFI mode.

I needed to both rename the USB drive to NIXOS_ISO as well as edit the grub boot label to NIXOS_ISO then it booted fine.

MMesch commented 3 years ago

@placeybordeaux , how exactly did you change the grub boot label?

MMesch commented 3 years ago

Also, if I dd the image on a USB stick, it is called: nixos-gnome-20.09-x86_64 and it drops me into the GRUB console instead of the menu on UEFI boot.

MMesch commented 3 years ago

I finally managed to boot with these instructions: https://askubuntu.com/questions/947409/is-there-a-way-to-boot-from-usb-through-grub-menu

MHOOO commented 3 years ago

Had the same issue here after a failed upgrade to 20.9. I tried 2 sandisk 64gb usb sticks with dd, rufus (various settings), but the boot never worked. For some reason mounting the partition with the iso connects always timeouted. Then I tried a 1gb usb stick that I've had for over 10 years... possibly only supporting usb 2 and it immediately worked. After 6 hours of trying with the other two... Maybe upping the timeout might help, or re-scanning for usb devices? I've noticed in particular, that when inside the interactive console, fdisk -l never finds the "newer" usb sticks. I have to physically reconnect it, before fdisk finds those two sandisk sticks. Maybe this info will help someone else in the future.

tex commented 3 years ago

I got the same issue and thanks @MMesch for the link, instructions helped. It was my own build of iso image (with default iso.nix) as described on NixOS wiki. On the same USB stick, official iso from NixOS download page works correctly.

JoaquimEsteves commented 2 years ago

Hello. Any possibility that this issue gets re-opened? I also faced the same problem and have yet to find a solution.

nixos-discourse commented 1 year ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nixos-vm-under-freebsd-bhyve-failing/24964/1

poweredbypie commented 5 months ago

Hello, I've faced the same problem on an old Acer Aspire XC-603 with an Intel Pentium J2900 CPU. For some odd reason, when I plug in a USB WiFi adapter into the computer, both the NixOS live USB and the Arch Linux live USB fail to boot. On NixOS, it can't mount /dev/root. On Arch, a uevent hook times out and fails, it gets to the "welcome to Arch Linux" text, and then systemd fails to fork.

After unplugging the USB, the system boots sucessfully for both live environments. None of the fixes mentioned in this thread helped me, but I did notice that /dev/root symlinks to seemingly the wrong partition (the EFI image rather than the ISO). Just thought I would put this out here just in case someone else ran into the same problem.

EDIT: After a bit of toying, I suspect the issue is a bad / buggy driver. The WiFi USB card is an old RealTek that uses a staging driver (rtlwifi/r8712u), and I've heard RealTek has a really bad reputation for unstable Linux drivers. Weirdly, the issue doesn't persist once I installed NixOS.