Subject: bug#617: initscripts: brightness init script sets brightness to zero, thus blanking laptop display

From: Martin Steigerwald <[email-masked]>
Date: Tue, 12 Oct 2021 09:36:24 +0200

Dear Mark.

Mark Hindley - 11.10.21, 19:06:44 CEST:
> Thanks for this.
> 
> The brightness initscript seems to save
> /sys/class/backlight/intel_backlight/brightness to
> /var/lib/initscripts/brightness when it is stopped.
> 
> On your system, what does the
> /sys/class/backlight/intel_backlight/brightness contain?

I think I know what happened.

After booting the laptop I get:

% cat /sys/class/backlight/intel_backlight/brightness
512

However after KDE Plasma blanked the screen due to inactivity I got:

% cat /sys/class/backlight/intel_backlight/brightness
0

Now when I shutdown the system regularly using the GUI, Plasma would 
raise the brightness again as I move the mouse pointer. However, when I 
reboot from SSH as I did yesterday after the update, it won't.

The script takes writes zero into its state file and that it is.

Due to that I think the whole assumption that it is a sane idea to 
restore the backlight state to what has been set at the time of 
rebooting is fundamentally broken.

Actually it was one of the reasons why I switched from systemd to runit. 
Cause at one point Systemd in Debian was configured to do something 
similar and it causes some of my machines to boot up with blank and at a 
later at least very dark display.

Of course you may argue not to reboot a desktop machine via SSH. But why 
wouldn't I do so for my music player laptop?

I do not have a good idea on how to fix this issue at the moment. A work-
around would be to ensure a minimum brightness of at least 10% or 20%. 
Another idea would be to tell the desktop environment to unblank the 
screen before logging off or ask the desktop environment developers to do 
so in all cases. Or you'd just use say 80% of brightness as a default 
value and put a file into /etc to let the user manually configure it.

The best solution would be to somehow grab the *intended* brightness 
value during operation and not ever take the one during inactivity where 
the screen is blanked. But also this depends on the desktop environment. 
So… it is likely to become messy and complex.

My personal work-around for now will likely be to disable the stop 
operation of that script.

Best,
-- 
Martin