Booting a converted image from USB

Hello -

I would very much like to use Mender to manage a fleet of RPi4 things that will sporadically connect via cell modem and (less often) Wifi. SD cards are too slow for a satisfactory uesr experience, and so we are using fast USB devices. The delta update capability is important.

I’ve spent the past week or two learning how to connect devices to Mender Hub, creating and updating via artifacts, and mender-converting our .img files.

What I can’t figure out how to do is to get the RPi4 to boot from a converted img file that is copied to the USB stick using the RPI imager. I’ve tried adding a 'MENDER_STORAGE_DEVICE=/dev/sda ’ --config file to the mender-convert options with no success.

I would think lots of folks are (or want to be) booting RPis from USB, but can’t find much about doing this other than Pi3 USB boot support.

Any help would be greatly appreciated.

1 Like

I haven’t tested this with raspberry pi, but for general booting from various media in a kernel name agnostic way, I use the partuuid feature of mender config to reference boot devices and its partitions, usb booting being one of the motivations for my developers to easily test iterations.

@dellgreen Thanks for the pointer - this makes sense. I will try to make this work for me.

Hello -

So I tried mender-convert with the raspi lite image, and a config file that includes:

MENDER_STORAGE_DEVICE = “/dev/sda”
MENDER_STORAGE_DEVICE_BASE = “${MENDER_STORAGE_DEVICE}”
MENDER_BOOT_PART = “${MENDER_STORAGE_DEVICE_BASE}1”
MENDER_ROOTFS_PART_A = “${MENDER_STORAGE_DEVICE_BASE}2”
MENDER_ROOTFS_PART_B = “${MENDER_STORAGE_DEVICE_BASE}3”
MENDER_DATA_PART = “${MENDER_STORAGE_DEVICE_BASE}5”

The conversion without the above and put on an SD card boots fine, but a conversion with the above and put on a USB stick doesn’t boot. The Pi will boot from other USB sticks.

I’m hoping this is obvious to those who know, but I am yet in that group.

Any help would be very welcome.

I spent more time tracking down this issue, and my current thinking is that the challenge is in the u-boot boot.scr. Even when setting the MENDER_STORAGE_DEVICE etc. as /dev/sda, the u-boot boot.scr has:

mmc dev ${mender_uboot_dev}

where the mmc tries to load the image from an SD card, which I’m trying to not use.

Are there switches or config files where I can get the boot.scr file generated with the needed USB command, e.g.

ums 0 usb 1:2?

Or is the expectation that there will always be an SD card for the U-boot, which might then point to an USB drive for the second A/B images?

Thanks!

This is not a requirement for Mender. In fact, in most cases U-Boot and the A/B images are on the same drive. Raspberry Pi is a bit of a special case since it has custom compiled U-Boot which is downloaded during the image conversion process. I think this is hard coded to point to the SD card.

You could try to change this to “usb”, recompile U-Boot, and then change the link for the U-Boot binary to point to a local file before you convert a new image.

Did you ever manage to figure this out? I’m trying to migrate from SD card to USB but have hit the same issue on CM4.

Thank you.

2 Likes

Having same issue here. Tried a lot of different ways but cannot get it work. Anybody solved the issue?