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.
- 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:
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!
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!
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
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.
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/