Raspberry Pi 4: Install Flatcar Container Linux on USB SSD

Life-is-short--so--enjoy-it
5 min readOct 3, 2023

--

After dealing with several issues, finally installed Flatcar Container Linux on USB SSD

Raspberry Pi 4: Install Flatcar Container Linux on USB SSD

Disclaimer

“As an Amazon Associate, I earn from qualifying purchases.”

Intro

Last time, I installed the Flatcar Container Linux on Micro SD card. At the time, many things were new to me.

  • Raspberry Pi was new.
  • Raspberry EEPROM bootloader was new.
  • Flatcar Container Linux was new.

After many tries, I made it work.

At this time, I tried to install the Flatcar Container Linux on USD SSD.

Not Smooth and Little Different Steps

The overall steps to install the Flatcar on Micro SD were

  1. Install Raspberry Pi Imager
  2. Install bootloader on Micro SD by using the Imager
  3. Reboot the Raspberry Pi and confirm the green screen
  4. Install Flatcar installation script
  5. Install Flatcar on Micro SD
  6. Install Pi4 UEFI Firmware

I followed the same steps like described, but I got stuck on the step #3.

Unlike the Micro SD, the SSD didn’t need the step #3.

Steps are Scripted in Bash

Since I have some understanding in the steps installing the Flatcar, I scripted the steps.

The script will do the steps below

  • check_target_device
  • setup_pkg_dep
  • setup_flatcar_install_script
  • setup_flatcar
  • setup_uefi_firmware

Basically, once you install the Raspberry Pi bootloader on SSD, you can use the script to install Flatcar and Raspberry Pi UEFI Firmware.

Ok. Let’s start

Step 1: Install Bootloader by Raspberry Pi Imager

This is exactly same as installing on Micro SD.

Although you can run Raspberry Pi Imager and install the bootloader on SSD, later you have to use Linux like OS to install Flatcar. ( flatcar-install script requires some Linux packages. )

I recommend using Raspberry Pi OS as a host where you run the Raspberry Pi Imager.

Raspberry Pi Imager: Select Bootloader in Operating System
VNC can be used to remote-connect to Raspberry Pi

Step 2: Reboot and unmount SSD

This was very important steps not to face any issue related to the SSD device.

Once you install the bootloader, the block devices should look like this.

  • SSD
  • Micro SD
lsblk output

Reboot or Reconnect USB-SSD

I only tried the reboot option.

If you more prefer reconnect the SSD, then try it and let me know if it works.

After the reboot, you will see a partition ( sda1 ) in the `/dev/sda` that wasn’t visible before.

The partition is shown after the reboot

unmount SSD’s partition

umount /dev/sda1

Here is the target status. ( IMPORTANT!! )

Step 3: Clone the Github Repo

The script I built is in my Github public repo. You can clone it to your host computer.

git clone https://github.com/Gatsby-Lee/moon-rapi.git

Step 4: Create Ignition file — config-template.json

In the cloned repo, you can find config-template.json in the flatcar directory.

The script has very basic config only. And, the only required to update is “sshAuthorizedKeys”.

In case, you’re not sure how to create SSH Key, then here is the command you can refer.

Update the config-template.json with your SSH Public key

Step 4: Run the script

Finally, we’re ready to run the automated Flatcar installing script.

  1. move into flatcar directory in the repo
  2. run setup_flatcar_pi4_ssd.sh script.
# the positional argument is the target device name ( SSD )
# @note: don't run with `sh`, it will fail.
./setup_flatcar_pi4_ssd.sh /dev/sda
Run the automated flatcar installation script

Once the Flatcar is installed successfully, you will see more partitions in the device like below.

Flatcar is installed on Raspberry Pi bootloader

Step 5: Reboot

Ok. It’s a show time.

If you used Raspberry Pi as a host machine, unplug the Micro SD ( or any boot medium you used )

Extra: What I bought more?

The Raspberry Pi accessories I bought last time is in use with the Pi that host the DNS service for my homelab.

So, I had to buy some more Raspberry Pi accessories to make progress in “Install Flatcar Container Linux on USB SSD”.

Kingston 240GB SSD

I bought Kingston 240GB SSD. It was recommended by one my my peers who run several Raspberry Pi at his homelab.

I found several cheaper SSD ( like Silicon Power ). Their reviews looked good on Amazon, but their reviews were not good outside of Amazon. ( unreliable )

So, I decided to buy Kingston.

SanDisk 32GB Ultra — Micro SD Card

Although I more prefer to buy SanDisk 32GB Extreme Pro, I bought the two bundled San Disk Ultra 32GB.

It’s mainly because those Micro SD cards will be used for testing OS or doing some simple tasks.

If you want better performance and compact, then I highly recommend SanDisk Extreme Pro.

BENFEI SATA to USB Cable

This is very critical part to connect SSD to Raspberry Pi through USB. The full product name is “BENFEI SATA to USB Cable, USB 3.0 to SATA III Hard Driver Adapter Compatible for 2.5 inch HDD and SSD

Somehow, Raspberry Pi is very picky in the SATA to USB Cable or Adapter.

If the incompatible one is used, basically Raspberry Pi won’t even boot with the connected SSD.

Raspberry Pi 4: Kingston SSD and Benfei SATA to USB Cable.

--

--

Life-is-short--so--enjoy-it

Gatsby Lee | Data Engineer | City Farmer | Philosopher | Lexus GX460 Owner | Overlander