Raspberry Pi 4 Ubuntu Server / Desktop 18.04.3 Image (unofficial)

Fine, I'll do it myself
No Official Pi 4 Support? Fine, I’ll do it myself!

This is a unofficial distribution of Ubuntu Server 18.04.3 for Raspberry Pi 4. It is provided with the purpose of letting us all play with the new Pi 4’s new increased RAM and other capabilities until Ubuntu’s repositories are updated with support for the newest Pi.

Once official support is released through the Ubuntu repositories this project will effectively cease to exist (until, dare I dream, the Pi 5?). The image supports KVM, has support for the Pi 4’s new 3D display driver, and can also be upgraded to a full desktop installation!

I want to also thank all the commenters on my Ubuntu Server Installation Guide for Raspberry Pi 4 who have contributed a ton of fixes to help get the image to the point it is at now! This has truly been a collaborative effort and I expect it will continue to be until official support is released.

Features

  • Custom compiled 64-bit kernel based on the rpi-4.19.y source tree
  • Preinstalled image contains Ubuntu Server 18.04.3 installation that can be upgraded to a full Ubuntu full desktop installation
  • Able to address all memory up to 4 GB of RAM
  • 3D driver support via vc4-fkms-v3d and upgraded Mesa version
  • KVM enabled
  • USB_UAS support enabled
  • Fixes for most drivers implemented

GitHub Project Location

The image and source code to build the image are open source and freely available on GitHub:

https://github.com/TheRemote/Ubuntu-Server-raspi4-unofficial/

Update Firmware First (using Raspbian)!

One important new thing to understand about the Raspberry Pi 4 vs. older Pis is that the 4 now has real onboard firmware that is on a special chip separate from everything else. Older Raspberry Pis did not have real onboard firmware and loaded all of their firmware from the SD card every single boot.

Before you install this image you should run Raspbian and install the latest firmware using this command:

sudo apt-get update && sudo apt-get dist-upgrade -y
sudo rpi-update

Note that rpi-update will install bleeding edge firmware but since we are running a bleeding edge operating system and cannot receive updates I highly recommend putting the latest possible one you can on before installation.

If you have multiple SD cards or storage devices laying around it is a good idea to designate one of them as the “Official Raspbian Firmware Updater” card. Using this method you can periodically swap out the card and install the latest firmware updates to your Pi 4 and then switch right back to Ubuntu.

Preinstalled Image Download / Instructions

To download the precompiled image see the releases section located at https://github.com/TheRemote/Ubuntu-Server-raspi4-unofficial/releases

The file you are looking for on the releases page is ubuntu-18.04.3-preinstalled-server-arm64+raspi4.img.xz. Download this file and extract the .img file from inside. Use the free and awesome 7-zip if you are on Windows.

Now burn the .img file using your favorite program. I use Win32DiskImager. Now insert your SD card / storage device into the Pi and start it up!

Username: ubuntu

Password: ubuntu

Upon logging in for the first time you will be required to change the default password to something else. Once you have done that log back in and you should be all set!

Install Full Ubuntu Desktop Version

To install the full version of Ubuntu Desktop use one of the following:

  • sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get install xubuntu-desktop # or
  • sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get install kubuntu-desktop

The xubuntu variant is lighter than the kubuntu variant but either one will need to download and install thousands of packages to complete the upgrade. This can obviously take quite a long time. How long it will take depends on your internet connection and the quality of your storage device.

Running this task overnight or when you have an errand to go run is definitely advised!

Performance

Firmware & apt Updates

The kernel has been recompiled to enable the Pi 4 specific performance features (as well as features specific to Ubuntu that aren’t used in Raspbian) and the image performance is pretty good now. This will likely continue to improve further as people test the image and find fixes and new firmware patches coming out every few days to address lingering problems/performance issues.

As explained in the update firmware section above, Ubuntu will not update the Pi 4 firmware for you as it is not yet officially supported. Firmware fixes are coming out as often as every couple of days! Make sure you keep your firmware up to date using the methods I outline in the firmware section.

You may use apt-get update && apt-get upgrade and dist-upgrade normally in this image. The only thing it won’t update is the firmware to prevent breaking your installation. All other Ubuntu security patches/updates will appear and install normally just like the official distribution. It’s highly recommended to always keep up to date in apt!

As a reminder the commands are:

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

Storage

Beyond keeping your firmware and distribution up to date there is only one thing that sets apart one Ubuntu installation on a Pi from any other: your storage device. The difference between a low end to high end SD card can be a 2-3x performance, and the difference between a SD card and a solid state drive is a whole order of magnitude.

To help people know whether they have high performance storage I made the Raspberry Pi Storage Benchmark that will give you a performance score. Running the benchmark is really easy. Paste or type the following commands:

wget https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh
chmod +x Storage.sh
sudo ./Storage.sh

The storage benchmark will run several well known and respected benchmarks such as iozone and fio and calculate a score for your device.

Most importantly, to compare your score or if you want to just view other benchmark submissions check out the full results of all submissions in a searchable/sortable table at the Raspberry Pi Storage Benchmark Results Page.

Using USB Storage / Solid State Drive (SSD)

Right now the Pi 4 still lacks USB boot support. However, you can still do it by using the trick of having a SD card that you use as a bootloader only and have the rootfs on your USB storage. This is kind of a waste of a SD card but it’s definitely worth it as it allows you to hit those full sweet sweet USB 3.0 transfer speeds right now without waiting until the USB booting firmware update is released.

See my Raspberry Pi 4 USB Booting Guide for more information on how this works and how to set it up.

Known Issues / Fixes

This section will be updated with known issues/fixes as people test the image and give feedback.

Boot is delayed several minutes without Ethernet plugged in

This is thanks to cloud-init which I have honestly considered removing from the image entirely but it does a few critical things during the first boot of the Pi (it resizes the partition to use all the space on your SD card, generates SSH keys and enables SSH, etc).

On a fully set up Pi you can do:

sudo apt remove cloud-init

and remove it. If you try this make sure you have a monitor you can connect to in case your networking won’t come up but unless you are using the Ubuntu cloud features (you probably aren’t and if you are you will know it) it is safe to remove.

No display (HDMI)

If you have no display on your HDMI monitor you may need to toggle some options in /boot/config.txt. Put the SD card back in your computer and go to config.txt on the boot partition.

Here are some examples of good ones to try to get your display working:

#uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

#uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

#uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

#uncomment to force a HDMI mode rather than DVI. This can make audio work in DMT (computer monitor) modes
#hdmi_drive=2

#uncomment to increase signal to HDMI, if you have interference, blanking, or no display
#config_hdmi_boost=4

#uncomment for composite PAL
#sdtv_mode=2

Which option or options may fix it for you is impossible to say. Everyone’s display is different so you may have to try a few times before you get it.

Kubuntu-Desktop display issues

If your windows are not drawing correctly in Kubuntu (missing window borders, black screens in windows, etc.) then you need to disable compositing.

Use the shortcut Alt + Shift + F12 to disable the compositor and everything will draw normally.  Now go into the Settings app and go to the “Compositor” section and uncheck “Enable compositor at startup” to prevent it from turning back on when you reboot.

CUPS system module fails to load

This change is automatically integrated in v6 and later of the image but in case the config file got reset here are the instructions.

The default config file for CUPS tries to load a parallel printer driver (which the Pi does not have parallel ports). To fix this we need to edit the CUPS filter config file.

Release History

Pre-Release v12 – 10/6/2019

  • Fixed Bluetooth not automatically attaching (now appears in both console and desktop mode)
  • Updated firmware using the latest from the Raspbian image

Pre-Release v11 – 10/5/2019

  • Updated kernel and modules to rpi-4.19.75
  • Updated kernel to 4.19.76
  • Fixed several video driver issues including very low performance, YouTube videos in full screen freezing the Pi, low color resolution in xubuntu-desktop and graphical artifacts in kubuntu-desktop
  • Fixed bluetooth by adding missing firmware file not present in firmware-nonfree
  • Updated /boot/firmware/config.txt with useful HDMI debug flags — uncomment some of these such as hdmi_safe if you are not getting display output
  • Added lines in config.txt to configure SPI and i2C — you can uncomment these lines if you need to enable them
  • Updated WiFi firmware
  • Added missing regulatory.db files (used by WiFi) to /lib/firmware
  • Note for Kubuntu desktop: the compositor needs to be disabled for everything to draw correctly.  Use the shortcut Alt + Shift + F12 to disable the compositor and everything will draw normally.  Now go into the Settings app and go to the “Compositor” section and uncheck “Enable compositor at startup” to prevent it from turning back on when you reboot.

Pre-Release v10 – 10/3/2019

  • Fixed issue with wireless not showing in v9
  • Fixed bad symlink creation (pull request #38)

Pre-Release v9 – 10/2/2019

  • Updated kernel and modules to rpi-4.19.75
  • start*.elf and fixup*.dat files (GPU firmware) are now updated with each release
  • Kernel .config has been updated with the latest default config and Sakiki-‘s conform_config.sh parameters
  • New conform_config_jamesachambers.sh script added to better keep track of kernel config changes
  • SPI is now enabled
  • CPU bandwidth provisioning for FAIR_GROUP_SCHED is now enabled (CONFIG_CFS_BANDWIDTH=y)
  • Additional Ceph kernel config parameters enabled (see conform_config_jamesachambers.sh for all params)
  • A lot of additional hardware support has been enabled via the official Raspberry Pi default kernel config params — if you were having trouble with a device try v9
  • Cleaned up build script by adding additional needed dependencies to apt-get commands, broke up some sections and added additional comments

Pre-Release v8 – 9/21/2019

  • Updated kernel to rpi-4.19.73
  • Added hosts entry to prevent slow sudo command
  • Added CONFIG_CGROUP_PIDS=y to .config file
  • Committed extras folder to repository
  • Added forcefsck file to run fsck on first boot
  • Reduced image size substantially by running fstrim on .img

Pre-Release v7 – 9/8/2019

  • Updated kernel to rpi-4.19.71
  • Added CONFIG_BLK_DEV_RBD=y to kernel .config file to enable Ceph support

Pre-Release v6 – 9/7/2019

  • Updated kernel to rpi-4.19.71
  • Integrated all available updates from apt into the base image
  • Fixed display driver issue — if you are running v5 you can fix it by commenting out dtoverlay=vc4-fkms-v3d from /boot/config.txt
  • Enabled Ceph support in the kernel .config
  • Added build flags to kernel build line to build a more complete device tree (dtbo files)
  • Integrated all upstream updates since v5 from raspberrypi-linux and firmware-nonfree including a 3D driver fix for aarch64

Pre-Release v5 – 9/3/2019

  • Desktop support added
    • Expect lots of warnings in the logs. If you find solutions to them please leave a comment — many commits come from the comments!
    • Be advised — installing can take quite a while on a Pi — overnight or when you have something to do is a good time
  • Type one the following commands to install your preferred flavor of Ubuntu Desktop
    • sudo apt-get install xubuntu-desktop # or
    • sudo apt-get install kubuntu-desktop

Pre-Release v4 – 9/2/2019

  • Recompiled kernel to include support for Ubuntu features that are not present in Raspbian
  • Enabled USB UAS support
  • Fixed video driver by modifying config.txt and compiling with 3D support
  • System now boots clean and loads all modules (sudo systemd status)

Pre-Release v3 – 9/2/2019

  • Fixed IPv6 and a few other module load errors

Pre-Release v2 – 8/31/2019

  • Boot time reduced from 100s to around 30s
  • Messing with apt-mark or flash-kernel is no longer necessary and the fix has been built into the image
  • Fixed bluetooth firmware bug that was looking in /etc/firmware instead of /lib/firmware
  • Fixed entropy bug causing slow startup
  • Fixed mdadm.conf RAID warning
  • Module.symvars is now available in /boot/firmware/ if you need it to build kernel modules
    If you need the whole source tree check out the accompanying build script in the repository. It’s exactly the same as how the kernel and modules were built.
  • Various other fixes (special thanks to Joan at jamesachambers.com for contributing so many)
  • More at https://jamesachambers.com/raspberry-pi-ubuntu-server-18-04-2-installation-guide/

81 thoughts on “Raspberry Pi 4 Ubuntu Server / Desktop 18.04.3 Image (unofficial)”

  1. Avatar for Tilly

    Hi James, Thanks so much for this! Is it possible to update which version I have? I have v8 on my Raspberry Pi 4, and I think I need the newest version for it to be able to boot without being connected to the internet via ethernet (is this correct?). Do I need to flash a new SD card with the new version to get your updates?

  2. Avatar for Morten Westeraa

    Hi again. I’m struggling with the I2C connection. I have enabled i2c in the config.txt file and installed i2c-tools. If I try to run “i2cdetect -y 1” it cannot find the path/file. Any ideas how to correct this?

  3. Avatar for Sebastian

    Hello,

    I Love your work, all thumbs up!

    One question please, always if i try to install teamviewer it fails with an error.
    I use your ubuntu v11 and kubuntu.

    Is there a chance to get it somehow working?

    1. Avatar for Sebastian

      Hello, its me again^^
      I found out that i can’t install any program, it Always says libc6 =>2.17 is not installed.
      If i install libc6 package it says libgcc1 is missing,
      I tried xubuntu also, updated everything with apt-get update and upgrade, but no success,

      Maybe you know a solution?

      thanks in advance

    1. Avatar for jamesachambers

      Hey Pedro,

      Are you using either of the desktop versions? Xubuntu-desktop and Kubuntu-desktop both should have working bluetooth (v11 and up, older versions were missing a firmware file).

      That being said, the firmware issue was just resolved so if you tell me exactly what steps you are taking / which device you are using and I can definitely investigate and fix any more problems that may be out there!

      1. Avatar for PEDRO

        i installed xubuntu-desktop, the bluethooth adapter is not showing, i already tried to see the adapters and bluetooth manager and says it is not reconize the active adapter.

    2. Avatar for Jeff Deneau

      Thanks for creating this!

      I am installing Asterisk 16 and FreePBX 15 using your v12 image and have encountered an issue which I am hoping your able to assist with. Below is the trace —

      ubuntu@sys3:/usr/src/dahdi-linux-complete-3.1.0+3.1.0$ sudo make all
      make -C linux all
      make[1]: Entering directory ‘/usr/src/dahdi-linux-complete-3.1.0+3.1.0/linux’
      make -C drivers/dahdi/firmware firmware-loaders
      make[2]: Entering directory ‘/usr/src/dahdi-linux-complete-3.1.0+3.1.0/linux/drivers/dahdi/firmware’
      make[2]: Leaving directory ‘/usr/src/dahdi-linux-complete-3.1.0+3.1.0/linux/drivers/dahdi/firmware’
      You do not appear to have the sources for the 4.19.76-v8+ kernel installed.
      Makefile:71: recipe for target ‘modules’ failed
      make[1]: *** [modules] Error 1
      make[1]: Leaving directory ‘/usr/src/dahdi-linux-complete-3.1.0+3.1.0/linux’
      Makefile:9: recipe for target ‘all’ failed
      make: *** [all] Error 2

  4. Avatar for Morten Westeraa

    Thanks for the work Mate. Unfortunately my system would not show anything on my monitor, when I tried your v10 this evening. I tried to flash Buster Lite back on the SD-card and that works fine. Any ideas out there? Have a nice weekend😊

    1. Avatar for jamesachambers

      Hey Morten,

      I fixed a bunch of issues related to this in v11! Can you give that one a try?

      If you are still not seeing a display I added a section in the known issues section on how to get stubborn HDMI displays working.

      1. Avatar for Morten Westeraa

        YES!! that worked. I see you have added stuff in the config.txt. Thanks Man. Unfortunately my WiFi is no longer working, but at least I can now use the system. I can get online via the ethernet port. If I do: lshw -class network, my network 0 is the ethernet and network 1 is WLAN but but it says DISABLED. During boot it struggles with the WiFi for about 2 minutes and then moves on. My monitor, by the way, is a Samsung SyncMaster S24B300.

        1. Avatar for jamesachambers

          That’s fantastic! Let’s see if we can get this wireless card for you. Let’s try this first:

          sudo ifconfig wlan0 up

          This should enable the card and then let’s see if it will connect.

  5. Avatar for PhillB

    Minor technical hitch:
    Oct 02 00:46:37 ubuntu systemd[1]: Starting Security Auditing Service…
    Oct 02 00:46:37 ubuntu auditd[32685]: Error – audit support not in kernel
    Oct 02 00:46:37 ubuntu auditd[32685]: Cannot open netlink audit socket

    Pre-Release 7 (with some fixes from pre-Release 8)

  6. Avatar for Thomas J.

    I am now using this ubuntu-server port running headless on a pi 4 B 2G and so far seems to be running great. I am trying to get ffmpeg to run on it, rtsp-ing in video from an IP camera, adding audio from stereo audio sampler to the stream, and rtmps-ing it out to Facebook. I had this working on a pi 3B+ using Raspbian, copying inputs to outputs directly without decoding/encoding, but when I tried to decode the input video stream to modify it, the 3B+ was not fast enough. I bought a RPi4B 2G to see if the enhanced performance would allow me to do this but so far, I can’t get the Pi4 using ubuntu-server18.04 to stream as well as the RPi3B+ using Raspbian. I think that this may have to do with heat throttling. I am trying to find something like vcgencmd that will run in this ubuntu-server-arm64 port. It seems that vcgencmd is only compiled for armhf and will not run on a 64bit kernel. Is there anything available that will allow me to monitor the CPU Core temperatures?

    1. Avatar for jamesachambers

      Hey Thomas,

      You can read the temperature directly from /sys/class/thermal/thermal_zone0/temp and divide it by 1000 to get the degrees in Celsius

  7. Avatar for Chris Harvey

    thanks for the best upgrade solution i have read. i am a complete Noob at this. The instructions went very well for me on a PI 4 with 2GB ram & a 32gb SD card. The only issue i had was Internet Browsers were very slow & hung. i found that the initial install V8 was lacking a swap file so i installed a 2G swap file & every thing work
    Thanks for your great work.

    1. Avatar for Thomas J.

      I don’t think that running memory swap on a uSD file system is what you want to do since they have a limited amount of rewrites that can be done before memory cells in the card begin to lock up. I found that out a long time ago by trying to run a Linux distro meant to run from a regular HD and the SD card lasted less than a second.

Leave a Comment

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

Type here..