6

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!

leugim
  • 161

3 Answers3

2

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! :)

1

Have you tried the following?

Open Terminal (Press Ctrl+Alt+T) and type:

sudo gedit /etc/rc.local

Add this before the last line "exit 0":

echo 4 > /sys/class/backlight/acpi_video0/brightness
jasmines
  • 11,011
  • I edited /etc/rc.local but it has no effect ... I did a few reboots to make sure. The value of /sys/class/backlight/acpi_video0/brightness is always 15 after reboot. – leugim Jun 20 '12 at 14:57
  • Have you other folders in /sys/class/backlight/ besides acpi_video0 ? For example, I've got /sys/class/backlight/intel_backlight/brightness too, and I would add also echo 4 > /sys/class/backlight/intel_backlight/brightness to /etc/rc.local – jasmines Jun 20 '12 at 15:01
  • Thank you for taking the time to look into this! I have just that one acpi_video0 folder nothing else. It has a litlle black arrow, though as if it were a shortcut? – leugim Jun 20 '12 at 15:24
  • Yes, it's a symlink. If you want to know the original folder, just type ls -la /sys/class/backlight/, but this won't help much. – jasmines Jun 20 '12 at 15:29
0

This method will not slow down anything. Press Ctrl+Alt+t for openeing terminal then use -

cat /sys/class/backlight/acpi_video0/max_brightness

it will give you the maximum brightness value, to change it for after booting open-

sudo gedit /etc/rc.local

and add the line shown below before exit , look at the screenshort I have attached-

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

Change 0 to the value you want in the start as got from previous command output.

as shown here-here changing

Now just save it and restart. Hope it helped you.

Sukupa91
  • 3,037
  • 2
  • 20
  • 33