boot ubuntu 20.04 on a raspberry pi 4 from SSD

10,226

On the RPi, if you look in the file /boot/firmware/cmdline.txt you will see that with 20.04 the root filesystem is defined as:

root=LABEL=writable rootfstype=ext4

This means the root filesystem is identified by the partition label named 'writable'.

If you run the following command:

lsblk -o +LABEL

you will probably see two disk block devices: sda (the USB SSD) and mmcblk0 (the SD card). You will also probably see that each device has two partitions one with the label 'writable' and the other with the label 'system-boot'. So you have two partitions named 'writable'.

If this is so, then you need to change the label on the SD card so that the bootloader can determine which 'writable' root filesystem is required to boot (i.e. use the USB SSD).

I'm guessing that the offending partition is /dev/mmcblk0p2 (the second partition on the SD card). You can change the label like this:

sudo e2label /dev/mmcblk0p2 NEWNAME

Then rerun the above 'lsblk' command to make sure your change has been made. Then reboot the RPi several times and make sure the root partition (/) is always mounted on the sda block device (again using the 'lsblk' command).

Share:
10,226

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    first time post. I am a fellow noob. I wanted to boot my RPI4 from a usb 3.0 ssd drive AND not have the rpi4 continue to read the sd card. I followed the instruction in one of the answers to the following post:

    Can I boot Ubuntu Server 19.10 on a Raspberry Pi 4 from a USB SSD?

    The answer was to image both the SD card and SSD with the ubuntu image. I did that and I was able to boot. I verified on the command line:

    ubuntu@ubuntu:~$ findmnt -n -o SOURCE /

    and the result was showing that my dev/sda1 was the source.

    I rebooted and verified again, but this time it showed the drive path of my SD card. I was confused because, immediately before, it asked me to change my password like the first time you boot.

    So I repeated rebooting and each time I reboot, it alternates where it boots from (or the result from using "findmnt -n -o SOURCE /"). Interesting notes: no more password change request; the ip address to ssh kept alternating as well between the same two addresses in my router's network. sudo apt-get and all other commands seem to work.

    How do I make it always boot from the SSD? Is this the reason why the RPI foundation claims the firmware doesn't support it? I read somewhere that the rpi4's firmware doesn't support booting from an external drive, but this method seems to work, at least while alternating where it boots from.

    I'm not sure if I should have even attempted to use Ubuntu on RPI rather than sticking with Raspbian, but I would greatly appreciate a solution to my problem.

    I also welcome resources for other matters. I am very noob to raspberry pi, the linux world, computer programming, etc. The extent of my computer knowledge is limited and along the lines of a gamer from MS Dos days to building my first computer in 2014.

    • Admin
      Admin almost 4 years
      for the alternating IP part of your question, it seems your rpi keeps getting a different IP assigned from the DHCP server each time you reboot. to fix this, change your router settings to assign a static local IP to the rpi. this way you ssh always the same address.
  • Admin
    Admin almost 4 years
    i followed the solution provided but my rpi is taking forever to boot up. i see the SSD in read since the controller/adapter LED indicator is blinking super fast. is that normal ? (my SSD is fine, tested working. and has a clean ubuntu setup using rpi imager)