I am working on a XMG Core 15 with Ubuntu 20.04. (kernel 5.11.0.27-generic since the newer ones cause problems with my screens) and a NVIDIA GeForce RTX 2060 (NVIDIA driver 470) and AMD Ryzen 7 4800H. My problem is that every time I reboot my laptop, the display brightness resets to the minimum but the actual screen brightness is maximum. If I double check in settings the slider on brightness is in the minimum position. The strange thing is if I plug in or out the power cable the screen brightness jumps to the value in the settings. It is no big problem but it is really annoying. My question is now, how can I prevent it from resetting the brightness every reboot and set the brightness to a specific value. I hope I have described the problem in an comprehensible way.
If you need additional information feel free to ask. I am glad for every help of you.
Thanks and best regards, Daniel
Update #1. After undo the first step and do the steps from Update #1 the brightness still resets after rebooting. I did the following modifications:
Create a file
-rwxr-xr-x 1 root root 180 Feb 7 19:20 set_brightness.sh*
in/etc/rc.local
with the following content:#!/bin/sh
#. Set specific brightness level to work around bug
#. See /etc/systemd/system/set_brightness.service
#.
sleep 15; echo 255 | tee /sys/class/backlight/amdgpu_bl0/brightnessCreate second file
-rw-r--r-- 1 root root 172 Feb 7 19:23 set_brightness.service
in/etc/systemd/system
with the following content:[Unit]
Description=Set screen brightness to work around bug
[Service]
Type=oneshot
ExecStart=/bin/sh /etc/rc.local/set_brightness.sh
[Install]
WantedBy=multi-user.target
The status looks as follow:
(base) daniel@xmg-daniel:/etc/systemd/system$ systemctl status set_brightness.service
● set_brightness.service - Set screen brightness to work around bug
Loaded: loaded (/etc/systemd/system/set_brightness.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Output of ls -al /sys/class/backlight/
:
total 0
drwxr-xr-x 2 root root 0 Feb 7 19:49 .
drwxr-xr-x 84 root root 0 Feb 7 19:49 ..
lrwxrwxrwx 1 root root 0 Feb 7 19:49 amdgpu_bl0 -> ../../devices/pci0000:00/0000:00:08.1/0000:06:00.0/backlight/amdgpu_bl0
Some other remarks: With the first modifications the slider of the brightness was set to the same position as before rebooting also the actual brightness was the same as before rebooting, but after pluging in or out the power cable the brightness was set automatically to minimum. Also with this modification my bluetooth turned on automatically after rebooting although I turned it off everytime. Undoing the first modifications and doing update #1 the bluetooth issue was solved but it looks like the workaround is not working correctly.
After doing the steps from @heynnema mentioned in the comments I have the following output for systemctl status set_brightness.service
:
● set_brightness.service - Set screen brightness to work around bug
Loaded: loaded (/etc/systemd/system/set_brightness.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2022-02-07 20:14:00 CET; 7s ago
Process: 4546 ExecStart=/bin/sh /etc/rc.local/set_brightness.sh (code=exited, status=0/SUCCESS)
Main PID: 4546 (code=exited, status=0/SUCCESS)
Feb 07 20:13:45 xmg-daniel systemd[1]: Starting Set screen brightness to work around bug...
Feb 07 20:14:00 xmg-daniel sh[4549]: 255
Feb 07 20:14:00 xmg-daniel systemd[1]: set_brightness.service: Succeeded.
Feb 07 20:14:00 xmg-daniel systemd[1]: Finished Set screen brightness to work around bug.
But the problem is still there. When plugging in or out the power cable the brightness switches automatically to minimum.
Sorry for the bad formatting of my update, I wanted to code sample the content of the two files but somehow it is not working ...