Skip to content

repowerd: race condition between GPU driver loading and repowerd service startup

The repowerd service on mainline Linux mostly uses sysfs to access backlight brightness controls via the Linux kernel. For this the GPU driver needs to be fully loaded. However, as loading the GPU driver takes quite long for amdgpu and i915, the initial startup of repowerd may skip brightness control because the sysfs objects don't yet exist, see /sys/class/backlight/*. When restarting repowerd after boot, brightness control starts working.

What is needed here is a check in repowerd that waits for /sys/class/backlight/* to appear for some time. Alternatively, there could be a dependency declared via systemd between repowerd and GPU driver loading (if that's even possible).

If installing Lomiri on Debian 13 or Ubuntu 24.04 + ppa:lomiri/builds (apt install lomiri), in various cases, brightness control via Fn + F5/F6 (keys might differ dependent on hardware) or via the slider in the power indicator might be non-functional caused by the above race condition. Via a Lenovo Yoga X1 installed with Ubuntu 24.04 + ppa:lomiri/builds this is 100% reproducible.

A workaround can be (but is suboptimal): load the GPU driver already via the kernel's initrd during boot: E.g. for i915:

sudo -i
echo "i915" >> /etc/initramfs-tools/modules
update-initramfs -k all -u

After rebooting the system, brightness control should always be available immediately after boot without a manual restart of repowerd.

So, the current observation is:

  • often / always / sometimes brightness control does not work

How it should be:

  • repowerd always starts after backlight brightness control is available in sysfs
Edited by Mike Gabriel