Lenovo Thinkbook, Fedora 36, brightness control not working

I’ve happily been running Fedora 36 for the past few weeks, but one issue on my work laptop still needs to be resolved. The Gnome desktop brightness control is not having any affect on the screen brightness.

I am able to adjust the brightness from the command line using the following command:

echo 255 | sudo tee /sys/class/backlight/amdgpu_bl0/brightness

This is not ideal, so to mitigate, I created a function in my .zshrc as follows:

function set_brightness() {
  echo $1 | sudo tee /sys/class/backlight/amdgpu_bl0/brightness;
}

This allows me to set the brightness with something like set_brightness 128. Less painful, but having the slider or keyboard brightness control shortcuts work would be preferrable.

There are two backlight folders that can be found on my laptop, one for each GPU:

  • /sys/class/backlight/amdgpu_bl0
  • /sys/class/backlight/nvidia_0

What I did noticed is that the brightness slider/keyboard brightness controls actively changes the brightness setting in the file at /sys/class/backlight/nvidia_0/brightness, however, this has no visual effect. This setting, seemingly just needs to get synchronized with /sys/class/backlight/amdgpu_bl0/brightness, scaled to whatever value can be found in max_brightness off course.

I experimented a bit by watching the nvidia_0/brightness for changes, and simply overriding amdgpu_bl0/brightness with its value when a filesystem change event occurs, and this works. This could work if implemented as a service, but it feels rather hacky, there must be a better way.

Let me provide some machine details, I have a Lenovo ThinkBook with the following specs:

If I run lspci -k | grep -A 3 VGA I get the following output:

01:00.0 VGA compatible controller: NVIDIA Corporation GA106M [GeForce RTX 3060 Mobile / Max-Q] (rev a1)
	Subsystem: Lenovo Device 3801
	Kernel driver in use: nvidia
	Kernel modules: nouveau, nvidia_drm, nvidia
--
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne (rev c5)
	Subsystem: Lenovo Device 3804
	Kernel driver in use: amdgpu
	Kernel modules: amdgpu

uname -r reports kernel version 5.19.4-200.fc36.x86_64

My Nvidia drivers seem to be installed correctly, I used the following commands to install them:

sudo dnf install akmod-nvidia
sudo dnf install xorg-x11-drv-nvidia-cuda

nvidia-smi reports the following

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.65.01    Driver Version: 515.65.01    CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   37C    P0    N/A /  N/A |      3MiB /  6144MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      6570      G   /usr/bin/gnome-shell                2MiB |
+-----------------------------------------------------------------------------+

I hope I’ve provided adequate details. I’ve been reading around a bit to try and resolve this issue for the past few days, with no luck at all.

I tried suggestions like trying to edit the grub configuration by adding acpi_backlight amongst some other things. None of these so far, worked for me.

Another suggestion I got was to mount the nvidia_0 folder right over the amdgpu_bl0, this seems to work if I do the mount from the command line, but it’s rather risky and once again, quite a makeshift way to try and fix the problem. I had some challenges getting this to mount at boot, something was overriding the changes, and restoring the original amdgpu_bl0 folder.

I also tried switching between Wayland and X11, but this had no effect at all.

One last noteworthy mention is that my boot log reports Failed to start nvidia-power.service, but I doubt that this service is the cause.

Any ideas how I can fix the screen brightness control?

On a system with dual gpus it is normal to see the desktop settings slider associated with one or the other. It would be abnormal to see it affecting both at the same time.

One possible way to make it work as you expect would be to make the nvidia gpu primary as found here. That would put the nvidia GPU in control of the laptop screen full time and thus settings there would probably affect your active display.

How to have that brightness control active on the IGP instead of the dGPU is not something I can help with.

Thanks for the reply, Jeff. I guess setting the Nvidia GPU as primary is a viable option, it would be at the cost of higher battery consumption, but I’m mostly plugged in anyways, so it’s not that big an issue.

However, I think in that case, keeping the two brightness files in sync is probably not that much of a bad idea either. That way, I guess if for some reason the primary display switches to one or the other GPU, the brightness adjustment should remain the same.

Problem is, what happens if the OS decides to start updating the other file instead, there are no guarantees.

1 Like

Hi,
since today im having a similar problem:
Both my brightness slider and my hotkeys stopped having an effect.
they change the values in the brightness file as well but thats about it.
Changing the values manualy as mentioned above didnt change anything either.

My system:
Laptop: Thinkpad P14sG2 AMD (So no dGPU just iGPU)
Kernel: 5.19.6-200.fc36.x86_64 (thats the main thing that changed since last reboot)
My GPU is called amdgpu_bl1 (not 0)

i tried installing xbrightness and also played arround with this: Brightness Issue, Lenovo, Fedora 33 - Unix & Linux Stack Exchange but no result.

MY guess is that its not the file thats the problem but some entry between that file and the actual brightnes change code changed its (default) value.

I dont know enough how it actualy works to know where to look.

Does someone know how the “chain of command” works for brightness from hotkey pressing to actual change?

That’s really strange. Have you tried switching between Wayland and X11, if Fedora 33 supports that, not sure if that will make a difference, but worth a try.

Oh, im on 36. The link was only one of the leads i followed.

Have you made any progress towards the origin of your problem. maybe its a common one. I don’t reboot my laptop that often. Maybe i skipped the kernel version you’re on.

I came across this link on askubuntu.com. This essentially involves watching the brightness file that gets updated using inotify, and then calculating and synchronizing that change to the other brightness file.

Do you also have two folders inside /sys/class/backlight?

I also checked services running on my machine, systemctl indicates the following two services are running:

sys-devices-pci0000...-backlight-nvidia_0.device
sys-devices-pci0000...-backlight-amdgpu_bl0.device

I would like to sniff around here a bit, but I have a suspicion that these two are fighting over some system events that relate to changing the backlight brightness. I have no idea how it works, but it might be that the change events are captured by the Nvidia service, and the AMD one never even gets the event notification.

Once again, I have no idea about these internal workings, I’m purely speculating here.

Just rebootet a couple of times and wnated to check my services and its workign again.

So sadly i cant debug this with you together. I wiuld however suggest you disable your dgpu and see if that gets the igpu backlight control working. If you havent tried that allready.

The reason for me going with an amd igpu was exactly the reason to not have slow intel gfx, nvidia driver hell and dual gpu entanglements.

I hope you get your thing solved. ill be back if it fails again :smiley:

GPU issues still plaguing me, so I tried to set the Nvidia GPU as primary today. Followed the recommended walkthrough from [How to Set Nvidia as Primary GPU on Optimus-based Laptops :: Fedora Docs](https://this link), but on Wayland, it has no effect. Attempting to login using X11 ends up with the thing infinitely looping back to the login screen, and I’m not sure how to debug that.