Automatic screen brightness stopped working after Neon 6.2 install

I made a fresh install of Neon 6.2 (because the tentative upgrade set my system in an unusable state)
and now the brighness is not automatically adjusted when (un)plugging my laptop AC power.

Of course I checked to appropriate settings in systemsettings.

What is weird is that it worked with the Neon USB live image, but not anymore after install.

Since I kept my home partition, I suspected it might come from my old config, but the problem persists even if I create a brand new user.

This may be related to

but is more accurately described by this other user:

any hint to solve this?

Plasma 6.2 introduced a lot of new code to handle different brightness levels on different screens, and unfortunately one result of that is behaviour changes and some edge cases that get triggered occasionally and unstable behaviours.

There are a few tickets already open that track brightness regressions:

(These are just the confirmed issues - there are a few more that are in the “reported” status, which means a developer had yet to look at them).

I suggest tracking these - they should be resolved in the 6.2 bug fix releases as one of the developers that works on these - @jpetso - is pretty active.

4 Likes

thanks!

I recently noticed something interesting. Since I had other issues after the 24.04 upgrade, in particular screen flicker and sometimes even going totally black and forcing me to do a hard restart, I search and found this

As suggested also in
https://forum.ubuntu-fr.org/viewtopic.php?id=2086257
I downgraded the kernel, by installing 6.7.0-060700-generic

This seems to work: no more black out and flicker up to now. But even better: the brightness issue is also resolved! Brigthness is now correctly updated when I plug or unplg the AC cord.

This is weird because when I checked the KDE Neon live usb image, it had 6.8.0-45-generic, brightness was working, and after install, same kernel 6.8.0-45-generic, but brightness was not working! My conclusion was that it was not a kernel-related issue. But apparently it’s more complicated! Anyways, I am happy now with 6.7.0-060700-generic and will make it my default boot kernel.

It sounds like you can workaround the issue of corruption without downgrading the kernel, I wonder if that would also affect the brightness issue.

At some point Ubuntu are going to issue an HWE update with a new kernel - likely 6.10, but possibly 6.11 - you should grab that, don’t wait 2 more years for a kernel update.

indeed, the i915.enable_psr=0 kernel parameter seems to solve the flicker issue
EDIT: in fact, not so, I just go a flicker and in dmesg:

[  513.510824] i915 0000:00:02.0: [drm] *ERROR* CPU pipe A FIFO underrun

, but has no effect for me for the brightness problem.

I am not sure if it has other consequences to video performance

BTW, can you set the brightness manually?

yes, that works

I apologize but my question may have not been clear - can you adjust the brightness using the Brightness and Color widget in the system tray?

This thing:

Yes, this works: I can change brightness using the slider

But this one below from the systemsettings does not work: change brightness slider (the orange one) and click on “apply”: nothing happens

this is driving me crazy… now even with kernel 6.7, automatic brightness does not work anymore! :sob:

I’m regularly doing system upgrades so I don’t know exactly when it happened, but approximately since yesterday

I don’t think the power management dialog should change the current brightness if you change the slider for “On AC Power” - “Change Screen Brightness”. It should only take effect when the computer moves from another power state into “On AC Power”. Same as the other power modes - changing the value for “set brightness to this level when entering this power mode” will only trigger when the power mode is changed.

That being said - on my system it doesn’t work: changing the power mode does not correctly set the brightness to the selected value, or have any other effect. I can see someone else have already complained about it in bug 484663 – Switching from low battery mode to AC power should restore previous screen brightness, so I’ve added my own comment as well.

I don’t know but this is how it worked the the Neon usb live image.

I regularly check dmesg and usually don’t see useful messages, but today I saw this, this seems related:

[   85.047099] workqueue: set_brightness_delayed hogged CPU for >10000us 4 times, consider switching to WQ_UNBOUND

Ok I could not wait more… so I now have a fairly complete workaround:

I use scripts in the “other settings” section to trigger the brightness adjustment.
The script will read the required brightness value from .config/powerdevilrc and use qdbus6 to set the value.

It works for all 3 modes: AC, Battery and LowBattery.

The script is executed when the energy mode changes (un/plug AC cord) but also when clicking “Apply” on the system settings.

Here is the common script, named brightness-powerdevil.sh, to be saved somewhere accessible from your PATH, for instance $HOME/bin, and made executable with
chmod 755 brightness-powerdevil.sh

#!/bin/bash
# This script can be used to replace the default behaviour of KDE powerdevil
# brightness management, until it is fixed upstream.
# It should be called with parameter "AC" or "Battery" or "LowBattery".
#
# sanette 2024
# https://discuss.kde.org/t/automatic-screen-brightness-stopped-working-after-neon-6-2-install/23915

energy=$1

# We use a log file for debugging
echo $(date) >> /tmp/brightness.log
echo "  Energy=$energy" >> /tmp/brightness.log

# We extract the required value (percentage) from KDE energy system
# settings (powerdevilrc)
sed_exp="sed -n '/^\["$energy"\]\[Display\]/, /^$/p' $HOME/.config/powerdevilrc | sed -n 's/^DisplayBrightness=\([0-9]\+\)/\1/p'"
value=$(eval $sed_exp)

# We get brightnessMax (for me this is 10000)
kdeMax=$(qdbus6 local.org_kde_powerdevil /org/kde/Solid/PowerManagement/Actions/BrightnessControl brightnessMax)

# We convert the percentage value into a correct brightness value
brightness=$(( $value * $kdeMax / 100 ))

# Sleep is not necessary, but it will help noticing when the issue has
# been fixed upstream
sleep 1
echo "  value=$value, Max=$kdeMax, brightness=$brightness" >> /tmp/brightness.log

# We set the new brightness. The advantage compared to directly
# accessing /sys/class/backlight/intel_backlight/brightness is that
# this should work (with KDE) without sudo
qdbus6 local.org_kde_powerdevil /org/kde/Solid/PowerManagement/Actions/BrightnessControl setBrightness $brightness
# One could also use setBrightnessSilent to suppress onscreen notification

Then in the “other settings” of the Energy settings panel, enter the name of the following scripts: brightness-ac.sh, brightness-battery.sh, and brightness-lowbattery.sh in the correspondig tabs (don’t forget chmod 755)

$ more brightness-ac.sh
#!/bin/bash
# This script can be used to replace the default behaviour of KDE powerdevil
# brightness management, until it is fixed upstream.
# It should be called when AC power is plugged in: see the Energy system settings.
#
# sanette 2024
# https://discuss.kde.org/t/automatic-screen-brightness-stopped-working-after-neon-6-2-install/23
915

brightness-powerdevil.sh AC
$ more brightness-battery.sh
#!/bin/bash
# This script can be used to replace the default behaviour of KDE
# powerdevil brightness management, until it is fixed upstream.  It
# should be called when entering Battery mode (AC power is unplugged):
# see the Energy system settings.
#
# sanette 2024
# https://discuss.kde.org/t/automatic-screen-brightness-stopped-working-after-neon-6-2-install/23
915

brightness-powerdevil.sh Battery
$ more brightness-lowbattery.sh
#!/bin/bash
# This script can be used to replace the default behaviour of KDE powerdevil
# brightness management, until it is fixed upstream.
# It should be called when entering Low Battery Mode: see the Energy system settings.
#
# sanette 2024
# https://discuss.kde.org/t/automatic-screen-brightness-stopped-working-after-neon-6-2-install/23
915

brightness-powerdevil.sh LowBattery
1 Like

I’ve been experiencing the exact same issue as you. Thank you SOOOO much for the scripts. They are working brilliantly for me.

1 Like