Canonical is not giving up on Ubuntu Desktop for Raspberry Pi devices, and they promise to give everyone a performance boost with the next major release of the popular GNU/Linux distribution, Ubuntu 22.04 LTS.
Ubuntu Desktop on Raspberry Pi arrived officially with the Ubuntu 20.10 (Groovy Gorilla) release, but it was only recommended for the Raspberry Pi 4 models with 4GB or 8GB RAM, Raspberry Pi 400, as well as Raspberry Pi CM4 (Compute Module 4).
Well, that’s about to change as Canonical wants to make Ubuntu Desktop work smoothly on the Raspberry Pi 4 model with 2GB of RAM, and the secret to this performance boost is to enable the zswap feature in the Linux kernel.
For those not in the known, zswap is a Linux kernel feature that provides a compressed RAM cache for swap pages. When enabled, zswap compress a process that’s moved to the swap file. Think of it as a write-back cache for swapped pages.
Zswap will be enabled by default in the upcoming Ubuntu 22.04 LTS (Jammy Jellyfish) release, due out on April 21st, 2022, which already means a performance boost for Raspberry Pi 4 models with 4GB and 8GB RAM, but that’s not enough to run Ubuntu Desktop smoothly on the 2GB variant.
Therefore, Canonical plans to implement two additional improvements, namely to enable the z3fold allocator for storing compressed pages, as well as to switch to the lz4 compression algorithm for a better balance of speed and compression.
The good news is that you don’t even have to wait for Ubuntu 22.04 LTS to come out, as you can enable these performance improvements right now on the Ubuntu 21.10 (Impish Indri) release. To enable zswap, you only have to run the command below in the Terminal app.
sudo sed -i -e 's/$/ zswap.enabled=1/' /boot/firmware/cmdline.txt
If you own a Raspberry Pi 4 computer with 2GB RAM, you will also have to enable z3fold and lz4. To do that, you must run several commands, listed below for your convenience.
sudo -i echo lz4 >> /etc/initramfs-tools/modules echo z3fold >> /etc/initramfs-tools/modules update-initramfs -u exit sudo sed -i -e 's/$/ zswap.compressor=lz4/' /boot/firmware/cmdline.txt sudo sed -i -e 's/$/ zswap.zpool=z3fold/' /boot/firmware/cmdline.txt
I only have the Raspberry Pi 4 model with 8GB RAM, which already runs the Ubuntu Desktop smoothly, so these performance improvements are barely noticed. However, they are more than welcome, and, in combination with setting more RAM to the Raspberry Pi GPU via the raspi-config utility and a fast microSD card or SSD, it should make Ubuntu your daily driver on the tiny computer.
If you try these performance improvements, especially on the Raspberry Pi 4 with 2GB RAM, do give Canonical feedback on if they make your Ubuntu Desktop experience more smoothly or not.
Last updated 2 weeks ago