Ubuntu – Why does Ubuntu reset brightness settings at the loading screen

backlightbrightnessdell-studio-xps-16laptop

Since I first installed Ubuntu 11.10, I noticed that volume and screen brightness get reset every time Ubuntu starts.

Why is this so? And what ways are there to keep brightness and volume levels after rebooting?

I have found some scripts that change the screen-brightness at login. But this is not a good solution since

  • login is slower because it seems to wait until the screen brightness is at the level specified by the script. After entering the password I see the screen brightness go down gradually. Only after this is complete (~1 or 2 seconds) does the background disappear and Unity come up.
  • The screenbrightness is not remembered but instead redefined at login. So it gets remembered for the first part of the boot, then set to MAX and then again re-set to normal value by the script. My boot process is as follows:
    desired brightness: 2 (13,33%) / Max brightness: 15 (100%)

    1. Bios / brightness: OK
    2. GRUB (violet background color, white text) / brightness: OK
    3. Ubuntu loading screen with the dots / brightness: MAX (win7 loads with OK-brightness)
    4. User Login / brightness: MAX
    5. Unity starts / brightness: OK
  • It seems to be more like a temporary patch than a actual solution.

I'm looking for solutions that set the desired brightness permanently and consistently throughout the whole boot-process

After updating to 12.04 the behavior is the same.

I tried

  • setpci -s 02:00.0 F4.B=XX
    The value of F4.B is always '0' regardless of what value I try to set it to (tried 0, ff, f, 5, etc)
  • The solution in this answer does not have any noticeable effect: Desktop doesn't remember brightness settings after a reboot
    The variables at /sys/class/backlight/acpi_video0/ get changed if I use Fn+UP and Fn+DOWN

Any help is appreciated. Thanks!

Best Answer

With this guide you can save your brightness level on reboot/shutdown and bring it back after system startup. This does not affect system boot up time.


Make a text file in your home directory (or wherever else) to save the brightness level in it. Open up terminal by pressing Ctrl+Alt+T, then enter the following command:

sudo gedit /home/brightness

Save and exit gedit. Just let it be empty. Then type this command in terminal:

sudo gedit /etc/rc0.d/K99FixBrightness

And copy paste the following bash script into it:

#!/bin/bash
brightness=`cat /sys/class/backlight/acpi_video0/brightness`
echo $brightness > /home/brightness
exit 0

Then make it executable by entering: sudo chmod 644 /etc/rc0.d/K99FixBrightness in terminal. Rpeat above steps with rc6.d directory:

sudo gedit /etc/rc6.d/K99FixBrightness

Just so:

#!/bin/bash
brightness=`cat /sys/class/backlight/acpi_video0/brightness`
echo $brightness > /home/brightness
exit 0

Then make it executable by entering: sudo chmod 644 /etc/rc6.d/K99FixBrightness in terminal. Until now we set up the brightness level to be saved in /home/brightness before shutdown and reboot. One step to go! Enter the following command in terminal:

sudo gedit /etc/rc.local

Add this before the last line "exit 0":

brightness=`cat /home/brightness`
echo $brightness > /sys/class/backlight/acpi_video0/brightness

Save and exit gedit. Now with system startup the last brightness level will be loaded!

Done! :)