Boot from USB or Network from backup

Hey Volumions,

I have a couple of Raspberry Pis (3B and 3B+) running volumio in the house and wanted to migrate them from booting off of the microSD slot to USB or network boot. I have a “server” RaspberryPi 4 I could use to serve up an NFS partition for them if I went that route.

I’d love to be able to do this with a basic OS image burned to microSD to make the configuration change. Neither Pi has a display connected and one of them is hardwired to the speaker cables making it difficult to pull out if needed. If there’s a configurable OS image that can do this switch without needing a network connection that would be even better.

Just wondering if anyone has any hot tips on doing this without booting them into RaspberryPiOS to make the switch? My ideal scenario would be to image the microSD cards that are installed currently and use those as the basis for the USB or NFS drive I’d be booting from for each device.

Thanks for any advice. I’ll continue researching and post back if I come up with anything useful.

Looks like my 3B+ is already able to boot from USB without reprogramming the OTP bit.

My 3B is going to require that bit to be set. Not sure if the modified version of Raspbian Volumio is based on (Jessie), forked sometime in the distant past, is going to support the OTP bootcode.

I’m a bit reluctant to do the following without some confirmation that it won’t render my pi inoperable:

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

can anyone confirm if this will work or are we going to YOLO it?

Volumio doesn’t use the upstream Raspbian initramfs, so it isn’t going to be as simple as flashing Volumio to a USB drive and it Just Works™. Since it uses a Readonly squashfs + a overlayfs, things are a bit more… involved when it comes to the intiramfs. There are some discussions over on Volumio/Build about how to support USB boot – do check them out :slight_smile:

EDIT: Links to the discussions…

1 Like

Nuts! I was afraid the answer was going to be something like this. Thanks @ashthespy, I’ll go check that out.

@ashthespy so after reading through the issue and PR it sounds to me like it’s a matter of hardcoded references to the sd card device.

Having a first class build target of a USB drive on /dev/sda feels like a relatively “easy” fix without knowing the details of Volumio’s build system, existing number of targets, and CI/CD pipeline. This would of course mean that some other configurations might not work as expected, if another mass storage device is occupying that slot or … any number of other variables.

Netboot images could be another option though would require a user to configure their nfs partitions prior to boot somehow. Maybe what we need is an external configuration tool that can write to /boot, wherever it might live.

It is admittedly a funny problem, though later versions of RaspiOS and Ubuntu seem to get it right.

@robcee Indeed - the Volumio init scripts could use some love. @gkkpch has been working on a much more modular system for the init scripts, which could be extended for the Raspberry, and should make supporting USB boot simpler. But ofcourse we need to take into account a lot of non-standard use cases such as firmware updates via USB and other such things. So can’t give you an ETA on when that lands :slight_smile:

But please feel free to explore the installer part here

1 Like

Some devices like the Khadas VIM boards vim1, vim2, vim3, vim3l can boot volumio images from usb devices without any issues.
Once we have the main lot of board build scripts moved to buster I intend to tackle the init redesign.
Though it will help for PI’s to boot from devices other than mmcblk0, the real problem starts before the kernel gets loaded, I do not know (yet) how that part works with PI.
It does not use u-boot like other arm devices we know, this part will be crucial.

1 Like

yes, afaik, it’s a UEFI bootloader, probably stored in firmware. I don’t have a strong grasp of the Pi’s bootsequence yet, but presumably it knows to look for boot partitions on the microSD (mmcblk0) and on later hardware, /dev/sd*.

I came across this the other day while researching but haven’t had a chance to dig into it: GitHub - raspberrypi/firmware: This repository contains pre-compiled binaries of the current Raspberry Pi kernel and modules, userspace libraries, and bootloader/GPU firmware..

afaik there are 2 things to be considered.
First the PI4 has to be able to boot from usb. There appear to be instructions on the raspberry knowledge sites on how to check the capability and enable it, just google.
Secondly we need to adapt the volumio boot configuration as currently Volumio assumes the boot device is always mmcblk0.
We have already prepared ways to find the Volumio device and partitions. Most of the community portings already use that when the board also offers emmc. This is not a big thing, but takes a little time and needs to be tested thoroughly, incl. OTA updating

Yup. That part we can do. There are a few good articles on it. I believe some of the later revs may come with USB boot pre-enabled. (this recent article confirms it: Booting my Raspberry Pi 4 from a USB device | ZDNet)

There are also instructions for enabling the Raspberry 3B (pre + version) USB boot.

Understood and thanks for the explanations! Let me know if you need anybody to test builds and I can help out.

Take care.

As you would with any other device, in case you want to temporarily mount it, the filesystem is ext4. Take care not to change any contents.