Updated: June 19, 2020
All right. A few days ago, I got meself a Raspberry Pi 4. I wanted to try and see whether it can be used as a desktop system in its own right. As part of this experiment, I wrote two images to SD cards, the official Raspberry Pi OS and Ubuntu MATE, and then started playing around. Along the way, I encountered various bugs and niggles, and therefore, I'd like to officially kick off a whole series of tutorials that will help you address some of these shortcomings and problems, should you face them.
My first woe was that the desktop wasn't rendering full screen in Ubuntu MATE - there were black bars top and bottom, and the resolution was showing, instead of the expected full HD (1920x1020 px) as rather weird 1824x984 px. This is not something I've seen before, so I hunkered down and went about exploring.
Since there was no such issue in Raspberry Pi OS, I could actually compare the two systems, and specifically the hardware configuration. Indeed, quite quickly, the solution presented itself. The fix to this problem is to disable overscan. There are two ways you can do this:
- Using the guided tool called raspi-config. This is the official Raspberry Pi OS tool, which lets you tweak different boot and system configurations. However, it may not be present in (Ubuntu) MATE or work correctly.
- Instead, manually change the boot configuration file that is used to setup the system. In other words, this means implementing the changes that raspi-config does on our own. I would recommend you go for the manual change, because it also allows you to better understand what you're doing.
The boot configuration is stored in the following locations:
- 32-bit OS for Raspberry Pis (older Pis but also including Model 4) under /boot/config.txt.
- 64-bit OS for Raspberry Pi (Model 4) under /boot/firmware/usercfg.txt.
On Raspberry Pi 4, in the 64-bit Ubuntu (MATE) image, /boot/firmware/config.txt also exists, but this file tells you not to write changes into it directly, and to use usercfg.txt insterad. At the bottom of the config.txt file, there's an include statement, which will pull all your manual overrides from the usercfg.txt file. So this is where we want to make the change.
Open the file in a text editor as root or sudo:
sudo nano /boot/firmware/usercfg.txt
And add the following line:
Reboot, job done! Your monitor should now have no black bars anywhere. Spiffy.
Possible side effect
With the new configuration change in place, you may see a message pop up when you login into the desktop that the system could not find the right configuration for your monitor. You can make this message go away by deleting the (existing) monitor.xml configuration file in your home directory:
This sounds like a rather arcane issue, but luckily, the solution is simple. We now have the right screen resolution, and we can enjoy our system to the fullest. More importantly, you got exposed to the usercfg.txt file and what it (can) contain, which means, we can now unleash the full plethora of tweaks onto the Pi 4.
In the coming series of tutorials, as I promised in the original article, I will address and resolve a number of different usability issues, including video and audio playback, MATE desktop environment ergonomics, and we will also spend time tweaking the two operating systems, both Raspberry Pi OS and Ubuntu MATE. The end goal is to have a proper-looking desktop, no matter what form factor it runs on. One down, many more to go.