NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.58k stars 13.73k forks source link

Raspberry pi4B: can't boot on usb+gpt with 4TB drive (all ok on 8G usbkey) #114157

Open LucaFulchir opened 3 years ago

LucaFulchir commented 3 years ago

Description

On an rpi4 I broke 2 microsd due to (probably) too many writes.
I decided to go all usb and to try to make it a nas+other things, on it, so I have 2x4TB drives on usb3.

rpi4 has added support for usb boot on September, I have updated the eeprom and I can boot from a usb stick easily by flashing the latest successful unstable nixos build on hydra. No problems there apparently.

I can create a USB key (8Gb) with GPT and copy the installation media partitions there. It boots correctly.
I can not do the exact same steps on a 4TB disk, I get a lot of "gpt partition table header signature is wrong" and after a while of waiting for network boot I get sent to a u-boot prompt

I don't want to use MBR on the 4TB drives, since I would lose half the total space.

To Reproduce

Expected behavior

Boots normally with a 8GB USB key, does not load the kernel on a 4TB drive

Additional Info

The errors "gpt partition table header signature is wrong" only appear on the nixos boot on the 4TB drive, so it might be a problem of the u-boot version.
Maybe the hydra image is using u-boot 32 bits and it can't handle disks bigger than 2TB? I don't know how to verify that. I don't know how to debug/patch/update u-boot, suggestions?

nixos-discourse commented 3 years ago

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

https://discourse.nixos.org/t/rpi4-usb-boot-gpt/11440/3

LucaFulchir commented 3 years ago

Just for reference I tried:

file: pkgs/misc/uboot/default.nix

   ubootRaspberryPi4_64bit = buildUBoot {
     defconfig = "rpi_4_defconfig";
     extraMeta.platforms = ["aarch64-linux"];
+    extraMakeFlags = [ "CONFIG_LBA48=1" "CONFIG_SYS_64BIT_LBA=1" ];
     filesToInstall = ["u-boot.bin"];
   };

With a couple more things to let master compile the whole image for raspberry.
The theory was that those two flags should enable usage of disks > 2.1TB in uboot.
I am still unable to make it boot, the message is always the same, complaining about invalid GPT header signature

Suggestions on what I could try?

jjthiessen commented 3 years ago

I already commented on a related issue (https://github.com/NixOS/nixpkgs/issues/127814#issuecomment-873523810), as the errors that I am getting from U-Boot are the same as in the other issue (including the reported signature that, AFAICT, mysteriously doesn't appear in the partition table); however, my setup is more similar to yours (I'm trying to boot from a single 5TB USB drive).

LucaFulchir commented 3 years ago

I kind of gave up and I am using the SD for jsut the partitions for firmware + /boot everything else is on my 4TB drives, seems to work.

Not the setup I wanted, and I have not tried again since the last report in May,

I need someone with u-boot experience, the current compiled one clearly does not support drives > 2TB

jjthiessen commented 3 years ago

It's funny you say that, because I did the same thing (on July 4th or 5th :)).

stale[bot] commented 2 years ago

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