13

Ubuntu 11.10 doesn't save my brightness settings between sessions. Everytime I boot up, the brightness is always at zero, and I always have to set it back to my preferred setting (at maximum). How can I ensure that my brightness preference will persist after reboot?

3 Answers 3

6

In the file /etc/rc.local add before line exit 0:

echo 5 > /sys/class/backlight/acpi_video0/brightness

Where 5 is the brightness level from 0 to 10

2
  • 2
    The max brightness is defined in /sys/class/backlight/acpi_video0/max_brightness. The default is 15 on my laptop. So if you want to set it to 50%, you should use echo 7.
    – amazingjxq
    Dec 3, 2011 at 3:50
  • 1
    Since upstart is asynchronous it can happen that /etc/rc.local is executed before the screen is fully initialized. If this happens (it happened on my laptop) you need to add sleep 5 (or more, or less) a line above your echo ...-line
    – MadMike
    Nov 12, 2013 at 6:25
6

Basically you need to run

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

during the boot process after the graphics drivers have loaded with appropriate X and Y. The other answers and comments explain how to find X and Y.


While the /etc/rc.local suggestion works, the most consistent way of doing this, in my opinion is the following:

Create a file, say customsetbootbrightness.conf, in /etc/init (avoid collisions with existing filenames in that directory) as root with the following contents:

description "Sets brightness after graphics device is loaded"

start on graphics-device-added
task
exec echo X > /sys/class/backlight/acpi_videoY/brightness

This way, the behaviour of the system will the same as systems without this particular quirk (of brightness being 0 at startup). In the /etc/rc.local method, there is usually a small period when the brightness remains 0.


Also, this should remove the necessity (in some systems) of having to sleep 2 before echo... - not checked though. (See http://xchamitha.blogspot.co.uk/2013/07/set-screen-brightness-when-booting.html or http://ubuntuforums.org/archive/index.php/t-2061712.html for example)

2

You should probably check first:

ls /sys/class/backlight/ | grep 'acpi_video'

So you will get list of all possible displays and then you can experiment to find which is the display you want to modify. On one laptop, the screen was called "acpi_video0". Replace "acpi_video1" below with the actual screen name of your screen. On systems using the initsystem (e.g. 11.10) I must put

echo 5 > /sys/class/backlight/acpi_video1/brightness

in my /etc/rc.local file, whereas on systems using the newer upstart mechanism (e.g. 13.04) I must put this into /etc/init/screen_brightness.conf

start on runlevel [2345]
stop on runlevel [016]    

script
echo 5 > /sys/class/backlight/acpi_video1/brightness
end script

post-stop script
end script
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .