Boot RPI 4B from USB

Issue: USB Boot

Setup: TTN

Server: RPI 4B 4G with 2287 and stock downloaded firmware.

Details: I had my gateway up for less than 24 hours and then it hung. I’m pretty sure it was a SD card failure. Rather than fight running postgresql on SD card, I want to boot from USB.

I’ve made several attempts but not have yielded a successful configuration.

Do you have available:
Instructions on how to do this?
Firmware that will boot from USB.

Please note that the RPI has been upgraded to boot from USB and will boot Raspbpian/Raspberry Pi OS successfully.

Thank you,

Darren

I haven’t tried a USB stick but as they and SD Cards tend to use NAND flash with various approaches for read/write but in theory shouldn’t really be that much different. My torture/test Pi on my desk is a Pi4 with a M.2 adapter to provide a SanDisk 64GB SSD as the main drive, so this is very achievable and very affordable as eBay has many smaller M.2 SSD’s at a reasonable price.

This isn’t really a RAK question, but for what it’s worth, I’ve quite a few Pi’s being very well exercised, three with RAK boards on top and none have killed the SD Card. The oldest Pi is the intranet server and is a v1, so the card is pretty ancient. I fly High Altitude Balloons that have multiple logs, write temp files for the transmitted images and save a sequence of low & hi-res files constantly. We usually have them run for a few days to soak test a new rig. I only use SanDisk or Samsung cards, class 6 or above.

You can mitigate the read/writes by moving the log files to RAM disk and have them write to flash at reboot or periodically. Depending on how big your Pi memory is, you can do the same with the database files. As it’s on a network, the other option is to setup a network share on something else and have the database files on there - not brilliant for overall system efficiency but as there shouldn’t be a huge amount of database work, this is an OK solution too.

There are numerous entries on the internet about alternative ways to boot a Pi, but they do have complications depending on which Pi and how you ask it to boot - to the extent you need to be careful you don’t permanently turn a Pi in to a USB only device. This is less of a problem with a Pi4 due to the boot rom style. The official details here:

These will explain how to move ANY Pi image to the storage of your choice.

Hi,
I wasn’t specific enough. I am using a SATA SSD on a USB 3 adapter. For long term stability, I would not want to run a full OS on either a SD Card or USB thumb drive.

I brought this to the forum because the existing firmware will boot on SD, but when I install it on the SSD, the boot fails with an error about needing modern firmware. I have, of course, attempted to simply replace old files with new ones, but that got more and more dependency laden and I decided I was barking up the wrong tree.

I hoped that someone at RAK had firmware that would boot on the SSD.

My Pi 4s will boot from SD even after the upgrade/mod to boot from USB also.

Thanks for your help!

Darren

Hei @DGEllis,

Would it be acceptable to do a workaround. Install a fresh Raspberry Pi OS, clone the RAK repo and voila, that should be sufficient to get it working with TTN?

Regards
Vladislav

Absolutely,

I’ll begin that right now.

Thank you,

Darrne

Whilst I’d go with the working RPOS as @Hobo suggested, if installing from GitHub causes issues, you could try updating your “working from the SD card” image with sudo apt dist-upgrade" which will force everything to the very latest from RPi.

Also, I partition my SSD so I just need to edit the cmdline.txt file - or in actual fact, swap as I have several partitions - to boot a different image on the SSD. This requires that the Pi does its initial boot from the SD card, but once it boots, it never reads it again.

Hi Nick,

Have you used the UEFI firmware from Tianocore/EDK2? PBatard develops, publishes and maintains a RPI 4B branch that is pretty good. My preferred linux distributions are in the Red Hat world, so I’m using it to test Fedora 33.

Thanks for the clues!

Darren