Issue Fixed! USB Boot Ubuntu Server 20.04 on Raspberry Pi 4

 Learn how to install Ubuntu Server 20.04 on a Raspberry Pi 4 using a USB stick. SD cards are sluggish, and they're prone to data corruption and failure. Upgrade to an SSD disc to solve all of these issues!

Issue Fixed! USB Boot Ubuntu Server 20.04 on Raspberry Pi 4

I'll teach you how to boot Ubuntu 20.04 from a USB stick on a Raspberry Pi 4.

Keep in mind that this will necessitate manual file modification and the use of files from the Raspberry Pi firmware's main branch. This tutorial is also designed for Linux and Mac users.

Let's get this party started!

Firmware should be updated to allow USB booting.

First and foremost, ensure sure your Raspberry Pi 4 is capable of USB booting. You'll need to install Raspbian on an SD card and upgrade the firmware to achieve this. when boot loader has updated. Skip to the following step if your bootloader has already been upgraded.

Ubuntu Server 64-bit is available for download.

Now we need to get the Raspberry Pi 4 64-bit version of Ubuntu Server. We'll next use Raspberry Pi Imager to flash the picture to our SSD.

Download the 64-bit version of Ubuntu for the RP4 from the Ubuntu Raspberry Pi download page.

Save the image to an SSD.

We'll need to install Raspberry Pi Imager after we've downloaded our image. Install the Raspberry Pi on your computer by going to the Raspberry Pi Downloads website.

After that, open Imager. Select "Choose OS" and locate the Ubuntu Server image you just downloaded. After that, pick your SSD drive by clicking "Choose SD Card." Finally, press the Write button and wait for the procedure to complete.

Install the system-boot partition on a solid-state drive (SSD).

To make any changes, we'll need to mount the system-boot partition on the SSD disc.

sudo mkdir /mnt/ssdboot
sudo mount /dev/sdb1 /mnt/ssdboot
cd /mnt/ssdboot

Remove the kernel's compression.

IMPORTANT: This step must be repeated every time Ubuntu upgrades the kernel.

We'll start by uncompressing the vmlinuz file and loading it into vmlinux. This is due to the fact that booting from a compressed 64bit arm kernel is presently not possible.

Find the beginning of the gzipped material in the picture.

od -A d -t x1 vmlinuz | grep '1f 8b 08 00'

Expected results

0000000 1f 8b 08 00 00 00 00 00 02 03 ec 5b 0f 74 54 e5

The place we're looking for is indicated by the first string of digits 0000000. It's exactly at the start of the picture in this example.

Now use dd to extract the data, followed by zcat to uncompress it into a file. If you used a number other than 0000000 as the skip value, make sure you use that number.

dd if=vmlinuz bs=1 skip=0000000 | zcat > vmlinux

For booting, update the config.txt file.

We'll need to change the config.txt file now that we have the uncompressed image to instruct the Pi how to boot.

Edit the config.txt file.

vim config.txt

Begin by commenting out every [pi*] block. Remove the block and its choices by commenting them out. This is how it should seem.

#[pi4]
#kernel=uboot_rpi_4.bin
#max_framebuffers=2

#[pi2]
#kernel=uboot_rpi_2.bin

#[pi3]
#kernel=uboot_rpi_3.bin

In the [all] section, add kernel=vmlinux & initramfs initrd.img followkernel. Leave the remainder of the room alone.

[all]
arm_64bit=1
device_tree_address=0x03000000
kernel=vmlinux
initramfs initrd.img followkernel

Files .dat and .elf should be updated.

Now we need to update the .dat and .elf files to the newest versions in the raspberrypi/firmware Github master branch.

Obtain the boot folder

Use a programme like GitZip to get the folder from the link above.

Files should be copied from the downloaded folder

Then, in the boot folder, copy all of the.dat and.elf files. All files will be overwritten.

cp ~/Downloads/firmware-/boot/*.dat ./

cp ~/Downloads/firmware-/boot/*.elf .

BOOT

Now your Raspberry Pi is ready to use. Check to see if the SD card is plugged in. Remove the SSD from your computer and unplug it. Connect it to your Raspberry Pi and turn it on.

Afterward

Look up your DNS if it's taking too long. For example, sudo apt update is quite sluggish. Make sure you have a decent name server in /etc/resolve.conf.

#nameserver 127.0.0.53
nameserver 1.1.1.1
nameserver 1.0.0.1

Sources

Author CreditEugene Grechko

Posts You May like: