Ubuntu – Brightness is reset to maximum on every restart

brightness

The brightness of my laptop is reset to max on every restart. I tried the solution provided at this website but had no luck.

This command

cat /sys/class/backlight/acpi_video0/max_brightness

Returns

cat: /sys/class/backlight/acpi_video0/max_brightness: No such file or directory

Then I found that I don't have a folder named acpi_video0, but a folder called intel_backlight:

screenshot of /sys/class/backlight/intel_backlight in Nautilus

Every time I increase or decrease the brightness using the brightness control keys, the values in brightness and actual_brightness get updated.

Is there any method I could follow to set the brightness to a fixed value on every boot and vary it as and when I need it using the brightness control keys?

Best Answer

You could try adding a line to /etc/rc.local that will set the desired brightness level. To edit the file, run

sudo -H gedit /etc/rc.local

and add the following

echo X > /sys/class/backlight/intel_backlight/brightness

so that the end result looks like this

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

echo X > /sys/class/backlight/intel_backlight/brightness

exit 0

Substitute X by the desired brightness level.

In case /etc/rc.local doesn't exist, as is the case with new Ubuntu releases, you'll need to create it, and make eecutable with the following commands:

printf '%s\n' '#!/bin/bash' 'exit 0' | sudo tee -a /etc/rc.local
sudo chmod +x /etc/rc.local

PS: Alternatively, there may be /sys/class/backlight/acpi_video0/brightness instead of the above. Brightness levels vary wildly, and may range from 0 to 10 or to 1000. To find the maximum value, try

cat /sys/class/backlight/acpi_video0/max_brightness
or
cat /sys/class/backlight/intel_backlight/max_brightness
Related Question