Raspberry Pi 4 is a tiny device packed with useful features like support for dual monitors and fast ethernet connection. If you are looking for a simple yet reliable solution for your next DIY project, a Raspberry Pi can be an excellent base for that. Moreover, you can now easily run Ubuntu desktop on your Raspberry Pi 4, even with 2GB of RAM.

Read below to learn how to improve Ubuntu's performance on a Raspberry Pi 4 with only 2GB RAM. You can use this method to set up a full-fledged Ubuntu environment with access to a keyboard, mouse, and networking.

Set Up Ubuntu Desktop on Raspberry Pi 4

Ubuntu officially supports the Raspberry Pi 4 Model B with 4GB and 8GB RAM modules. However, you can also run Ubuntu on Raspberry Pis with 2GB of memory. We'll need to use a nifty Linux kernel feature called zswap for this purpose.

zswap compresses any process before moving them to the swap file and verifies if the smaller, compressed size can fit in the RAM. Decompressing a zswapped page is much quicker than accessing the swap. So, it results in a smoother user experience even after installing all the best Raspberry Pi apps.

Plus, you don't need to wait for the next LTS release to enjoy this feature. You can enable zswap in your current Ubuntu installation and enjoy the performance boost right away. Open a terminal in your Ubuntu-powered Raspberry Pi 4 and enter the below command:

        sudo sed -i -e 's/$/ zswap.enabled=1/' /boot/firmware/cmdline.txt
    

Reboot the machine once the command finishes its work and check out the performance gain for yourself. You should find things like navigating and browsing faster compared to before.

Configure Ubuntu on Raspberry Pi 4 With 2GB of RAM

zswap has made running Ubuntu easier on low-config devices like the Raspberry Pi 4. Canonical is also working on other mechanisms like z3fold and lz4 compression to make Ubuntu run even faster on these devices.

If you're still not satisfied with the performance, try installing a lightweight OS on your Raspberry Pi.