Raspberry Pi 3B+ Ubuntu Server 18.04.2 Installation Guide

Ubuntu Server logo
Ubuntu Server logo

Ubuntu Server has been my favorite Linux distribution for years. On everything but the Raspberry Pi I run Ubuntu Server but felt stuck with Raspbian on the Pi. Until now!

Ubuntu Server 18.04.2 has been released and major improvements have been made to the official Pi branch.

The Raspberry Pi 3B+ is now fully supported. Previously Ubuntu Server for Pi (like many other distros) had broken or completely missing drivers for core components such as WiFi / Bluetooth. In the 18.04.2 update the firmware for the WiFi and other components is now included out of the box making it a fully functional distribution!

This is the first distribution besides Raspbian that feels like you can just image it and everything works. I’ll guide you through the process in this guide. It only takes a few minutes to set up.

Recommended Gear

I highly recommend upgrading to a solid state setup. The performance gains are gigantic. It’s now less than 30 bucks to take your Pi solid state. This is the best performance upgrade you can possibly get for a Pi until the Raspberry Pi 4 comes out. This is the setup I am using:

Raspberry Pi 3B+ with 2.5A Power Supply

Sabrent USB 3.0 to SSD / 2.5-Inch SATA Adapter -AND- Kingston A400 SSD 120GB SATA 3 2.5” Solid State Drive

Or for a compact setup: SanDisk Extreme Pro 128GB USB Solid State Flash Drive

Getting Ubuntu Server

Head to the official Ubuntu Raspberry Pi page at https://wiki.ubuntu.com/ARM/RaspberryPi and scroll to the “Official Images” section.

32 bit (armhf) vs 64 bit (aarch64)

You should choose the armhf 32 bit version for now unless you have a specific need for a 64 bit distribution. The 32 bit version is faster and more stable for the overwhelming majority of use cases. The 64 bit version has come a very long way and is totally usable at this point but there are still some significant downsides.

The first big downside with the 64 bit distributions is that closed source firmware for some of the proprietary components on the Pi has not officially been released. There are still some stability / limited functionality tradeoffs due to closed source firmware.

The bigger tradeoff though is memory. The 64 bit operating system and system processes consume more memory than 32 bit due to the nature of the architecture. On a device like a Pi with only 1 GB of memory this is an extremely big trade off to make. Unless your use case benefits more from 64 bit features such as large number math (video encoding, advanced compression, etc.) the lower memory usage is better.

For now it is best to remain cautiously optimistic about 64 bit on the Pi. My prediction is that the upcoming Raspberry Pi 4 will have more RAM built in making 64 bit much more attractive. It may even prompt an official 64 bit Raspbian release!

Writing the Image

This part is easy. Extract the image from xz format to img format and write it to your MicroSD card or solid state drive the same way you would for any other distribution!

If you are using a solid state drive follow the section below before you boot the Pi for the first time. If you are using MicroSD you can skip the next section and go straight to the configuration section!

Solid State Drive (SSD) Configuration (Optional)

We need to make two configuration file changes for the Raspberry Pi to boot from a solid state drive correctly. Insert your imaged media into another computer and open cmdline.txt. The stock one will look like:

net.ifnames=0 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

The key part we need to change here is the “root=/dev/mmcblk0p2” section. mmcblk0p2 is a hardware identifier for MicroSD storage. We will change this to:

root=LABEL=writable

The final line will be:

net.ifnames=0 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait

For the second and final configuration file changes we will be turning off Ubuntu’s uboot mode and using the Raspberry Pi’s official bootloader to fix the USB booting support. To make this change open up config.txt.

Change the second line containing “kernel=kernel8.bin” to “kernel=vmlinuz” to switch the bootloader. Next add a new line containing “initramfs initrd.img followkernel” to tell the bootloader to initialize the file system. And finally comment out the “device_tree_address=0x03000000” line to disable the memory mappings to the MicroSD card.

Your final config.txt file will look like this:

enable_uart=1
kernel=vmlinuz
initramfs initrd.img followkernel
#device_tree_address=0x03000000
dtparam=i2c_arm=on
dtparam=spi=on

The 64 bit distribution will also have one more line at the end: arm_64bit=1 to tell Ubuntu it is running in 64 bit mode.

You are done! Remove the SSD from your computer and plug it into the Raspberry Pi and boot normally.

Configuration

Default User / Password

The username and password for your initial login to Ubuntu Server will be:

user: ubuntu
password: ubuntu

You will be required to change your password after logging in for the first time. Make sure on the prompt you enter the current “ubuntu” password before typing in your new password or the device will kick you out completely and you’ll have to log in again.

Set Time Zone

To configure the correct time zone for Ubuntu Server use the following command:

sudo dpkg-reconfigure tzdata

This will take you to a very easy to follow menu to select your correct time zone and applies it to the system.

Update System

For best stability, security and performance you should immediately update your system and packages to the latest version. This will also grab all of the latest fixes/improvements making your Raspberry Pi Ubuntu experience much better.

This part is easy. Type:

sudo apt-get update && sudo apt-get upgrade

Change Default GPU Memory Split

The default amount of memory allocated to the GPU on the Raspberry Pi is around 76 MB of our 1 GB.

This is way too much because Ubuntu Server is a headless distribution that does not have a GUI. If you type the command “free” you will see that your Raspberry Pi is missing this memory under the “total” column. We can reclaim most of this memory back by setting the GPU memory split to 16 MB.

This option is set in the config.txt file. It’s exactly the same file as Raspbian uses but it is located at /boot/firmware/config.txt instead of /boot/config.txt. Open config.txt with the following command:

sudo nano /boot/firmware/config.txt

We will add the following line at the bottom of config.txt:

gpu_mem=16

Press Ctrl + X and type yes to save the file. Now restart the Pi by typing

sudo reboot

After the reboot finishes type “free” again and you will see that your total available memory has increased and can now be used by the system and your applications!

Overclock MicroSD Card (Optional)

Disclaimer: As with all overclocking it is at your own risk. Some people have reported low range cards can get corrupted over time although it seems to be rare. If replacing your MicroSD card is going to be the end of the world you should skip to the next section, otherwise read on!

The vast majority of MicroSD cards can be safely overclocked from 50 MHz to 100 MHz. This is because the Pi was designed to be very accessible worldwide and work with even the most inexpensive and potentially poorly made MicroSD cards. The increased clock speed provides huge I/O performance gains and makes everything feel much snappier.

If you want to see the performance differences for yourself or even benchmark your MicroSD card check out my article here: https://www.jamesachambers.com/2018/03/raspberry-pi-3b-microsd-vs-ssd-speed-benchmarks/

If you try overclocking the card and the Pi won’t boot after don’t panic! Simply insert your card back into your computer and remove the line we are about to add in to config.txt and save. The Pi will boot normally again.

Let’s open config.txt again by typing the following:

sudo nano /boot/firmware/config.txt

And put the following at the bottom of the file:

dtparam=sd_overclock=100 

Press Ctrl + X and answer yes to save and reboot the pi with a sudo reboot.

That’s it! If your Pi won’t boot up afterward simply put the card back in your computer and remove the line and start the Pi back up.

Conclusion

I’m very excited to see my favorite Linux distributions continue to evolve to the point where they are comparable in performance and stability to Raspbian.

I’ve been testing extensively on Ubuntu Server 32 bit and 64 bit for my Raspberry Pi Minecraft Server project and not only is it on par with Raspbian but starting to do things so well it sometimes makes Raspbian feel a little dated. Newer packages such as OpenJDK 11 are available on Ubuntu Server that are not available in the Raspbian repositories.

If you have any questions or suggestions don’t hesitate to leave me a comment on the post or use my contact form to message me privately! I’m good about responding quickly and my articles are constantly revised to address questions or do something a better way that a reader pointed out.

Have fun!

Comments 4

  • Thanks for this article! I’ve got a couple SSDs being delivered today, and I plan to upgrade a couple of my RPI 3B+ to SSD and Ubuntu 18.04 this weekend.

    Do you have any insights on memory usage of Raspbian vs 32-bit Ubuntu Server? With stock installs are they in the same ballpark?

    Thanks!

    • Hey Fred,

      On the completely stock images (before changing gpu_mem to 16MB to get back the memory from the GPU split) I’m showing:

      Raspbian Stretch 32-bit – 858304 available
      Ubuntu Server 18.04.2 32-bit – 844460 available

      So they’re extremely close. Closer than I thought it would be actually!

  • I have done this and my pi still wont boot. only will boot off sd card

Leave a Reply to jamesachambers Cancel reply

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