blog.itcode.devblog.itcode.dev

[Raspberry Pi 4] Installing Ubuntu on the Raspberry Pi

By Thursday, delivery of all the supplies was complete. A clean Raspberry Pi doesn't have an OS installed and is in a FreeDOS state, so you have to install the OS yourself. Since I regularly reformat my computer and have run a few virtual machines, this shouldn't be much of a problem for me, but the catch is that this is a bit different from the computers I've dealt with so far. Since it's a device I'd never handled before, and there are several differences and constraints compared to a typical desktop, it wasn't entirely smooth sailing.

[Raspberry Pi 4] Installing Ubuntu on the Raspberry Pi

By Thursday, delivery of all the supplies was complete. A clean Raspberry Pi doesn't have an OS installed and is in a FreeDOS state, so you have to install the OS yourself. Since I regularly reformat my computer and have run a few virtual machines, this shouldn't be much of a problem for me, but the catch is that this is a bit different from the computers I've dealt with so far. Since it's a device I'd never handled before, and there are several differences and constraints compared to a typical desktop, it wasn't entirely smooth sailing.
RWB0104
@RWBwritten at 2021-08-30 16:51:39
Raspberry Pi

시리즈 모아보기

Raspberry Pi

2 / 7

By Thursday, delivery of all the supplies was complete. A clean Raspberry Pi doesn't have an OS installed and is in a FreeDOS state, so you have to install the OS yourself. Since I regularly reformat my computer and have run a few virtual machines, this shouldn't be much of a problem for me, but the catch is that this is a bit different from the computers I've dealt with so far.

Since it's a device I'd never handled before, and there are several differences and constraints compared to a typical desktop, it wasn't entirely smooth sailing.

The Raspberry Pi has its own dedicated OS, Raspbian. Since Raspbian is the most optimized OS for the Raspberry Pi, it should let you easily handle the native areas of the Raspberry Pi.

However, since I intend to use the Raspberry Pi to build a server rather than to work with the Raspberry Pi itself, a much more general-purpose OS than Raspbian suits my needs better — something like CentOS, for instance.

Among those options, the OS I chose was Ubuntu. After being acquired by RHEL, CentOS lost its biggest advantage — parity with RHEL. There was no longer much reason to use it.

For that reason, and because I'd wanted to try it for a while, I decided to install Ubuntu, the Linux distribution most familiar to Koreans.

Since this is an unfamiliar installation onto a Raspberry Pi, I should also be able to find related information easily.

Let's get into installing Ubuntu on the Raspberry Pi.

  • Raspberry Pi 4 Model B
  • Power cable (5V 3A or higher)
  • MicroSD, reader (for older firmware)
  • Micro HDMI or HDMI cable (if using a monitor)

The requirements are as above.

By default, the Raspberry Pi normally only recognizes MicroSD. To recognize an external disk like a USB, you need to update the firmware.

Apparently, boards released after August 2020 have the firmware updated by default. Mine was bought secondhand, and since it seems to be a board released before August, it didn't recognize the USB right away.

The firmware update can only be done after the OS is installed, so if you have an older board, you'll unavoidably need a MicroSD — keep that in mind.


The Raspberry Pi comes with a small connector called Micro HDMI by default.

In the photo above, the connector on the left is the standard HDMI we're familiar with, and the small connector on the right is Micro HDMI. In the case of the Argon M2 case, it provides an HDMI port connected to a Micro HDMI internally, so it wasn't an issue for me, but if you connect a monitor without a separate case or connector, you'll need a Micro HDMI to HDMI cable like the one shown above — be careful of this.

Download the following two files to install Ubuntu on the disk.

The image recorder creates a boot disk. Think of it as similar to the process of creating a Windows-formatted USB.

Since Ubuntu is Linux, you can easily download it from the link above.

  • Ubuntu Server - CLI-based (no GUI)
  • Ubuntu Desktop - GUI-based (requires a monitor for installation)

When you visit the page, you can download either version. Desktop is the GUI-based OS we typically think of. Server is a command-based CLI OS, similar to DOS. Either is fine to install, but if you're not familiar with Linux, I recommend Desktop. Just keep in mind that since it's GUI-based, you'll need a monitor for OS setup after installation.

In this post, I install Ubuntu Desktop. A GUI environment is needed for UI programs like Electron, or for testing web pages on Ubuntu. This is because you can't launch a browser and similar actions in the CLI. You can also install related programs later on Ubuntu Server to run it in a GUI environment.

Create the boot disk through the following process. This post proceeds using a MicroSD. Don't worry — the process doesn't change even if the disk type is different.

Plug in the USB and launch the downloaded BalenaEtcher.

Select the downloaded Ubuntu ISO. The selected ISO will be written to the disk.

Note that the Ubuntu Desktop ISO is fairly large.

Select the disk drive the ISO will be written to.

Clicking [Show hidden] lets you select not only external USB-type drives but also a D drive connected via M2 or SATA. Of course, this shouldn't happen, but system drives can't be selected.

Once all selections are complete, click the [Flash!] button to create the boot disk.

If the disk I/O is fast, like with an SSD, it finishes quickly, but if it's slow, it can take several minutes.

When complete, a screen like the one above appears.

If you eject and reinsert the disk to re-recognize it, the following two disks will be recognized.

  • system-boot or boot - boot disk
  • main disk

Connecting this boot disk to the Raspberry Pi lets you use Ubuntu.

Connect the boot disk to the Raspberry Pi. If it's a MicroSD, connect it underneath the chip; if it's a USB, connect it via the USB port — whichever matches the format.

When it boots properly, a red light comes on along with a blinking green light. If only the red light comes on, it means there's a problem during boot. In that case, you'll need to connect a monitor to check the details of the problem.

After that, the setup is the same as a typical Ubuntu setup — creating a user, specifying settings, and so on.

If you created the boot disk with a USB instead of a MicroSD, and the screen shows a message like USB Stop with repeated failures, it means it's an older board that can't recognize a USB.

If a MicroSD is good enough for you, or if it's a newer board that could use USB or SSD as a boot disk from the start, just use it as-is. But if your Raspberry Pi's firmware is old and a MicroSD isn't enough for you, you'll need to update the firmware through the process below.

This is unnecessary for newer firmware that already recognizes USB

Update the firmware so the Raspberry Pi can recognize USB or SSD as a boot disk.

The firmware update can only be performed after the OS has been installed on the Raspberry Pi. In other words, to boot from SSD on an older board, you need to create two boot disks total: boot once from MicroSD, update the firmware, then boot once more from SSD.

First, open a terminal and enter the following two commands.

BASH

sudo apt-get update
sudo apt-get upgrade

This updates the package repository and installed packages.

Once the update is complete, enter the following command to change the contents of the file.

BASH

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

Change critical to stable in the FIRMWARE_RELEASE_STATUS="critical" setting.

In other words, change it to FIRMWARE_RELEASE_STATUS="stable".

Now update the bootloader.

BASH

sudo rpi-eeprom-update -d -f /lib/firmware/raspberrypi/bootloader/stable/pieeprom-2020-06-15.bin

If you look in that path, you'll find various versions besides 2020-06-15, such as 2020-07-16 and 2020-12-11, but most sources seem to recommend the version above.

I personally like the latest version, so I first updated to 2020-12-11, the most recent version at the time, but the settings turned out strange, so I ended up updating again to the 2020-06-15 version mentioned above. The update is quick, so there's no need to worry about it.

BASH

sudo reboot

Once the bootloader update is complete, reboot the device.

After the reboot completes, enter the following command to check whether USB is recognized.

BASH

sudo vcgencmd bootloader_config

OUTPUT

[all]
BOOT_UART=0
WAKE_ON_GPIO=1
POWER_OFF_ON_HALT=0
DHCP_TIMEOUT=45000
DHCP_REQ_TIMEOUT=4000
TFTP_FILE_TIMEOUT=30000
ENABLE_SELF_UPDATE=1
DISABLE_HDMI=0
BOOT_ORDER=0xf41

Entering the above command outputs settings in this format. Everything else doesn't matter, but if the BOOT_ORDER value is 0xf41, the update completed successfully.

Now the Raspberry Pi can recognize USB as a boot disk.

Since it's the firmware of the Raspberry Pi device itself that was updated, not a value on the disk, the update persists even when you switch the disk from MicroSD to USB. I didn't know this and worried over it needlessly.

Now the MicroSD's role is finished. Keep the MicroSD safe for future use — it does come in handy occasionally.

Perform the Creating the boot disk process again from this post on whichever disk you want, whether USB, SSD, etc.

Once the Ubuntu installation is complete, the usual OS setup we're familiar with follows.

For Ubuntu Desktop, additional settings such as language and account are configured.

For Ubuntu Server, since it's a CLI environment, no additional setup is needed. A default account is created, with both the username and password set to ubuntu. Change it after logging in.

  • Set up an Ubuntu server on the Raspberry Pi.
  • Apply a domain.
  • Set up remote communication environments such as SSH and RDP.
  • Run Tomcat to host pages.
  • Install MariaDB to handle DB communication.
# Raspberry Pi# Ubuntu
ship
blog.itcode.dev

Notes from the π-th Alpaca

7.0.1
Developed by RWB since 2021.057th upgraded at 2026.08