Can't boot from USB SSD?

Hi, Folks. I’m pretty new to balenaOS and to Linux in general so please forgive any basic gaps in my knowledge.

I’ve been trying to get my Raspberry Pi 3 B+ to boot balenaOS from an SSD drive rather than an SD card. I’m interested in doing this primarily for the reliability of the SSD rather than for speed reasons, although the speed boost is a welcome bonus. I am using a WD Green 120GB M.2 SATA SSD and a StarTech M.2 SATA Converter designed specifically for the Pi. I have confirmed that this hardware works by installing the Raspbian image with balenaEtcher and booting the Pi from it without an SD card present. This worked like a charm.

However, things are different when I install the balenaOS image. It appears to recognise the SSD attached to the USB port and even start to read files from it:

      scanning usb for storage devices... 1 Storage Device(s) found

Device 0: Vendor: WDC WDS1 Rev: UI50 Prod: 20G2G0B-00EPW0
            Type: Hard Disk
            Capacity: 114480.0 MB = 111.7 GB (234455040 x 512)
... is now current device
Scanning usb 0:1...
Found U-Boot script /boot.sccr

It then goes on to “scan mmc devices” and complain about them “not responding to voltage select”. After some other messages, it appears to start trying to PXE boot but since I don’t have a PXE server on my network, this fails and ends up with the last line U-Boot>. I expect that something has already gone wrong by this point though because I would have expected it to boot into balenaOS and show the “balenaOS” ASCII art as it does when I boot from an SD card.

Can anybody help me diagnose what’s going wrong here, please?

Hi @damianpowell ,

Thanks for getting in touch. We don’t officially support anything other than SD card booting at the moment. That said…

There are some workarounds to allow it. Your initial problem appears to be that it’s expecting to see the SD card for boot, and because there isn’t one, complains that it’s ‘not responding to voltage select’ (this is one of those ‘not so useful’ informational messages!). By default, the Raspberry Pi always attempts to boot from SD. You can alter this, but you’ll need to boot the Pi first using an SD card, make some changes to the boot config, and then reboot to set the bit. A final reboot should allow you to then plugin your USB SSD and boot from that. So:

  1. Prep an SD card for ‘normal’ booting for the balena application you want to use on your device
  2. Boot up normally, and then SSH into the host OS using the balena Dashboard (or balena-cli)
  3. Run echo program_usb_boot_mode=1 | tee -a /mnt/boot/config.txt This ensures that the Pi will now attempt to boot from USB
  4. Reboot the Pi, don’t remove the SD card
  5. SSH back into the host OS once rebooted. It should now have set the USB boot bit in the OTP
  6. Power off Pi, remove SD card
  7. Plug SSD into Pi
  8. Power on Pi

The bootcode should wait for about 5 seconds whilst it attempts to find the SD card, before instead moving onto using USB boot. However, there’s another issue now, in that you’ll balenaOS isn’t using more than 1GB of space for its data partition. There is, however, a workaround for this.

This thread: Raspberry to run resin.io from Hard disk details a way to resize the final partition (the main data partition) when booting from a USB device to ensure that all of its space is used. You’ll need to boot from USB then follow those instructions to temporarily download a new Ubuntu container to resize the data partition. After that, you should be able to reboot again.

Let us know how it goes. We’re still (I believe) intending to offer full support for USB booting eventually.

Best regards, Heds

Hi, Heds. Thanks for getting back to me.

I have performed the instructions as you described but my problem persists. I get stuck immediately after step 8; I can’t get into balenaOS in order to perform the resize of the data partition.

If I try this with Raspbian, it works fine - I get to the desktop and can see the resized data partition.

Any ideas what I can do to try to diagnose the problem more deeply?

Thanks,
Damian.

Hi. Can you check with an older version of the OS, specifically v2.31.5+rev1 and let us know if that one works for you?

Hi, Floion. Thanks for getting back to me. Any chance you could point me in the direction of a download link? I’ve found references to v2.31.5+rev1 on the forums but the CI page it links to on GitHub appears to be blank now.

Are you using balenaOS images or the cloud managed OS images? (if you are using just balenaOS the link should be https://files.resin.io/resinos/raspberrypi3/2.31.5%2Brev1.prod/image/balena.img.zip)

Thanks, @floion. That looks more promising - it gets past the console portion of the boot and displays the green balena box image. I can’t detect it with balena scan though but I guess that’s because this is the prod image rather than the dev image.

So given that this does at least boot, what’s the problem that prevents the latest image from booting?

It’s because at some point we disabled uboot to scan for USB drives. We did that for speed purposes. And we are currently discussing on how to address it

Adding to Florin’s message, I’ve found this GitHub issue that you could “subscribe to” if you are interested in getting updates, or contributing:

1 Like

Thanks, @floion and @pdcastro. I have a solution for the time being (use 2.31.5+rev1) but I look forward to a solution to issue 1575. If I get more familiar with balenaOS, I might have a go myself.

We are developing Balena Cloud using USB Boot (MSD).
Previously, USB Boot worked well.
(Of course, manual area expansion is necessary)
However, when I upgraded the version of Balena OS, it stopped working.
At the moment, we do not upgrade the version when using USB Boot.
(This is a big challenge because the operation of SuperViser differs depending on the OS)

There was definitely no problem with balenaOS 2.29.0+ rev1.

I hope that it will be improved.