-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
Raspberry Pi 4 USB boot support #122130
Comments
@samueldr I will do this with a 2GB and 8GB model right now and get back to you with all the specifics you have asked for. 😄 |
Came across this issue after having the same problem shown here #121720 (comment) , and described here #121834 (comment). To recap for other readers, the problem there is that the latest successful build (nixos-sd-image-21.05pre287596.ae1c8ede09b-aarch64-linux.img) of the “new kernel” variant SD card image here https://hydra.nixos.org/build/142588923 boots from SD card (SanDisk Ultra 32GB A1) correctly to the console, but then USB peripherals cannot be used. By comparison, the most recent successful “raspberrypi4” image here https://hydra.nixos.org/build/134720986 correctly boots and has working USB. Here’s what I found. Device info: First, baseline tests with the latest Raspberry Pi OS image to establish that the device correctly boots from USB: Test 1, Raspberry Pi OS Test 2, Raspberry Pi OS Tests 3 and 4, NixOS “new kernel” with the build from https://hydra.nixos.org/build/142588923 and the same USB devices: This is the same image that, from an SD card, booted correctly to console but did not have USB. Out of curiosity, I also tested the last successful “raspberrypi4” image on both USB devices, and in both cases get a different failure, which reboots and cycles indefinitely, seen here. |
I used the Started at eeprom version "Sep 3 2020", booted the Raspberry Pi OS from sd card to confirm everything was working and it was. Put the same image on USB, tried to boot from that. It would get reasonably far but then complain of EXT4 errors, which was strange. Reset the image and tried again, same behaviour. Updated to "Feb 16 2021" via the sdcard raspbian, reset the image on the USB stick again, it booted cleanly this time. So can confirm USB boot works with their distro but did require updating the eeprom for loading that USB stick. Attempted to boot with This occurs to all three USB sticks with no difference other than the printed current device information.
Using any of the USB sticks as before has the exact same "Starting kernel ..." stopping position. Via sd card, it will boot all the way to bash, and show the bluetooth errors same as the 2GB model, but also USB doesn't work at all (as reported in another issue). I haven't changed the eeprom version on this one yet because I don't want to interfere with testing of the USB fixes yet, but tested this 8GB model just for differential comparison. |
This issue #114157 (comment) seems to indicate that USB boot has been accomplished, though I had no luck following the same steps. @LucaFulchir could you post your device & firmware info here as another data point? |
It is known that "board revision 1.4", introduced with the 8GB variant changes how USB works. This is why we can see an SD boot work, and USB does not work once booted in the Linux system. That is another issue to be investigated, but is nice having confirmation that on the equivalent setup with another board variant USB works in Linux.
This is pretty much expected, as required modules are not present in the built image; the PR adding them has been merged only yesterday. I probably should have stated in the initial post to wait a bit for testing "full" USB boot, or build your own images 😄. |
Happy to build my own image, though I do not know how. 😄 If you can provide instructions, I can help as needed with the current rpi4 related issues. |
In a Nixpkgs checkout, on an aarch64 machine. (E.g. your raspberry pi)
If there's not much to build, only assembling the final bits, it won't be as long. It probably will still take a while if it's building on an I/O starved storage media (e.g. SD cards). |
@samueldr rather a bit of a chicken and egg problem here, as I was trying to set up an aarch64 build system on the rpi... haha. I do have an amd64 nixos system though and can cross-compile if you can explain what I need to do :D |
Since cross-compilation doesn't work with workarounds still, I wouldn't recommend it for "general" testing purposes. It is usable, though, when you compare in a before/after situation. Right now when I cross-compile an SD image or ISO image I use my cross-system repository. It assumes either I assume that, for now, waiting on a build will be easier, and more valuable. |
#121720 this PR made it into a build here https://hydra.nixos.org/build/142755927 I have the image (nixos-sd-image-21.05pre287941.54fa457b258-aarch64-linux.img) from that build running on USB with everything working as expected. |
@proofconstruction sorry if I'm a bit pedantic, but "running on USB" on what hardware/eeprom combination exactly? |
@samueldr Pedantic is good! My apologies - same configuration as my first post in the thread: So, the latest change works as intended on the 8gb model pi4. |
Can confirm USB boot works with |
I'm closing this as solved booting entirely from USB should be working for at the very least the main boards from the Raspberry Pi 4 family. Status for CM4 and 400 are unknown still, but it is also unclear generally speaking what the current state is. |
The SD image works with my USB stick on Raspberry PI 4 4GB but after installing nixos and rebooting, it gets stuck on the "Starting Kernel". |
@natto1784 while it won't be "optimal", try adding This is highly likely because of two reasons that it "stays stuck" at "Starting Kernel...".
So I suspect that right now it's kind of technically working, but getting stuck unable to continue booting. As a general debugging note "Stuck at Starting kernel..." generally means the kernel has started. |
Yeah that fixes it, I don't think it is a problem about video drivers as i don't have any display servers enabled. I'll try pinning down what drivers I exactly need when i get time. Thanks |
On the Raspberry Pi family of hardware, with the mainline kernel, the console VTs require the |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/install-nixos-on-raspberry-pi-4-ssd/22788/2 |
@nixos-discourse Thanks for the link back! Looking at the screenshots above my issue is surely related. I'll try one of the build's listed above as working. I guess I could also look at getting another USB/SATA3 adapter, but my Startech USB3S2SAT3CB was purchased because it enabled the Ubuntu aarch64 image to boot properly from an SSD and run stably. I could use access to someone who knows where to find the u-boot source package that's included in the SD image so I can compare it with the one used by Ubuntu. And it would be helpful to know if there's anything in the /boot/config.txt file that I could add to increase the logging verbosity. |
I did a somewhat painful manual bisect process of all the kernel modules in boot.initrd.availableKernelModules = [
"uas"
"pcie-brcmstb"
"reset-raspberrypi"
]; EDIT: Not sure if this makes a difference of the top of my head, but I'm booting from a compressed BTRFS subvolume, so this could also be pulling in other kernel modules boot.initrd.kernelModules = ["zstd" "btrfs"]; EDIT2: And for some reason it stops working if I use the rpi 4 kernel ( |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/rpi4-cant-usb-boot-from-btrfs-with-rpi-kernel/28668/1 |
Originally posted by @domenkozar in #121720 (comment)
Let's track USB boot issues here.
First, please describe the steps you have tried exhaustively. It would be helpful if you could either provide the Nixpkgs revision used to build the image, or an Hydra link to the job for the image.
I have not yet taken the time to fully USB boot a Raspberry Pi 4 NixOS image. USB support in #121720 was tested when the initial boot firmware was present on an SD card. It was tested with the iso image and not the SD image.
Known working
Not known
Is the EEPROM firmware important? (I believe it is.)
Testing information
When testing, please describe, if possible:
Note that it is possible that not all USB drives work with the Raspberry Pi. Testing the official Raspberry Pi OS should be done to verify the board should or should not be able to boot from the drive you're using.
(cc #63720)
The text was updated successfully, but these errors were encountered: