• Alex

Apt full-upgrade | Getting the new software updates from Debian

This article is at: https://forum.clockworkpi.com/t/apt-full-upgrade-getting-the-new-software-updates-from-debian/5664

By Joao_Manoel



Hello,

I couldn’t work on the device for a few months, but yesterday I tried do finally upgrade to the new Debian. I tried it before and I remember that it didn’t go well. I got a lot of problems and I didn’t get the lima driver working even compiling everything myself. In the end, I gave up.

So I invested a lot of time yesterday, and today to understand what was made to get the lima driver working with X11. I know that getting everything working was difficult but if only a few know what was done it is difficult for people to keep updating it if we don’t have much experience.

I found many duplicated libraries, strange modifications in the kernel, but it looks like I could understand most of it. Maybe from now, we can run mainline Debian without modifications, and in the near future, I can create a bare minimal Debian for the clockworkpi without many unnecessary packages installed.

The first thing to do is to create a backup of your sdcard if something goes wrong. It is likely I forgot one or two steps, but the trick ones should be here.

The first thing to note is that to get the mesa working from a Debian package we need to use Debian 11 or sid, as is documented here:

https://wiki.debian.org/MaliGraphics

I decided to go all the way to sid, so we get the new updates from mesa as soon it goes out without the need to be compiling everything myself. The idea is to go closer to a official Debian release with full package manager, so we leave the updating process to them.

So I modified my sources.list to point to the official sid repo:


deb http://deb.debian.org/debian unstable main contrib 
deb-src http://deb.debian.org/debian unstable main

I only have these two lines. so we can run:


sudo apt update 
sudo apt full-upgrade

I recommend using tmux or screen when running it. It will take about 30 minutes or more to complete and it is possible that the device gets unresponsive, the connection can drop… I wouldn’t recommend to reboot it in the middle. If the connection drops, try to connect a physical keyboard via USB, go to the terminal and reinitialize the upgrade. During the installation, it will ask about keeping or creating new configuration files, and I choose to keep.

Just to remind: Debian will try to install another kernel, but it won’t work on the cpi. So it is better to not have the /boot mounted during this process so we don’t give the chance to the package manager delete our kernel/dtbos and we end up not able to boot after. It is an easy fix, but better avoid.

After everything completed, you can restart and comes the fun part. The lima driver stops to work, but everything else still running.

If you run glxgears will see that it is software rendering, but the mesa installed is the 20.0.6 so, should be able to work with lima.

I recompiled mesa and xserver countless times to understand why. So I think the first thing to do is to give permission to the cpi user to use the direct rendering hardware (DRI). For some reason that I don’t really know my user (cpi) loosed this permission. I suspect that the Debian upgrade did it. Probably they don’t expect the user to start the X, normally it is done with a desktop manager loaded before.


sudo usermod -a -G render cpi 
sudo usermod -a -G video cpi

With this you should be able to get kmscube running well with the lima driver, and if you don’t use X at all (like me) you are fine.

but if try to use X11 you should be getting the following error:


[    41.187] (EE) AIGLX error: sun4i-drm does not export required DRI extension 
[    41.332] (II) IGLX: Loaded and initialized swrast

and you are using software rendering instead. After hours debugging I found why: The xserver doesn’t recognize drivers with hyphen in the name, like our driversun4i-drm. After founding this problem I understood why in the kernel compilation patch from here:

https://github.com/clockworkpi/Kernel/blob/master/v0.4/52rc4.patch


diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile 
index dab2914fa293..7d7d0bb490b8 100644 
--- a/arch/arm/