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

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. :expressionless: 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 driver sun4i-drm. After founding this problem I understood why in the kernel compilation patch from here:

they change the driver name to sun4i_drm on line 4816. I removed this section of my kernel so the kernel asks for the correct driver name sun4i-drm, the same generated by mesa, otherwise we have to create endless symbolic links to avoid this problem.

Fortunately I found the solution in one patch that address our problem without the need to modify the kernel. It is from one month ago:

This pacth is already in the master, and it should be available in the Debian repository xserver-xorg-core 1.20.9 when it comes out in a few weeks. But since I found the patch I added it to the deb source and generated my package xserver-xorg-core_1.20.8 with the patch applied.

I installed it with:

sudo dpkg -i xserver-xorg-core_1.20.8-2_armhf.deb

If someones ask I can provide the deb file. The good news is that it will be soon an official package, so no need to compile ourselves. But you need a kernel without the driver name change like mine.
I have my kernel here:

After my patched package installation I got X with hardware acceleration:

[    30.666] (II) AIGLX: Loaded and initialized sun4i-drm
[    30.666] (II) GLX: Initialized DRI2 GL provider for screen 0

If you run now glxheads, you should get:

cpi@clockworkpi:~$ DISPLAY=:0 glxheads
glxheads: exercise multiple GLX connections (any key = exit)
Usage:
  glxheads xdisplayname ...
Example:
  glxheads :0 mars:0 venus:1
Name: :0
  Display:     0x493c00
  Window:      0x600002
  Context:     0x4c99f8
  GL_VERSION:  2.1 Mesa 20.0.6
  GL_VENDOR:   lima
  GL_RENDERER: Mali400

and a very satisfying apt update

cpi@clockworkpi:~$ cat /etc/issue
Debian GNU/Linux bullseye/sid \n \l

cpi@clockworkpi:~$ uname -a
Linux clockworkpi 5.5.0-clockworkpi-cpi3-g33b40134e-dirty #8 SMP Wed Feb 5 22:33:14 CET 2020 armv7l GNU/Linux

cpi@clockworkpi:~$ sudo apt update
Hit:1 http://deb.debian.org/debian unstable InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

I hope this can be usefull to someone with similar problems, and help future updates on the gameshell.

6 Likes

How difficult would it be to set up a clockworkpi repository that contains most things from the stock Debian repo, but also gameshell-specific stuff like kernels etc?
The Raspberry Pi folks do it with Raspbian, which is just Pi-ified Debian, so it’s possible.

It would be good to have, but I don’t know how to implement. I think it would require maintenance, dedicated people and a server.

Maybe the easiest for now would be to keep the official Debian repo, and provide some deb packages that we install on top of the installation with our launchers, kernel, and optimizations. Providing packages is better to keep the system healthy and easier to manage. Releasing OS images makes difficult to track the changes specially when we don’t have any documentation of what was made.

If we could get enough people working in development, with each one taking care of a specific package it would be amazing already.

The Raspberry group is huge, and they have many dedicated people to work on software and implement new things. Clockworkpi is very small, and doesn’t seem to have anyone from their side working on software anymore, unfortunately. Everything that I have seem from last year is coming from the community.

if needed my gameshell dedicated ppa repository is still online,

repository not need to have a full copy of official debian repo,
custom packages just need declare they replace official one’s to keep system clean without any future update issues

Yes,

I think would be enough to add a line to sources.list with our deb packages.

Raspberry have a hole new distribution, we don’t need that.

Hi @Joao_Manoel

I am facing the same issue as yours on orange pi pc2 H5 and trying to enable hardware acceleration can you pls share your xserver deb package so that I can try it thanks
nibzy26@gmail.com

Please tell me how to build the latest xorg-server from sources? Ubuntu and Debian will not soon include the latest version of the package in their repository.
My email: vokamut@gmail.com

Ok,

I thought that this was already in the official packages. I’ll see if I can rebuild the package and let you know.

BR

ok,

I was revisiting it and saw that the sources that implements the fix is on the sources of xorg-xserver 1.20.12. Debian Unstable is still on 1.20.11. You could try to use the experimental build, I would try the 1.20.13 from here:

http://snapshot.debian.org/package/xorg-server/2%3A1.20.13-1/

Remember to choose the armhf version.
What is the Debian version and which kernel you are using?

2 Likes