# Booting from mSD card with USB drives attached on RPi4



## jorbas (Jun 18, 2021)

I've installed 13.0-RELEASE on a micro SD card to use on a 8GB Raspberry Pi 4. The Raspberry Pi 4 boots from the card just fine, but when I also attach a USB SDD enclosure and try to boot, u-boot will fail to boot the micro SD card and quickly move on to attempting to boot from USB, which will also fail because the USB drives are for storage, and then go into endless trying to boot over the network.

To work around the problem, I have to detach the USB drives, power on the Pi, wait a few seconds, and then attach the USB drives. This is really not ideal, since I want this device to be my DHCP and DNS server so it should come up without hassle.

 I've tried the 2021-04 build of u-boot, and whilst that will boot with the USB drives attached, it will then not import the ZFS pool on boot.

How can I get u-boot to not give up on the micro SD card so quickly, but still properly detect the USB drives?


----------



## HRuffalo (Jun 24, 2021)

Hi,
I actually tried this the other day and failed miserably. You cannot boot from a microSD, even in a usb adapter. I managed to get it to the boot screen, where it asks for a language, etc, before it crashed. It crashed dozens of time before reaching this screen. Idk what causes it, but i’d highly recommend buying a flash drive for this purpose instead of wasting countless hours on it. Hope this helps you.


----------



## Alain De Vos (Jun 25, 2021)

I think you can boot from a microSD if you use a microSD to USB converter. So it will boot from "USB"


----------



## astyle (Jun 27, 2021)

jorbas said:


> I've tried the 2021-04 build of u-boot, and whilst that will boot with the USB drives attached, it will then not import the ZFS pool on boot.


Off the top of my head, I'd suggest looking at options offered by u-boot. Maybe on the screen you attached to your Pi, maybe on the project's web page... There might be something for fine-grained control like timing. I know I sound like the BOFH who tells users to RTFM, but I still would encourage reading the manual, and be able to stop and think at any given step...


----------



## hardworkingnewbie (Jun 27, 2021)

This sounds quite like your external USB drives have no own power supply, and instead use the power provided by the Raspi. The Raspi is not meant to be able to power USB drives on its port. If that's really the case, try switching over to USB drives with external power supply instead, or use an external HUB with own power supply. 


Please also note that the Raspi is an ARM based computer, and has no BIOS. In order to boot correctly it needs an inserted SD card with the proper files in place. If that's not there, it will not boot.


----------



## bakul (Jun 28, 2021)

Raspi4 allows booting from various devices as well as netbooting and you can set the boot order. See https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md
linux and plan9 boot directly, while freebsd relies on uboot so it would need to do the right thing as well.


----------



## jorbas (Jun 28, 2021)

hardworkingnewbie said:


> This sounds quite like your external USB drives have no own power supply, and instead use the power provided by the Raspi. The Raspi is not meant to be able to power USB drives on its port. If that's really the case, try switching over to USB drives with external power supply instead, or use an external HUB with own power supply.
> 
> 
> Please also note that the Raspi is an ARM based computer, and has no BIOS. In order to boot correctly it needs an inserted SD card with the proper files in place. If that's not there, it will not boot.


I think you misunderstand my question, I am *not* trying to boot from USB and I am *not* trying to get rid of the microSD card. I want to boot from microSD _whilst there are USB storage drive(s) attached_. For the record, the enclosure *does* have its own power supply.



bakul said:


> Raspi4 allows booting from various devices as well as netbooting and you can set the boot order. See https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md
> linux and plan9 boot directly, while freebsd relies on uboot so it would need to do the right thing as well.


The Raspberry Pi's boot order is correct, it launches u-boot from the microSD card, but u-boot is not doing the right thing, and my precise question is how to configure u-boot to do the right thing.



astyle said:


> Off the top of my head, I'd suggest looking at options offered by u-boot. Maybe on the screen you attached to your Pi, maybe on the project's web page... There might be something for fine-grained control like timing. I know I sound like the BOFH who tells users to RTFM, but I still would encourage reading the manual, and be able to stop and think at any given step...


There indeed might be, but it was certainly not obvious, at least not to me, when I searched for any thing like this, in the documentation, the mailing list, and the internet as a whole. Either way, I don't particularly have the time to be diving into bootloader code if there is not some straightforward way of configuring u-boot.



HRuffalo said:


> Hi,
> I actually tried this the other day and failed miserably. You cannot boot from a microSD, even in a usb adapter. I managed to get it to the boot screen, where it asks for a language, etc, before it crashed. It crashed dozens of time before reaching this screen. Idk what causes it, but i’d highly recommend buying a flash drive for this purpose instead of wasting countless hours on it. Hope this helps you.


Although it should be unnecessary, it boots fine from a microSD card by itself after all, I think putting FreeBSD on a USB device and booting from that might be the simplest solution here...


----------



## Alain De Vos (Jun 28, 2021)

Or make sure the Boot record is unbootable/Cleared so it gets skipped.


----------

