DEV Community

Stack All Flow
Stack All Flow

Posted on Originally published at stackallflow.com on

Brightness Is Reset to Maximum on Every Restart in Ubuntu?

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

Enter fullscreen mode Exit fullscreen mode

Returns

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

Enter fullscreen mode Exit fullscreen mode

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?

Accepted 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

Enter fullscreen mode Exit fullscreen mode

and add the following

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

Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

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 '%sn' '#!/bin/bash' 'exit 0' | sudo tee -a /etc/rc.local
sudo chmod +x /etc/rc.local

Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

The post Brightness Is Reset to Maximum on Every Restart in Ubuntu? appeared first on Stack All Flow.

Top comments (0)