Skip to content

KhairulIzwan/Ubuntu-Server-raspi4-unofficial

 
 

Repository files navigation

Overview

This is a Raspberry Pi 4 compatible Ubuntu 18.04.3 preinstalled desktop/server for the new (and currently unsupported officially in the 18.04 LTS series) Raspberry Pi 4.

For more information visit https://jamesachambers.com/raspberry-pi-4-ubuntu-server-desktop-18-04-3-image-unofficial/ including a walkthrough and lots of comments / discussion.

Note: Ubuntu has released their first official distribution that supports the Raspberry Pi 4. The bad news it it's only for the short term Ubuntu 19.10 Eoan Ermine release and *not* for the 18.04 LTS release that will still be supported until a whopping April 2023 still. This means that for now this project will live on supporting the 18.04 LTS branch.

The early official 19.10 release seems to be having a lot of issues particularly with USB devices (I couldn't get my USB devices to connect to it either during initial testing). I also saw a lot of warnings in the log files especially with a full desktop installed. I personally am not concerned about these early hardware issues and I expect those to improve quickly but be advised just because it's an official release doesn't mean it's rock solid stable yet!

This unofficial Ubuntu image is a compilation of all the latest knowledge/firmware/fixes for running a 64 bit operating system on the new Raspberry Pi 4. If you find problems report it in the issues section and I and others will assist!

Highlights

  • Fully 64-bit kernel and userspace environment
  • Updates normally via apt dist-upgrade from the official Ubuntu repositories
  • Raspberry Pi userland utilities included (vcgencmd, dtoverlay, etc.)
  • raspi-config utility included (good for enabling I2C, SPI, etc.)
  • Uses the official 4.19.y Raspbian linux kernel built with arm64 flags
  • Firmware updates from the Raspbian image and the RPi-Distro/firmware-nonfree repository
  • 3D video hardware acceleration support via vc4-fkms-v3d stack. Videos / games are giving very high and smooth FPS.
  • Includes kernel headers and the full kernel source tree used to build a kernel with your own custom flags (/usr/src/ directory)
  • Can build out-of-tree and DKMS modules
  • Full desktop support available via apt install kubuntu-desktop, xubuntu-desktop, xfce4, mate-desktop-environment, etc.)
  • 5 GHz WiFi channel support
  • Working Bluetooth and WiFi
  • KVM virtualization support
  • Update script provided to update kernels/firmware/modules

Getting Updates

First and foremost all of your updates will be coming from Ubuntu directly in apt as it would with any official image. The only things set on package hold (using apt-mark hold flash-kernel linux-raspi2 linux-image-raspi2 linux-headers-raspi2 linux-firmware-raspi2) to prevent them from overwriting the firmware already on the image.

If you wish, you may apt-mark unhold those same packages and you will be 100% official Ubuntu. The firmware is old right now so you will probably have issues, but presumably at some point the firmware will be backported for 18.04.3 and they'll be safe to use on the Pi 4 but it may take some time.

Updates to the firmware and fixes to common problems will be provided as long as there is interest.

I expect at some point Ubuntu will backport 18.04.3 back to LTS as it is their long term release but only they know how long tat might take! In the mean time I will do some short term updates of firmware/fixes/kernels/etc. and when Ubuntu's repositories get working firmware you will switch back to their firmware.

I have also included an updater that will give you the latest kernel/firmware/modules/fixes that are included in each release. If Ubuntu's 18.04.3 update servers get working firmware for the Raspberry Pi 4 I will change the update script to remove the apt-mark holds on the Raspberry Pi firmware package in apt and close the project down (leaving this here for people to learn from to hack an unsupported device into their own distros, or until I do it again on the next Pi release!)

Building Image Yourself

I have included both the script to create the image yourself (BuildPiKernel64bit.sh) using the official images as a base. Binary releases are also available as a preinstalled image (available in the "Releases" section at the top of this page) that you can download and write to a SD card without building anything yourself.

Note that the script is more of a process and not one that you can just clone and use. Please read through it if you want to build the image as there are lines commented that you will want read if you are building from scratch.

The idea is that with the build script and the kernel source code built directly into the IMG file (/usr/src/rpi-linux-*) you don't need me to personally update it for you and customize every kernel flag for you or even plan on me being around in the future. The kernel is just the plain Raspbian 4.19.y kernel source built directly from Git (see build script). You have all the tools you need to change kernel flags and recompile, build kernel modules, and really do anything that I can do now. This whole page is a set of tools and a process to let you customize if you need to.

Support

If you come across a problem definitely open a GitHub issue or drop by the jamesachambers.com page linked at the top. I can add these issues as fixes and include them in the firmware/kernel updates provided through Updater.sh

To download the prebuilt image go to the "Releases" section.



Update History

December 3rd 2019 - v25 Release

  • Fixed issue with desktop driver not loading properly (thanks tarsij!)
  • Added haveged back in to prevent slow boots due to low entropy
  • Updated kernel with a few V3D and other fixes

November 29th 2019 - v24 Release

  • Updated kernel to 4.19.86
  • Updated packages and firmware
  • This kernel has additional USB and V3D improvements

November 21st 2019 - v23 Release

  • Updated kernel to 4.19.84
  • Fixed problem that could cause desktop v22 release to not load
  • Fixed issues with video performance while in headless mode (xrdp, xvnc performance improvements)
  • Enabled AppArmor kernel flags
  • Added #dtparam=i2c0=on and #dtparam=i2c1=on examples to /boot/firmware/config.txt to help enable those interfaces if needed

November 17th 2019 - v22 Release

  • Updated kernel to 4.19.83
  • This kernel includes a number of fixes to USB and other drivers -- if you were having trouble with USB v22 is worth a try for you!
  • You can now force an update in the updater even if you are at the latest version. You can use this if you think something may have gone wrong during an update or you are troubleshooting and want to reload the firmware/kernel modules.
  • Fixed issue where lightdm service (used by xubuntu-desktop) would not load properly
  • Added bootcode.bin to /boot/firmware to allow older Pis to boot the image (3B+ confirmed to work so far, others need testing)
  • Added README documentation to /boot/firmware/overlays folder for documentation inside dtoverlay command
  • Updated firmware

November 8th 2019 - v21 Release

  • Preinstalled Desktop binary (ubuntu-desktop) now available in the releases section
  • Netplan changes removed by popular demand -- it was causing too many issues as everyone is using the image differently
  • Updater now removes old kernel source code automatically (no more manual cleaning of these large folders needed)

November 7th 2019 - v20 Release

  • Fixed bug that was causing kernel modules to not load (updating using /home/Updater.sh recommended)

November 6th 2019 - v19 Release

  • Fixed PulseAudio only playing sound in mono, stereo now works!
  • Added kernel flags to optimize speed/clean up warnings/fix crashes
  • Moved most fixes to /etc/rc.local so they are applied after installing a *ubuntu-desktop package without waiting for the next update
  • Removed machine-id from the base image so that cloned images wouldn't all have a duplicate machine-id
  • Fixed audit service error
  • Fixed "spice-vdagent[2107]: Cannot access vdagent virtio channel /dev/virtio-ports/com.redhat.spice.0" error
  • Fixed triggerhappy crash related to /lib/systemd/system/triggerhappy.socket being wrong type

November 3rd 2019 - v18 Release

  • Update to kernel 4.19.81
  • Added udev rule to allow users to use vcgencmd without sudo (thanks xlazom00)
  • Fixed udev mounts not being visible (thanks wyuenho for the pull request)
  • Build script improvements now gets cross chain compiler / qemu user static 4.1 / related build dependencies
  • Build script now retrieves all dependencies for you on a blank Ubuntu 18.04.3 Virtual Machine (if you want to build)

November 1st 2019 - v17 Release

  • Fixed issue with CUPS preventing firmware modules from loading in xubuntu-desktop
  • Fixed unescaped EOF issue that was messing up fixes in /etc/rc.local (thanks meisenzahl for the pull request!)

October 31st 2019 - v16 Release

  • Updated Pi firmware (sound / video fixes, see https://github.com/Hexxeh/rpi-firmware/commit/c5736330216628b5ff8e3d17dde7cc03ce2126e6)
  • Updated Ubuntu-side firmware from updates included on the preinstalled 1910 release image
  • New 64 bit Raspberry Pi userland tools/libraries (vcgencmd) tools are now available -- they are being freshly built each version now in the build script!
  • Fixed issue where Pulse would not come back on after first reboot
  • Fixed netplan so startup isn't delayed by several minutes without an ethernet cable plugged in
  • Fixed several kernel flags related to sound/video
  • Fixed several issues with updater

October 28th 2019 - v15 Official Release

  • Script to update between releases is finally ready, and with that I am taking this out of pre-release!
  • To get the update script use the following commands:

  • wget https://raw.githubusercontent.com/TheRemote/Ubuntu-Server-raspi4-unofficial/master/Updater.sh
    chmod +x Updater.sh
    sudo ./Updater.sh

  • You can update from any pre-release release version. Please make a backup first!
  • The updater is located at /home/Updater.sh on v15 and up (to run type sudo bash /home/Updater.sh)

October 26th 2019 - v14 Desktop Pre-Release

  • Kernel source tree and headers are now included in the image!
  • The kernel build source tree is located at rpi-linux-"${KERNEL_VERSION}"
  • Ubuntu's first official release has come for the Pi 4 but it's 19.10 only which is not a LTS release and support ends for it in July 2020
  • DKMS module building tested
  • If you want custom kernel flags you can go to the /usr/src/rpi-linux folder and run make menuconfig (see BuildPiKernel64bit.sh for more info)
  • Rewrote build script to be more readable and reliable. It's still a work in progress but I'm breaking things down into functions, etc.

October 23nd 2019 - v13 Desktop Pre-Release

  • raspi-config tool is now included with the image for (testing only, don't use on critical fully set up images). You can use it to turn on i2c/spi/etc. File an issue if you find problems!
  • vcgencmd tool (and other libraspberrypi-userland packages) are now included (older build, works for essentials such as vcgencmd measure_temp, vcgencmd get_config int, vcgencmd get_throttled, etc)
  • Added 5Ghz WiFi band support (default regulatory domain US, change in /etc/default/crda if desired)
  • Updated kernel to 4.19.80
  • Fixed sound artifacts when playing YouTube/videos in browser
  • Fixed fsck errors during resize2fs operations

October 6th 2019 - v12 Desktop Pre-Release

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

October 5th 2019 - v11 Desktop Pre-Release

  • 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.

October 3rd 2019 - v10 Desktop Pre-Release

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

October 2nd 2019 - v9 Desktop Pre-Release

  • 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

September 19th 2019 - v8 Desktop Pre-Release

  • 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

September 8th 2019 - v7 Desktop Pre-Release

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

September 7th 2019 - v6 Desktop Pre-Release

  • 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

September 3rd 2019 - v5 Desktop Pre-Release Test

  • 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

September 2nd 2019 - v4 Pre-Release Test

  • 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)

September 2nd 2019 - v3 Pre-Release Test

  • Fixed IPV6 and several other modules not loading

August 31st 2019 - v2 Pre-Release Test

  • 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 how the source tree used to build the kernel is built.
  • Various other fixes (special thanks to Joan at jamesachambers.com for contributing so many)

Packages

No packages published

Languages

  • Shell 100.0%