Raspberry Pi 4 / 400 Ubuntu USB Mass Storage Boot Guide

Ubuntu Server 20.04 + Raspberry Pi
Ubuntu Server 20.04 + Raspberry Pi

Official support from Canonical for the Raspberry Pi has come a long way. We can now install officially supported Ubuntu on the Pi! In my previous guide for Ubuntu 18.04 on the Pi the Raspberry Pi was not officially supported yet and to be honest the experience was pretty janky.

The previous LTS “unofficial” release had so many problems I actually rolled my own image with dozens of fixes to common ailments before I quickly realized that maintaining a Linux distro, even in such a limited capacity as patching in and distributing fixed binaries, was a monumental undertaking.

Fortunately the current Ubuntu 20.04 LTS release is officially certified for the Raspberry Pi. This combined with Ubuntu’s full 64 bit userland/system environment allows you to take full advantage of the 8 GB Pi’s memory without per-process 3GB memory limits (very useful if you are doing something like running a Minecraft server and want to allocate almost all of the 8 GB to it) means there has never been a better time to give Ubuntu a try on the Pi.

This guide takes it a step further and shows you how to get Ubuntu 20.04 / 20.10 / 21.04 / etc. working with a SSD. Let’s get started!

Equipment Used

Kingston A400 SSD
Kingston A400 2.5″ SATA SSD

The Kingston A400 has been a great drive to use with the Pi for years. It’s reliable, widely available around the world, has low power requirements and performs very well. It’s also very affordable. This drive has been benchmarked over 1000 times at pibenchmarks.com and is the #1 most popular SSD among the Pi community!

Links: AliExpress*, Amazon.com*, Amazon.ca*, Amazon.com.au*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.se*, Amazon.sg*

StarTech 2.5" SATA to USB 3.0/3.1 Adapter
StarTech 2.5″ SATA to USB 3.1 Adapter

The USB 3.1 variant of the StarTech 2.5″ SATA adapter works well with the Pi 4. The USB 3.0 variant doesn’t have firmware updates available and is not recommended.

Links: Amazon.com*, Amazon.ca*, Amazon.com.au*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.se*, Amazon.sg*

NVME Option (powered USB hub required, see “Power Requirements” section in my more generalized Raspberry Pi 4 USB booting guide):

Samsung 970 EVO NVMe SSD
Samsung 970 EVO Plus NVMe SSD

The Samsung 970 EVO Plus is a fantastic drive and has fallen in price substantially. It’s widely available around the world. The smaller capacities (such as the 250GB version) of this drive are perfect for the Pi! This is the top performance option without going into the “Pro” series of the lineup which are much more expensive.

Links: AliExpress*, Amazon.com*, Amazon.ca*, Amazon.com.au*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.se*, Amazon.sg*

ASUS ROG Strix NVMe Enclosure
ASUS ROG Strix Enclosure

If you really want to take things over the top the ASUS Rog Strix M.2 NVMe enclosure uses the latest USB 3.2 Gen2 specification, is RGB capable and works with the Pi! Unsurprisingly, adding the extra lighting does take extra power! A powered USB hub is also required for this enclosure. More widely available than the ICY BOX but tends to be on the expensive side.

Links: AliExpress*, Amazon.com*, Amazon.ca*, Amazon.com.au*, *Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.se*, Amazon.sg*

Prerequisites

Verify Power Supply Size (3.5A strongly recommended)

Check your Raspberry Pi’s power supply size and make sure it is delivering at least 3.5A. There are a lot of USB C adapters for the Raspberry Pi that are only 3.0A. These will typically work fine, until you plug in something like a SSD which draws power from the Pi and there is nothing left to give.

Most SSDs are quite power efficient but HDDs draw significantly more. Older generations of SSDs used quite a bit more power than newer ones as well. If you are using an older drive or a drive that you know is power hungry you need to pay extra attention to having a quality power source with plenty of capacity.

A good alternative option to relying on the Pi to power the drive is using a powered USB hub* so your drive doesn’t need to draw power from the Pi’s limited power budget. Make sure you get one that is compatible with the Pi as some powered USB hubs won’t work properly with it so check the reviews and do your research to make sure people are using it successfully with the Pi.

Using a 3.5A power supply* or powered USB hub* will ensure your drive is getting enough power without impacting the Pi’s stability.

Recommended Power Solutions

Sabrent Powered USB Hub
Sabrent Powered USB 3.0 Hub

The Sabrent powered USB hub delivers a whopping 2.5A of dedicated power for your USB attached devices. This is almost as much as the Pi adapter itself is rated for (3.0A). It will easily power the most thirsty of setups such as NVMe enclosures.

Links: Amazon.com*, Amazon.ca*, Amazon.com.au*, Amazon.co.uk*, Amazon.es*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.se*

Note: Make sure Amazon doesn’t try to take you to the non-powered version and that it’s the one with the AC adapter that plugs in to provide extra power

CanaKit 3.5A Power Adapter
CanaKit 3.5A Power Adapter

The CanaKit 3.5A adapter has an extra half an amp (500 mA) of capacity to give some breathing room to your accessories. This is bigger than the official Pi power supply which provides 3.0A.

Links: Amazon.com*, Amazon.ca*, Amazon.com.au*, Amazon.sg*

Verify Storage Adapter Compatibility

You will need a USB 3.0 storage adapter. See my other article on USB booting not specific to Ubuntu for a lot more details on the storage adapters!

Get Latest Raspbian & Updates

To update your bootloader / firmware you should use Raspbian on a SD card. Right now support in third party operating systems to do anything with the new Raspberry Pi 4’s firmware or bootloader is very limited / nonexistent. You can use a third party operating system later once you set the boot mode, but to actually make these changes we will use official Raspbian.

First make sure that you have the absolute latest updates and firmware for the Pi. To upgrade all your packages and firmware to the latest version use the following command:

sudo apt update && sudo apt full-upgrade -y

Once the update has completed restart your Pi with a sudo reboot command to apply the latest firmware / kernel updates.

Verify EEPROM Bootloader is up to date

We can check if your Pi’s bootloader firmware is up to date with the following command:

sudo rpi-eeprom-update

If your Raspbian is *very* out of date you may not have this utility and can install it using:

sudo apt install rpi-eeprom

The output from rpi-eeprom-update will look like this if you are not up to date:

BCM2711 detected
VL805 firmware in bootloader EEPROM
*** UPDATE AVAILABLE ***
BOOTLOADER: update available
CURRENT: Thu 3 Sep 12:11:43 UTC 2020 (1599135103)
LATEST: Tue 24 Nov 15:08:04 UTC 2020 (1606230484)
FW DIR: /lib/firmware/raspberrypi/bootloader/beta
VL805: up-to-date
CURRENT: 000138a1
LATEST: 000138a1

If it says any updates are available they be installed manually by adding ‘-a’ to the end of our previous command like this:

sudo rpi-eeprom-update -a

After the updates finish installing restart your Pi as firmware updates will not be applied until after a reboot. Now if you run rpi-eeprom-update to check for updates again it should say you are on the latest and up to date!

Changing rpi-eeprom’s Release Channel

Note: As of February 16th the firmware available in the “critical” branch is new enough to USB boot so I no longer recommend changing this. One reader even let me know in the comments that on the “stable” channel his storage was getting corrupted prompting a full reinstall!

By default you will only receive updates from Raspbian’s “critical” channel. This is a very conservative firmware update channel that will only give you very well tested firmware updates that are considered critical fixes for the device. Another channel that is available is “stable”.

Carlos and other commenters have reported that the current “critical” firmware didn’t work for them and they had to upgrade to the “stable” channel.

To switch to the stable channel we are going to edit the file /etc/default/rpi-eeprom-update:

sudo nano /etc/default/rpi-eeprom-update

Change the line FIRMWARE_RELEASE_STATUS=”critical” to:

FIRMWARE_RELEASE_STATUS="stable"

Now you can run sudo rpi-eeprom-update and you should see a new update available.

Install Ubuntu on USB Storage Device

The new official Raspberry Pi imaging tool is really good. It’s available on Windows, Linux and MacOS and is a small and fast download. It also works fine on most USB mass storage devices like SSDs. Since Ubuntu is now officially supported the image itself is also available in this tool which saves you the trouble of having to find and download the right image files.

64 bit images are recommended for the Pi 4 for better performance but the 32 bit images work as well.

If you want to do things the traditional way you can download the image from the main Ubuntu site and write it yourself using Etcher / dd / Win32diskimager / your preferred tool and skip to the next section. It’s recommended to create the media with the Raspberry Pi Imager unless you are having problems with that utility or are using this as a troubleshooting step.

Once you’ve downloaded the tool run it as administrator/sudo to avoid permission errors. To run the utility from the command line is usually sudo rpi-imager. You’ll be greeted with this screen:

Raspberry Pi Imager - Main Menu
Raspberry Pi Imager – Main Menu

Next click the “Choose OS” button:

Raspberry Pi Imager - OS Menu
Raspberry Pi Imager – OS Menu

Ahh, the benefits of being officially supported! Ubuntu is right there on the list waiting for us. Select the Ubuntu option and you will get the different choices of flavors/architectures. There’s Ubuntu Desktop, Ubuntu Server, and Ubuntu Core in various forms of 64-bit (arm64) and 32-bit (armhf).

If you want to use the out-of-the-box Ubuntu Desktop edition you need to use the 64 bit Ubuntu 20.10 image as they never made a 20.04 desktop version for some reason. This really isn’t usually a big deal though because you can always choose the “Server” version and install Ubuntu’s desktop environment later with:

sudo apt install ubuntu-desktop

Once you’ve selected the edition you want go ahead and pick the “Choose SD Card” option and write the image. Despite not being a SD card my USB mass storage devices showed up anyway (writing the guide I used a StarTech adapter and a Kingston A400 SSD).

I’m sure some of you will manage to find unusual devices and configurations that may not show up in this tool. It doesn’t appear to show “fixed drives” that are physically installed in your machine. Regardless if it is causing a headache you may need to do it the old fashioned way and download the image from the main Ubuntu site and write the image using your favorite imaging tool instead.

Modifying Ubuntu for USB Booting

We need to make some changes to the Ubuntu drive we just created before we boot from it. Make sure your Pi is powered on and booted into Raspbian then plug in your newly imaged Ubuntu drive. We are going to make the changes using the Pi.

Find and Mount Storage Device

First let’s find your storage device using the command:

lsblk

This will show you all the storage devices attached to your system:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 119.2G  0 disk 
├─sda1        8:1    0   256M  0 part 
└─sda2        8:2    0   2.8G  0 part 
mmcblk0     179:0    0  59.5G  0 disk 
├─mmcblk0p1 179:1    0   256M  0 part /boot
└─mmcblk0p2 179:2    0  59.2G  0 part /

Your SD card will always start with mmcblk so you can rule that one out. That leaves sda as the only other disk device on the system. This will be the same for most of you but depending on what type of drive and storage adapter you use this can vary. You can substitute whatever yours is in place of /dev/sda in these instructions going forward. If yours is sdb use /dev/sdb. If it’s nvme0 use /dev/nvme0, etc.

In my output under the “MOUNTPOINT” column you can see it is blank. This means the drive isn’t mounted on my system. My mmcblk0p1 mountpoint though is not blank and is “/boot” as an example of a non-blank mountpoint. If you are using the full “Desktop” version of Raspbian it may have automatically mounted your drive and created 2 shortcuts on your desktop that will take you to the files. If your mountpoint is not blank and has something like /media/pi/writable go ahead and unmount them now using the following commands substituting the mountpoint listed for your drive:

sudo umount /media/pi/writable
sudo umount /media/pi/system-boot

Now we are going to create two mountpoints and mount the Ubuntu drive. Use these commands substituting your own drive it is not /dev/sda:

sudo mkdir /mnt/boot
sudo mkdir /mnt/writable
sudo mount /dev/sda1 /mnt/boot
sudo mount /dev/sda2 /mnt/writable

Once you have mounted everything correctly your lsblk command’s output should look like this with the mountpoint field now populated:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 119.2G  0 disk 
├─sda1        8:1    0   256M  0 part /mnt/boot
└─sda2        8:2    0   2.8G  0 part /mnt/writable
mmcblk0     179:0    0  59.5G  0 disk 
├─mmcblk0p1 179:1    0   256M  0 part /boot
└─mmcblk0p2 179:2    0  59.2G  0 part /

Modify Mounted Partitions – Option A – Automated Script

If you just want to get your Ubuntu partition bootable I have made an automated script to do this. As long as you have mounted the partitions as /mnt/boot and /mnt/writable the script will make the necessary changes for Ubuntu 20.04 / 20.10 to boot! The source code for the script is available at https://github.com/TheRemote/Ubuntu-Server-raspi4-unofficial/blob/master/BootFix.sh

Here is a one liner to run the script:

sudo curl https://raw.githubusercontent.com/TheRemote/Ubuntu-Server-raspi4-unofficial/master/BootFix.sh | sudo bash

You may also download it for inspection (such as nano BootFix.sh or opening it in the Text Editor if you are using Desktop Raspbian) with:

curl https://raw.githubusercontent.com/TheRemote/Ubuntu-Server-raspi4-unofficial/master/BootFix.sh -O BootFix.sh
chmod +x BootFix.sh
nano BootFix.sh

To execute the script use:

sudo ./BootFix.sh

As long as you mounted your partitions correctly it will modify the partition and tell you that it was successful. Now unmount your partitions with the following commands:

sudo umount /mnt/boot
sudo umount /mnt/writable

You may now shut down your Pi and remove the SD card from the Pi leaving just the USB mass storage device plugged in. Reconnect the power.

Modify Mounted Partitions – Option B – Manual Instructions

See bottom of the article for the manual instructions section

First Boot

If all went well the system should boot up into Ubuntu’s logon screen! The default credentials are:

Username: ubuntu
Password: ubuntu

Before logging in for the first time you will be forced to select a new password. Once you have done that you will be fully logged in!

Important Note: Upon logging in for the first time if the Pi is connected to the internet Ubuntu will immediately/soon start a lengthy update process via snapd and apt.  This can be annoying since you'll be ready to start configuring the system and if you do an apt install it will halt and wait for the updates to finish.  

It may seem like they're stuck, but if you use the 'top' command you will see all sorts of apt/package/update/extraction related activity happening.  Even on my 8 GB Pi and a gigabit fiber connection these took a good 20 minutes or so before my CPU activity went back to 0 and the apt lock released.

I highly recommend letting these finish and not yanking the power on the Pi / forcing a reboot / trying to kill the processes.  It will often cause a ton of very nasty apt and dpkg problems to the point where it's easier to start over from a fresh image than try to fsck and apt install --fix-broken your way out of it  Try to do other necessary configuration that doesn't involve apt in the mean time and let these finish in the background.

Once the patching is finished your shiny new Ubuntu 20.04 system is fully ready to use!

Manual Instructions

These are the manual instructions to recreate what the automated script does. If you used the automated script you don’t need to do anything further in this section unless you want to understand more about how it works or you want to do the process manually.

Decompress the kernel

We need to decompress the kernel as we will be changing the way the Pi is booting. Ubuntu uses u-boot by default and we will be switching away from that. We can do this with the following command:

zcat -qf "/mnt/boot/vmlinuz" > "/mnt/boot/vmlinux"

Update config.txt with correct parameters

Now let’s update /mnt/boot/config.txt with the parameters we need to load the decompressed kernel. Open up config.txt with nano with:

sudo nano /mnt/boot/config.txt

Change the [pi4] section to the following contents:

[pi4]
max_framebuffers=2
dtoverlay=vc4-fkms-v3d
boot_delay
kernel=vmlinux
initramfs initrd.img followkernel

Create script to automatically decompress kernel

We are going to create a script to automatically decompress the kernel. If we don’t do this we have to decompress it every time Ubuntu updates. This particular part of the script was not written by me and was found at the post on the Raspberry Pi forums by egrechko.

First let’s create the decompression script. Open up a new file with nano using:

sudo nano /mnt/boot/auto_decompress_kernel

Paste the following contents:

#!/bin/bash -e
# auto_decompress_kernel script
BTPATH=/boot/firmware
CKPATH=$BTPATH/vmlinuz
DKPATH=$BTPATH/vmlinux
# Check if compression needs to be done.
if [ -e $BTPATH/check.md5 ]; then
   if md5sum --status --ignore-missing -c $BTPATH/check.md5; then
      echo -e "\e[32mFiles have not changed, Decompression not needed\e[0m"
      exit 0
   else
      echo -e "\e[31mHash failed, kernel will be compressed\e[0m"
   fi
fi
# Backup the old decompressed kernel
mv $DKPATH $DKPATH.bak
if [ ! $? == 0 ]; then
   echo -e "\e[31mDECOMPRESSED KERNEL BACKUP FAILED!\e[0m"
   exit 1
else
   echo -e "\e[32mDecompressed kernel backup was successful\e[0m"
fi
# Decompress the new kernel
echo "Decompressing kernel: "$CKPATH".............."
zcat -qf $CKPATH > $DKPATH
if [ ! $? == 0 ]; then
   echo -e "\e[31mKERNEL FAILED TO DECOMPRESS!\e[0m"
   exit 1
else
   echo -e "\e[32mKernel Decompressed Succesfully\e[0m"
fi
# Hash the new kernel for checking
md5sum $CKPATH $DKPATH > $BTPATH/check.md5
if [ ! $? == 0 ]; then
   echo -e "\e[31mMD5 GENERATION FAILED!\e[0m"
else
   echo -e "\e[32mMD5 generated Succesfully\e[0m"
fi
exit 0

Create apt script to call kernel decompression script automatically

This is a one liner to create a script to call the auto_decompress_kernel script:

echo 'DPkg::Post-Invoke {"/bin/bash /boot/firmware/auto_decompress_kernel"; };' | sudo tee /mnt/writable/etc/apt/apt.conf.d/999_decompress_rpi_kernel

Verify Drive Performance

You can make sure everything is running correctly (and as fast as it should be) by running my quick storage benchmark. You can run the benchmark with the following one-liner:

sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash

This will give you a score you can compare to the other Raspberry Pi Storage Benchmark results and make sure that you are getting an equivalent speed to your peers with the same device!

Fix (some) USB Adapter Problems Using Quirks

Some storage adapters don’t work very well with the Raspberry Pi 4. There is an option that can get a lot of them working using quirks. If your Ubuntu is booting to emergency mode but not in normal mode it’s worth giving quirks a try. This lowers performance, but it’s still much faster than a SD card and your adapter won’t go to waste.

To find out the quirks mode string to use we need to find the device ID string for your adapter and then add an entry to cmdline.txt telling the kernel to apply them on boot.

Find Your Adapter

To apply the quirks we first need to get the adapter id. We will use the sudo lsusb command:

$ sudo lsusb
 Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. Name: ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge, ASM1153E SATA 6Gb/s bridge
 Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
 Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

On line 2 we can see my ASM1051E SATA 6Gb/s bridge adapter (it’s the known working StarTech.com 2.5″ SATA to USB 3.1* adapter). You will see something very similar to mine when you run the command and it shouldn’t be too hard to figure out which device it is. If you need more information add a -v switch to make the command sudo lsusb -v. This can sometimes add some additional details to make it easier to figure out which one is your adapter.

If you’re still not sure, we have another command that between the two that can narrow things down. Type / paste the following:

sudo dmesg | grep usb

 [0.828535] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
 [0.828568] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
 [0.828597] usb usb3: Product: DWC OTG Controller
 [0.828620] usb usb3: Manufacturer: Linux 4.19.75-v7l+ dwc_otg_hcd
 [0.828644] usb usb3: SerialNumber: fe980000.usb
 [0.830051] usbcore: registered new interface driver uas
 [0.830182] usbcore: registered new interface driver usb-storage
 [0.836488] usbcore: registered new interface driver usbhid
 [0.836511] usbhid: USB HID core driver
 [0.971598] usb 1-1: new high-speed USB device number 2 using xhci_hcd
 [1.154217] usb 1-1: New USB device found, idVendor=2109, idProduct=3431, bcdDevice= 4.20
 [1.154254] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
 [1.154281] usb 1-1: Product: USB2.0 Hub
 [1.301989] usb 2-1: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
 [1.332965] usb 2-1: New USB device found, idVendor=174c, idProduct=55aa, bcdDevice= 1.00
 [1.332999] usb 2-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
 [1.333026] usb 2-1: Product: ASM105x
 [1.333048] usb 2-1: Manufacturer: ASMT
 [1.333071] usb 2-1: SerialNumber: 123456789B79F

This is the dmesg log showing the hardware detection as hardware is activated on the Pi. If your log is really long you can generate fresh entries by just unplugging a device and plugging it back in and running the command again. Here we can clearly see that the ASM105x is what our StarTech adapter is being detected as.

Now we can go back to our first lsusb command and we want the 8 characters from the ID field that comes right after the Device:

Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. Name: ASM1051E SATA 6Gb/s bridge

Our adapter’s ID is: 174c:55aa

Applying Quirks

To apply the quirks to our USB adapter we are going to edit /boot/firmware/cmdline.txt. Type:

sudo nano /boot/firmware/cmdline.txt

We are going to add the following entry into the very front of cmdline.txt:

usb-storage.quirks=XXXX:XXXX:u

In place of the X’s above you will put in your adapter’s ID that we got before. With the example commands I gave above mine would look like this: usb-storage.quirks=174c:55aa:u. After this my cmdline.txt looks like this (everything should be one continuous line, no line breaks!):

usb-storage.quirks=174c:55aa:u dwg_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait fixrtc

Now reboot the Pi. If the Pi fails to boot you can plug the SD card into the computer and go to /boot/cmdline.txt and undo the change we did so you can boot back in with your SD card.

Verifying Quirks

Once you have rebooted after changing cmdline.txt we can verify the quirks have been applied by doing another dmesg | grep usb command:

sudo dmesg | grep usb
 [1.332924] usb 2-1: New USB device found, idVendor=174c, idProduct=55aa, bcdDevice= 1.00
 [1.332957] usb 2-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
 [1.332983] usb 2-1: Product: ASM105x
 [1.333006] usb 2-1: Manufacturer: ASMT
 [1.333028] usb 2-1: SerialNumber: 123456789B79F
 [1.335967] usb 2-1: UAS is blacklisted for this device, using usb-storage instead
 [1.336071] usb 2-1: UAS is blacklisted for this device, using usb-storage instead
 [1.336103] usb-storage 2-1:1.0: USB Mass Storage device detected
 [1.336479] usb-storage 2-1:1.0: Quirks match for vid 174c pid 55aa: c00000
 [1.336611] scsi host0: usb-storage 2-1:1.0

This time we can see in dmesg that UAS was blacklisted for the device and it has loaded with the usb-storage driver instead. This driver tends to be more compatible with the “problematic adapters” but the performance is usually significantly lower. It’s definitely worth a try though as some adapters do better with the quirks performance-wise. The only way to know for sure is to run a benchmark (see “Verify Drive Performance” section).

Other Resources

I compiled the 2022 Raspberry Pi Storage benchmarks which shows the fastest storage devices for the Pi

For easy headless imaging (does support Ubuntu) check out my Headless Raspberry Pi configuration guide

To find out where to get the 64 bit version of Raspberry Pi OS: where to get the 64 bit Raspberry Pi OS image

To find out how to add a UPS backup battery to your Pi check out my UPS for Raspberry Pi guide

348 thoughts on “Raspberry Pi 4 / 400 Ubuntu USB Mass Storage Boot Guide”

  1. Avatar for Carlos

    I was able to get 20.10 server 64bit working but not 20.04 64bit server. The network device is not recognized. I was not able to get ethernet or wireless enabled. dmesg did not have any mention of bcmgenet in it.

    BTW not sure if it is necessary for this to work but might be good to add instructions to change the eeprom release from critical to stable before running the rpi-eeprom-update command.

    1. Avatar for James A. Chambers

      Hey Carlos,

      Thanks for the info and the steps you took here. I’ve added an entire new section called “Changing rpi-eeprom’s Release Channel” based on your feedback as I think it will help a lot of others as well. It actually explains why we had to fight with the firmware so much with some of the previous commenters.

      I think I’m up to speed! Are your cloud-init steps finishing on 20.04? This can take a long time, but it’s not recommended to log in until it has finished. I did this a few times during testing and sometimes it would give me weird errors like the ‘ubuntu’ user doesn’t exist since cloud-init was still in the setup steps and had not created it yet. I did not observe this behavior on 20.10 although cloud-init will sometimes still write text over the top of you when you think it’s already finished (and it still takes forever to do it’s initial ‘snap’ update before you can start using apt).

      If you’re trying to log in and cloud-init text/other text is displaying over the top of you it isn’t finished yet and interfering with this can break networking. The important one to not interfere with is the one time setup the very first time you boot it. After the first boot interfering with cloud-init is harmless, but the Pi specifically has special steps like expanding your partition to use all the free space on the drive, creating the “ubuntu” user, etc. on the very first startup.

      If you do a dmesg | grep firmware does it say anything anywhere about firmware files unable to load/not found? I have seen this kind of thing before when I did my old Ubuntu 18.04 image. That image had like 20-30 fixes like this from before it had official support. When preparing that image to fix issues like this I would copy the latest firmware from /lib/firmware on Raspbian into Ubuntu’s /lib/firmware directory over the top of it.

      Whether dmesg is complaining about firmware or not, this is what I would try: copy all of the contents of an up to date Raspbian/Ubuntu 20.10 /lib/firmware folder over the top of your existing Ubuntu 20.04 /lib/firmware folder replacing any files that have a conflict with your newer more updated source. You could also use one of your Ubuntu 20.10 /lib/firmware folders as a source as well. Anything that is newer than the 20.04 firmware or is actually able to boot with all components available to the OS and functioning properly.

      Make sure you are matching 64 bit to 64 bit and not trying to copy 32 bit firmware to a 64 bit distro or vice versa. If you don’t have the 64 bit Raspbian beta version then use Ubuntu 20.10 64 bit as the source instead. After this reboot Ubuntu and see if it recognizes your networking.

      I went as far as rebuilding the kernel in 18.04 to get all the hardware accessories working but I really don’t think that should be necessary for 20.04 64 bit. Can you give copying the firmware over the top of your old firmware a try? If it still isn’t working I can look at the script this week here and see if I can reproduce it myself as well! If it does work maybe I need to add firmware updating into the BootFix.sh script.

      1. Avatar for Carlos

        Thanks for the detailed reply. I think you are right about the likely cause. I used the RPi Imager tool and it only has the 32bit versions of the Raspberry OS which is what I ran your script from. Odd thing is I used the exact same sd card for running your script to ‘fix’ USB sticks with 20.04 and 20.10. I’ll install the Ubuntu 64bit on an sd card and try with that instead in the next couple days. Cheers!

      2. Avatar for Carlos

        Couldn’t help myself I did some tests that didn’t require much active time…. here are some updates.

        Using an SD Card with Ubuntu 20.94 64bit Server.
        – fresh install of same ubuntu on USB stick
        – SD and USB in at power on, rpi boots from the USB and everything works fine without having to run your script. I believe this is expected given the SD was in.
        – Decided to run your script after it booted and cloud-init completed (rebooted with SD first and inserted USB after). Ethernet did not work after booting without SD card installed.
        – Repeated with another fresh install on the USB, this time inserted it after SD booted and ran your script. Still did not work.

        I fetched the 8/20 beta 64bit release of raspberry os and will try that next on an SD card. If it does not work I will try the steps you described above to copy the firmware.

        1. Avatar for James A. Chambers

          Hey Carlos,

          Those were all great steps to do. You covered a lot of bases and confirmed some things. I think we’re on the right track here. I think that the /lib/firmware/* files may need an update for 20.04 64 bit.

          It’s interesting that the 32 bit works as I’d just tested this with another commenter earlier but that the 64 bit seems to not have new enough firmware. It has been a little bit since I tested the 64 bit 20.04 one so I will give that one another try. It sounds like you’ve tried enough times that it can’t just be a one-off and it should happen to me as well. I should be able to be of more assistance when I take a closer look!

          1. Avatar for Andrey

            I’ve just tried both steps and yep – ethernet doesn’t work. There were no eth0 at all. When I tried to load manually bcmgenet module, it wasn’t there in the ubuntu image. For some reason, wifi didn’t work either – so I can’t get out to the network from that ubuntu 20.04

            1. Avatar for James A. Chambers

              Hey Andrey,

              Thanks for confirming! My tentative plan is to have BootFix.sh update the firmware on the 20.04 image so it can recognize the eth0 adapter.

              I’m planning on firing this up today and getting it working!

              1. Avatar for Zirowe

                Hi, thank you for your work and detailed description.
                I also have the no ethernet/wifi connection after booting without sd from ssd with ubuntu 20.04.01 64bit.
                Cant even use ifconfig, since its not installed, and wont install without connection.
                Is there a workaround?

              2. Avatar for James A. Chambers

                Hey Zirowe,

                It looks like Andres was able to get his firmware updated to do it. I’m sure you can just copy newer firmware over the top of your /lib/firmware from a Ubuntu 20.10 image or an updated 20.04 image as I’d been doing this for years to fix 18.04.

                I am going to go down to my Pi lab in the basement here after I finish eating and see if I can get this added in here today. This has been on my to-do list pretty much all week but it has been a crazy week. Today is the day! It should be a relatively simple change but will require a couple hundred MB update for Ubuntu 20.04 64 bit LTS. I’m only going to target that version and not touch the firmware on any 32 bit or the working 20.10 64 bit.

                You could absolutely check back here a little later today if you didn’t want to fight with manually updating the firmware (understandable)!

              3. Avatar for James A. Chambers

                Ok I think I found the problem. It turns out that 64 bit Ubuntu 20.04.1 actually *can’t* take the new DTBs. That is actually the problem. The firmware is too old to even load them.

                This means that the solution was easier than I thought. If it is Ubuntu Server 64 bit 20.04.1 it now skips updating the DTBs for that version and continues to update the DTBs for the other versions.

                I’m finishing final testing on this now but I wanted to let you know it was ready to try when you checked back! It is available on GitHub. Make sure you delete your old BootFix.sh script and download the latest one and it should be ready to try again! You will want to start with a fresh image, the old DTBs that it is going to leave in place have already got overwritten in the drive you prepared earlier.

                When you run a sudo apt-get update && sudo apt dist-upgrade -y you will get the latest firmware/updates that fix this issue. This fix will just help it have ethernet when it boots the first time before updating!

              4. Avatar for Carlos

                Hi James. Just to followup on this. I had been running with the RPI image in the SD card to allow it to boot from the USB. Based on the above I decided to do the the apt upgrade and that took care of it for me. I was able to remove the SD card and happily boot ubuntu 20.04 from USB now. Thank you!

  2. Avatar for Mike Carillon

    as long as your eeprom bootloader is up to date, the latest ubuntu-20.10-preinstalled-server-arm64+raspi.img image from ubuntu will boot with out any changes.

    1. Avatar for James A. Chambers

      Hey Mike,

      That’s great! I wish I could say I was positive they were going to fix all of them eventually here but I’m not.

      We waited so long for fixes on 18.04 and they literally never came. I had to roll an alternative image to fix the dozens of issues with it. All the fixes for 18.04 ended up coming out in 19.10 and 20.04.

      Let’s hope that the new “officially supported” status of these new images means these fixes/updates will be backported to the current branch this time rather than making everyone wait until the next version of Ubuntu.

      Thanks for letting us know this. It’s useful to know the server image will work on an updated one without changes if your firmware is up to date.

      Updating firmware is unfortunately where most problems have been but after a few tries with the recovery image most people have been getting through it!

    2. Avatar for Steve

      That worked for me where anything less than 20.10 did not. I am using a UGREEN M.2 NVMe enclosure with a Samsung 970 Evo 512GB SSD.

      I just set the boot loader to stable and updated to latest (December 11 2020 as of today). Then flashed the Ubuntu 20.10 image referenced above to the SSD. Turned off RPi4; Removed SD Card; Plugged in enclosure (Used blue port) and turned the Pi on. Booted just fine.

      One caveat: Do not assume the Pi will be allocated the same DHCP IP address every time it starts. With the SD card it got one address from the router but with the SSD it was given a different IP address. My experience has always been that a devices MAC address was used to allocate DHCP addresses from the router but this time that assumption tripped me up.

      1. Avatar for James A. Chambers

        Yeah this absolutely appears to be necessary. I do a ton of crazy testing with my Pis and undoubtedly had much newer firmware than most users on all my Pis!

        I added it in the guide directly after my conversation with Carlos in the comments here to hopefully save others some time and frustration.

  3. Avatar for Wally

    Hello Got the SSD to boot but cannot get the WiFi to work? Only the ethernet works. How to get WiFi to work?
    I tried netplan to set wifi but still won’t work. When type hostname -I will get blank line only? So unable to get WiFi to output a IP address so I can ssh from my laptop? Please advise how to fix this WiFi issue and no IP address for it ? Thanks. Wally

    1. Avatar for James A. Chambers

      Hey Wally,

      It’s extremely tricky to configure netplan unfortunately. If there’s a single wrong space/tab out of place in the YAML config file it will basically stop reading your changes from that point.

      Is this a version with a GUI or is this command line only? Getting the GUI version is the easiest answer, but if you have a use case or need to use the CLI version here’s what I would do.

      I would try to configure your Pi using the wpa_supplicant.conf method like you do using the CLI on Raspbian. It should work the same on Ubuntu. This method doesn’t apply itself every time you reboot and there’s more configuration to make the changes stick permanently, this is more just for a test to see if it’s just netplan choking on the config file and if your WiFi is actually functioning.

      Do you see the WiFi card? If you do a:

      ifconfig -a

      If you don’t have net-tools yet (very handy for CLI) you can install them with:

      sudo apt install net-tools -y

      I think we need some more information here. The hostname -l says a blank line only. It may be as simple as your WiFi interface isn’t enabled and just needs to be turned on with a:

      sudo ifconfig wlan0 up

      Let us know what you see!

  4. Avatar for Joel

    Hi James,

    I followed your steps but during the first boot, I get a

    Growroot:changed
    Failed to start journal service
    Failed to load Kernel Modules
    Failed to apply Kernel Variables

    Any advice is appreciated.

    1. Avatar for James A. Chambers

      Hey Joel,

      It looks like it’s not finding the kernel modules in the /boot partition. Can you try running a fsck on the boot and root partitions? I know it isn’t booting but if you have another PC you can check it from there. If you look in your “boot” folder/partition does it look like all the files are there?

      It may have also just been a bad image. It may be worth it to try one more time. Sometimes if something goes wrong and it needs an fsck it’s faster to just start over!

      Which version and flavor of Ubuntu are you trying to set up?

  5. Avatar for Paolo

    Hi James!
    Wonderful work!
    This procedure can help people a lot!!!

    But I’m not able to use the same to make “LXD Ubuntu Appliance for Raspberry Pi” USB bootable, because seems bootable only from a SD card.
    Here the link.
    As far as I was able to understand, content of this “appliance” is a (deeply?) modified Ubuntu server, so boot files are different.

    I understand that is another and less interesting service, even, if working as expected, may be able to run a good number of OS container on a RPi 4 8G (as mine).
    Moreover, one the same ESXi for Arm work very well, but I like to do something similar but with a open source solution without tile limits.

    Coud you help me?

    Thanks in advance!!!

  6. Avatar for Victor

    Hello James,
    I’ve set up my system to use an SSD, according to your previous method of booting from the flash drive and then transferring control to the SSD which contains the Raspbian system. It works fine, but now that it’s possible to boot directly from the SSD, I’d like to do that. I don’t want to do a new installation if possible. I suspect this should be easy, but I’m a newbie and don’t want to mess it up. Can you help?

    1. Avatar for James A. Chambers

      Hey Victor,

      I think I can help! First you’ll need to update your Pi’s bootloader firmware. To do that I would prepare a Raspbian installation temporarily on a spare SD card/drive and then do a:

      sudo apt full-upgrade -y

      After it finishes reboot your Pi with:

      sudo reboot

      After it reboots you can verify it updated the firmware with the command:

      sudo rpi-eeprom-update

      The reason this is necessary is that if you have been USB booting Ubuntu it doesn’t have any mechanism to update your Pi’s onboard bootloader firmware so it is almost certainly too old to natively USB boot yet.

      After you’ve ran full-upgrade and rebooted the first thing I would try is to actually shut your Pi down and remove your SD card leaving only the SSD plugged in. See if it will boot from it with the new bootloader firmware without making any other changes and just taking the SD card out. If it doesn’t, then here’s what I would do:

      From this point on is theoretically the danger zone where we will start making changes. I’m also assuming that the drive you are trying to convert is running Ubuntu 20.04 or 20.10. If it’s running an older version let me know first before trying these instructions as they are designed for 20.04 and 20.10.

      I know your goal is to not lose everything and have to start over but definitely just in case back up anything that is important as it would be irresponsible for me to tell you nothing could go wrong or there’s no risk. Let’s boot back into the Raspbian installation we used earlier to update your Pi’s firmware and connect your SSD.

      From here you’ll follow this guide but you will skip to the “Modifying Ubuntu for USB Booting” section as you already have an imaged drive. You’ll run the BootFix.sh script which will update the firmware on the boot partition (files like start4.elf, etc) and decompress the kernel which will allow it to natively USB boot without having to use a SD card anymore! Again, make sure you’re running 20.04 or 20.10 or let me know first as I have no idea what this would do to 18.04 but if you are on a newer one I have thoroughly tested all of those!

      This will reset any custom changes you have made to /boot/firmware/config.txt so if you have anything set up in there you’ll need to redo it as this file gets tweaked to allow the Pi to natively USB boot. That should be it. It’s pretty much the same process as if you did a fresh image other than the losing custom config.txt changes!

      1. Avatar for Victor

        The drive I am using now is running Raspbian, not Ubuntu. All I did was to copy the Raspbian SD card to the SSD, change the partuuid of the drive and then change cmdline.txt on the flashcard to point to the SSD. I am happy with Raspbian, so there should be little that I have to do. I have run sudo apt full-upgrade -y and also sudo rpi-eeprom-update -a, but there is still something that needs to change in order for it to boot from the SSD. When I remove the flashcard and power up the LED on the SSD flashes, but it does not boot.

        1. Avatar for James A. Chambers

          Hey Victor,

          Perfect, that helps. It sounds like you’ve already taken care of the firmware and the upgrades. I think in your case you may just need to do a:

          sudo -E rpi-eeprom-config --edit

          and change the BOOT_ORDER line to:

          BOOT_ORDER=0xf41

          Then a Ctrl+X and then a y to save. I have some better instructions on modifying the bootloader configuration in my New Raspberry Pi 4 Bootloader USB Boot Guide in the “Editing Bootloader Configuration” section that goes through this step by step.

          This will change the bootloader to try booting from the SSD first and then it will fall back to the SD card if the SSD boot fails. I have a feeling your BOOT_ORDER is going to be something like 0x1, which just means try booting from the SD card and don’t do anything else.

          Can you try making that change and rebooting without the SD card in? The other possibility is that the /boot partition on your SSD’s partition need to be updated as well as apt usually only gets one or the other during upgrades and one of them ends up behind/out of sync.

      2. Avatar for Victor

        I’m thinking that what I need to do is update /etc/fstab and then rerun all the updates, because apt has been updating the flashcard’s boot partition.
        But I am afraid to do it! Here is what it looks like now:

        proc /proc proc defaults 0 0
        PARTUUID=97709164-01 /boot vfat defaults,noatime 0 2
        PARTUUID=d34db33f-02 / ext4 defaults,noatime 0 1
        # a swapfile is not a swap partition, no line here
        # use dphys-swapfile swap[on|off] for that

        So should I change the first line to look like the second?

        1. Avatar for James A. Chambers

          Hey Victor,

          Yes I definitely saw that coming too in my other reply here as well. I do think you’ll need to modify that partition label in /etc/fstab to match your SSD or it isn’t going to find it when you remove the SD card.

          Between that and making the change from my other reply you should be covered because as you said it’s a relatively small amount of changes we made in the first place and you’re taking them all into account here!

            1. Avatar for James A. Chambers

              Yes it will still be vfat and will be completely identical other than the partition label. You could generally just copy the files from the SD card’s /boot folder over the top to update them which will save a little bit of time over going the apt route but both would work.

              Apt might not realize that those files aren’t up to date since the package manager doesn’t store that info on the boot partition and I don’t think it actively scans them for changes but you could force a reinstall or some other apt tricks to get it to do it.

              The very last numbers there are the order that fsck is supposed to check them for errors at boot time. You can generally leave these the same.

              1. Avatar for Victor

                The dates on the files in the boot partition on the ssd are recent so I think they have been updated. So I think I am safe to go ahead and change fstab and then the boot order and try it.

              2. Avatar for James A. Chambers

                I think so too but I have a feeling your bootloader needs the recovery image flash before it’s going to go. It’s missing too many options here and looks like a config from before native USB booting was possible.

              3. Avatar for victor

                There is no boot order line in the eeprom-config. It looks like this:

                BOOT_UART=0
                WAKE_ON_GPIO=1
                POWER_OFF_ON_HALT=0

              4. Avatar for James A. Chambers

                Gotcha. We’ve seen this before in the comments of the New Raspberry USB boot guide as well.

                The only fix so far has been to create a SD card with the “Raspberry Pi 4 EEPROM boot recovery” image from the Pi Imager tool. This image is located in the “Misc utility images” section of the Pi Imager utility.

                It’s super simple to run, you just basically plug it in and let it boot and it will start blinking. At that point it’s done. If you boot back into Raspbian you should have all the options available to you! I do have a step by step guide available in Raspberry Pi 4 Bootloader Firmware Updating / Recovery Guide as well.

              5. Avatar for victor

                Well, I’ve downloaded it for my Windows computer. Unfortunately when I insert my only spare SD card (which was fine the last time I used it) I get a “blue screen of death.” I will have to get another SD card. Anyway it is past midnight here so I will hit the sack now. Hopefully I have all the information needed to continue once I have a new card. Thank you for your help!

              6. Avatar for Victor

                Good Morning!
                I purchased another SD card, and created the bootloader image refresh easily. I put it into the pi (model 4, 4 GB) and it blinked a few times and then blinked rapidly as it was supposed to. Then I rebooted, but I still do not see a BOOT_ORDER line, just the same three as before.

              7. Avatar for James A. Chambers

                Hey Victor,

                It’s worth a try, but everyone else who has tried that got a timeout error when they tried to save it. Here are the options it’s supposed to have.

                Take a look at the dates and versions the options were added. You don’t have a single option added in 2020. Your last option is POWER_OFF_ON_HALT=0 which was added all the way back on 2019-05-10. So just to understand why I’m concerned, you aren’t missing one option. You’re missing at least 7 options. Anything that was added in 2020 is missing from your config. I bet if you try to add them it won’t let you and will give you a timeout error.

                You’re the first person that the recovery image hasn’t fixed. Check out what happened with Frank Meyer, who had the EXACT same broken config as you did.

                Maris also tried to do this and wasn’t able to do it. He ended up using a different storage adapter or even an external drive to update it it looks like.

                I would say go ahead and add the line but it looks exactly like these other two that they were eventually able to fix using the recovery image and it sounds like possibly a different storage device/adapter. Let’s see if you get this same timeout error.

                We had someone new stop by and say they actually fixed their USB booting by reverting to an older version here.

                We’re in uncharted territory with yours though. Everyone else so far has eventually got it using the recovery image. Maybe it’s going to take more than one try or fiddling with different storage devices too like Maris!

              8. Avatar for Victor

                Hi James,
                Well, I’m making progress. I ran the bootloader refresh two more times and now I have all the options. The BOOT_ORDER was already 0xf41, so I didn’t change anything there. I changed the PARTUIID in fstab to the SSD.
                Now it still boots with the SD card inserted (it transfers control to the SSD), but when I take it out, it appears to by trying to boot from the hard drive but doesn’t succeed. The green led flickers a few times, as does the led on the SSD, but nothing happens. Then it tries again, etc.
                Something is missing somewhere.

              9. Avatar for victor

                Here is the output from df when it boots with the card inserted. You can see that it is using the boot partition of the SD card:

                Filesystem 1K-blocks Used Available Use% Mounted on
                /dev/root 240067368 7900424 222327108 4% /
                devtmpfs 1827800 0 1827800 0% /dev
                tmpfs 1959896 0 1959896 0% /dev/shm
                tmpfs 1959896 16916 1942980 1% /run
                tmpfs 5120 4 5116 1% /run/lock
                tmpfs 1959896 0 1959896 0% /sys/fs/cgroup
                /dev/sda1 258095 53463 204633 21% /boot
                tmpfs 391976 0 391976 0% /run/user/1000
                tmpfs 391976 0 391976 0% /run/user/1001

              10. Avatar for James A. Chambers

                Hey Victor,

                That is excellent progress! That’s perfect that it defaulted to 0xf41 since they changed that to be the default a few months ago and it’s another good sign that the bootloader firmware recovery actually worked!

                We may need to check your partition labels here. What does your /etc/fstab look like right now?

                In the df output you posted it looks like it actually is using the SSD for your boot partition even when you’re booted in on the SD card:

                /dev/sda1 258095 53463 204633 21% /boot

                /dev/sda1 should be the SSD. The SD card should be something like /dev/mmcblk0p1. Very interesting. This would suggest that your /etc/fstab is correct and that it is mounting the SSD for the /boot partition. Will it still not boot if you take the SD card out completely and then connect the power?

                How did you end up transferring the files from your SD card’s boot partition to the SSD? You can connect it on a Windows or Linux computer and drag and drop them from the SD card’s “boot” to the SSD’s “boot” with just a normal file explorer window choosing to replace anything that has a conflict with the newer more updated version from the SD card.

                In a configuration like you had typically the files in “boot” on the SSD will be the stock ones from when you imaged it (never updated) since that partition has never been mounted by the OS before until you modified the /etc/fstab file to tell it to mount that one instead of the SD card’s.

                Another thing to double check is your config.txt and cmdline.txt files. I know you made some changes to them, but when you copied these files did they get overwritten? It may be worth double checking these config files on the SSD’s boot partition. It looks like that is what is mounted from what you posted.

                cmdline.txt will have a line like:

                console=serial0,115200 console=tty1 root=PARTUUID=XXXXX-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh

                and just make sure that’s pointing to the SSD’s root partition (02) as well!

                There’s one more possibility. It’s possible that your fstab was pointing at the SSD this entire time and that you copied old firmware from the SD card that had never been updated over the top of newer firmware that was getting put on the SSD.

                It’s a little hard to wrap your head around, but there’s a difference between what the Pi booted off of and what your OS mounts as the “boot” folder when the system loads. This could result in your updates going to the SSD (and basically not being used) but the firmware on the SD card was fine for getting through the boot process so it never really mattered. Some people using this method changed /etc/fstab to point toward the SD card for the boot partition and others toward the SSD.

                If you think your firmware on the SSD’s “boot” partition may have been overwritten or compromised, we can clone the latest firmware branch with git and manually update it like this (WARNING: You really don’t want to do this unless you know/suspect your firmware files in the /boot folder are damaged and as a last resort “Hail Mary” to avoid having to reimage and start over. This syntax is also for Raspberry Pi OS/Raspbian. For Ubuntu the folder where these files are is /boot/firmware instead of just /boot like Raspbian so you’d need to change the end of the sudo cp lines to /boot/firmware instead of just /boot. This also won’t work unless the SSD’s boot partition is the one mounted which in this case it is):

                git clone https://github.com/Hexxeh/rpi-firmware.git --depth 1
                sudo cp rpi-firmware/*.dat /boot
                sudo cp rpi-firmware/*.elf /boot
                sudo cp rpi-firmware/*.bin /boot
                sudo cp rpi-firmware/*.dtb /boot

                Those commands clone the latest Raspberry Pi firmware branch and copy the latest elf, dat, dtb and bin files into the boot folder replacing the existing ones. After this shut down your Pi and remove the SD card completely. Have your SSD remain plugged in and connect the power.

                Typically you’ll see a little Raspberry Pi BIOS-looking startup screen with some text telling you what is going on (just like a PC has) as it goes through the boot process. This is provided you have a screen connected. I’m not sure how exactly how long they’ve had this type of a startup screen but if you see it it’s a good sign that you’re dealing with modern firmware!

              11. Avatar for victor

                Hello James,

                I found that /boot/cmdline.txt still had the partition ID from the SD card so I changed it to match the SSD. But when I remove the card it still does not boot, although it accesses the SSD.
                Here is my present fstab:

                PARTUUID=d34db33f-01 /boot vfat defaults,noatime 0 2
                PARTUUID=d34db33f-02 / ext4 defaults,noatime 0 1

                I set this up several months ago by copying everything from the SD to the disk and then changing several files, precisely which I don’t remember, but I followed your instructions.

                I do know that I changed fstab so that the boot partition ID was that of the SD card. Since then I have run apt upgrade all several times but the dates on the files in the boot directory of the SSD are still from January and February 2020. When I look at the files on the SD, they are much newer. So I think this is the problem.

                Can I just copy files from the SD to the disk? Both directories are accessible when it is running.

                I am running headless, but I can access the GUI with a remote desktop program if this will make it easier.

                Which files do I need to copy?

              12. Avatar for James A. Chambers

                Hey Victor,

                Perfect. Fixing cmdline.txt is part of the problem for sure.

                You can absolutely just copy the files from the SD to the disk. You can do this remotely through a program like WinSCP or another file transfer program, through remote desktop, directly on the command line or through SSH, or however it is easiest for you with your setup to get both the disk and the SD card in the same place and replace the older files with the newer ones.

                If the files on the SD are newer those are the ones that need to be on the SSD. Without these newer files on the SSD on it won’t know how to USB boot.

                The partitions are supposed to be identical basically. You want to “catch up” the SSD’s boot partition so the file dates match up with the SD card. The important ones are all the files that end in .elf, .dat, .bin and .dtb. This will be basically everything except cmdline.txt and config.txt.

                You already have your bootloader firmware covered from earlier, so once those files on the SSD are caught up it should have everything it needs to USB boot on it’s own!

              13. Avatar for Victor

                Hello again James,
                Success at last!
                What I did was mount mmcblk0p1, which is the boot partition on the SD card. Then I copied all the dtb, dat, img, elf, and bin files from there to /boot on the SSD. Then I shut down, unplugged the power, pulled the SD out, and reconnected the power. And it worked!
                Thank you for all your help. I couldn’t have done it otherwise.

              14. Avatar for James A. Chambers

                Hey Victor,

                Congratulations! The help is no problem at all, I’m glad you had the patience and persistence to see it through to the end without giving up!

                I honestly think I learned enough from us going through the process together that it warrants writing an article specifically about migrating a SD-based USB boot to a full blown USB booting one. Thanks for working through it with me and being patient, I think all the steps that we’ve gone through here will help some others that are going through something similar!

Leave a Comment

Your email address will not be published. Required fields are marked *

Type here..

Exit mobile version