Ubuntu – Screen Brighness always come back to 1

brightnesslaptop

I am new to Ubuntu.
recently, I changed to the Xfce desktop. Everything went well, except for the brightness which couldn't be set using the keyboard. After some tries, I solved the pb with a script linked to the keyboard, that set the brightness using "xrandr –output [my screen] –brightness [value]". It went well.

I restarted my computer the next day and IT happened: the brightness changed every 1 second to a little darker or brighter setting. like, every second. Unusable.
I searched on the internet I found this : random event changes screen brightness automatically. (image :https://i.stack.imgur.com/oEh0o.png)

I followed the instructions, and restarted my computer. The brightness was fixed, but the brightness is now fixed to the maximum permanently (the max being 1, in the xrandr config). Meaning, if I change the value using xrandr, it go back to the maximum almost instantly.
I deleted the "fix" (in the 10-quirks.conf), but nothing changed.

can you help me ?

Computer hardware (using inxi command in a terminal): 
    CPU: Dual Core Intel Core i5-6200U (-MT MCP-) 
    speed/min/max: 800/400/2800 MHz Kernel: 5.8.0-38-generic x86_64 Up: 39m 
    Mem: 2070.5/3766.8 MiB (55.0%) Storage: 465.76 GiB (40.2% used) Procs: 317 
    Shell: bash 5.0.17 inxi: 3.0.38

Best Answer

Depending on your hardware, you may have more or less luck with brightness. Ideally, brightness is just remembered between boots.

You could try your luck with a utility light. Install it with the command

sudo apt install light

To be able to run it as normal user, set the suid bit:

sudo chmod u+s  $(which light)

This utility can save and restore brightness values.

Although everything works fine for me out of the box, this is a great utility that I use to be able to set the change in brightness in smaller increments. Brightness is increased with (numbers are between 0 and 100%)

light -A 1

and decreased with

light -U 1

You can set a minimum brightness, so you are not at risk to fully darken the screen:

light -N 1.95

Read the man pages for all the options.

Related Question