1

I am trying to boot the OS on a Raspberry Pi 3B+ by using an external SD reader connected via USB cable. As far as I understood by launching lsblk, the SD reader is mounted in /dev/sdb.

So, I have changed the file cmdline.txt in the SD card and I have set root=/dev/sdb1.

However, when I switch on the Raspberry nothing seems to be loaded. Even if I am not sure this is useful, I have also tried to add program_usb_boot_mode=1 into the config.txt file, but it seems to have no effects.

Could you please suggest me what to check to make the SD card bootable from the SD reader connected?

The Raspberry Pi is inside a clock which is exposed outside a building. In order to make the SD card more easily accessible, I was suggested to use an external reader in order to avoid to disassemble the whole clock each time a software update is necessary.

Jan. 28th Update

I wrote a new Raspbian Lite image into an USB drive. When I plug it into the Raspberry and I switch this latter on, I still don't see anything in the connected display but I noticed that both the LEDs in the front panel are switched on, now (when I was trying to boot from the SD reader, only the red LED switched on). What does this mean?

3
  • 2
    why would the only usb drive be /dev/sdb rather than sda? also, if you have a regular raspberry pi image on a USB drive, root would be /dev/sdb2 since that's how raspberry pi works. In reality, one would never use /dev/sdx# anyway ... far safer to use root=PARTUUID=xxxxxxxx-02 like the standard install does - that way, the drive "device" can be sda, sdb, sdc, whatever, but since the PARTUUID would be unique, the correct device would be mounted as root regardless Jan 28, 2023 at 8:54
  • 1
    @JaromandaX, I was not aware of the meaning of PARTUUID and so I thought it was necessary to update the root field with the path to the SD card plugged in the external reader. So, for now, I reverted to the original PARTUUID, even if the issue still persists. Jan 28, 2023 at 16:31
  • Note that the Pi 3B+ can indeed boot from a USB SD card reader, as shown by this question, 3B+ will boot from USB (microSD to USB adapter) and not from the microSD card itself. Therefore, I would posit that the USB SD card readers used by @Milliways and yourself have some weird quirk (either using old and slow USB 1.1 ICs or whatever), or that they are just different in some other way. Jan 29, 2023 at 21:10

3 Answers 3

2

If you have a Pi 3B+, then you shouldn't need to do anything as USB boot is already supported "out of the box".

Only for a "standard" Pi 3B should you need to configure config.txt...

From USB-Mass Storage Boot - Raspberry Pi 2B, 3A+, 3B, CM3, CM3+, Zero 2 W

Enable USB host boot mode with this code:

echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt

...

The next step is to reboot the Raspberry Pi with sudo reboot and check that the OTP has been programmed with:

vcgencmd otp_dump | grep 17:
17:3020000a

Check that the output 0x3020000a is shown. If it is not, then the OTP bit has not been successfully programmed. In this case, go through the programming procedure again. If the bit is still not set, this may indicate a fault in the Raspberry Pi hardware itself.

If you wish, you can remove the program_usb_boot_mode line from config.txt, so that if you put the SD card into another Raspberry Pi, it won’t program USB host boot mode. Make sure there is no blank line at the end of config.txt.

You can now boot from a USB mass storage device in the same way as booting from an SD card - see the following section for further information.

One important thing to check is that there is no blank line at the end of config.txt.


Maybe remove the changes that you made to config.txt and see if it works.

Further troubleshooting steps

If the USB SD card reader continues to fail to boot, run some other tests:

  1. Check if a standard USB drive works (rather than the SD card reader). As a sanity check, try to boot from a standard USB drive/stick
  2. Maybe the SD card reader is somehow incompatible - try a different card reader
  3. If the Pi can see the card reader as sdb... then boot with one working SD card in the on board SD slot and then try to write to another second SD card in the USB SD card reader. Verify that it is actually possible to save and read a file on that second SD card in the USB SD reader
  4. Try a different USB port.

Basically, just try swapping things around...

Notes on defective (or incompatible) USB SD card reader

As has finally been shown - after the first troubleshooting step demonstrated that a USB stick or drive is bootable - it is the USB SD reader that fails to boot. This indicates that the USB SD card reader is at fault, or incompatible in some way... and thereby suggesting that all USB SD card readers are not bootable and should be avoided.

However, this isn't actually 100 % true...

The Pi 3B+ can indeed boot from a USB SD card reader, as shown by this question, 3B+ will boot from USB (microSD to USB adapter) and not from the microSD card itself. Therefore, I would posit that the USB SD card readers used by @Milliways and yourself have some weird quirk (either using old and slow USB 1.1 ICs or whatever), or that they are just different in some other way.

Enumeration issues

As a slightly distracting side note, there is an additional issue that could be at play, and that is USB port enumeration, where another USB device causes the first USB device to fail... as suggested in this comment on 3B+ will not boot from USB:

It may be enumerating by port number, you can try swapping them around. IIRC the port closest to board and Ethernet jack is 1. On running system you can tell port numbers with dmesg.

Admittedly, in that question the issue seemed to be a power issue, when an Apple USB device was also connected.

However, I have seen enumeration issues on a Pi 4, which caused a USB to Ethernet adapter fail, when a USB drive is also connected. The solution was to install usb-modeswitch and create/run a service, to re-enumerate the ports correctly.

However, this probably doesn't apply in this particular case, as no addtional USB devices were (presumably) connected.

4
  • 1
    I restored the config.txt file to default and also the cmdline.txt file (by reverting to the original PARTUUID field). When the SD is in its socket, the OS loads properly but when I try to do the same via the external reader, the OS doesn't boot. I also tried an external USB power supplier (maybe the external reader is a bit more energy consuming) but nothing changed. Maybe should I try to use a new OS image? Jan 28, 2023 at 16:21
  • I don't think that a new OS image would help, but you could try it as an additional bit of troubleshooting, if all else fails. However, the fact that the existing image on the SD card boots in the built in SD card slot sort of implies that the SD card (and the OS image upon it) is not the problem. Personally, my money would be on the config for the USB boot being incorrect, as the most likely... followed by a strangely incompatible USB reader (although this would seem unlikely, but it's possible). I would first try to boot from an external USB drive, or even a USB stick, as a sanity check. Jan 28, 2023 at 19:30
  • 1
    I wrote a new Raspbian Lite image into an USB drive. When I plug it into the Raspberry and I switch this latter on, I still don't see anything in the connected display but I noticed that both the leds in the front panel are switched on, now (when I was trying to boot from the SD reader, only the red led switched on). What does this mean? Jan 28, 2023 at 22:51
  • 1
    First, thank your for your useful suggestions. The issue I described in the previous comment was due to some corrupted files in the boot partition (I forgot to sync the writing of the disk image into the USB stick) and I solved it repeating the disk image writing. Anyway, I didn't face any further issue while using the USB stick, so I suppose that the SD card reader is the root of the issue of my question, as you anticipated and also @Millways confirmed in his answer. Jan 29, 2023 at 13:06
1

Running 'Bookworm'on a 4GB Pi 4B with a 'Sense HAT', a USB boot was unreliable until the Pi had a genuine Pi4 PSU and the USB key was on a powered hub. With the dual power supply, the system is stable. As the boot device is a stick rather than a card reader, this might not be relevant but it suggests that providing some more power could be worth a try.

2
0

The boot code is stored in the BCM2837 device in a small boot ROM. https://www.raspberrypi.com/news/pi-3-booting-part-i-usb-mass-storage-boot/

While this supports USB boot it is unlikely it supports booting from a USB mounted SD Card reader. (The code is not open so this is speculation but I did try on my Pi3B+ and NOTHING happens - it appears to load startup code but no OS.)

If you WANT to boot from USB then use a USB memory stick.

AFAIK USB boot on the Pi3B+ only works is there is no mounted SD Card, so you would need to access the Pi to remove it.

NOTE your Question (including the detail in Comments which belongs IN the question) implies a number of misapprehensions:-

  • There is NO NEED to remove a SD Card to update; I do all my updates on the Pi and only remove the cards to install a new distribution every 2 years.
  • If you are running an application which works WHY do you feel the need to remove each time a software update is necessary. If the application works, only perform essential security updates if exposed to internet.
3
  • 1
    If you haven't heard, there's this thing called agile that's all the rage. It involves releasing things that don't fully work, and are full of bugs, while showing enough functionality that the user does not go to an alternative, and providing frequent updates to stay competitive, taking advantage of the hope that the fix will arrive in a few weeks.
    – Abel
    Jan 29, 2023 at 1:35
  • 1
    Very interesting. It is very odd that a USB drive or stick works, but not a SD card reader - which, to all intents and purposes, should behave like a USB drive or stick. I wonder if there is a timing issue, or latency introduced by having additional circuitry in the USB reader which interfaces the SD card to the USB port? Very odd indeed... I wonder if it is due to a USB 1.1 vs USB 2.0 SD card reader (i.e. speed). It almost warrants a follow up question asking why? Jan 29, 2023 at 13:10
  • @Milliways, thank you for your answer. Just to add a comment to the last two points, with the Raspberry Pi in question, I faced several times a potential bug of the BCM2837 which occasionally makes the Wi-fi module stop working. As far as I understood at that time, it was expected to resolve this bug in the next Raspbian OS release and that is the main reason for which the use of an external SD card reader was discussed. Maybe, did something change in the meantime? Jan 29, 2023 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.