Desktop doesn't remember brightness settings after a reboot
The file /etc/rc.local should look 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 0 > /sys/class/backlight/acpi_video0/brightness
exit 0
Per @zerdo: In my dell studio 1558 the brightness setting is stored in /sys/class/backlight/intel_backlight/brightness
. Just change the path if your computer doesn't use the acpi_video0 folder.
Also, per @Nick :
If this is the only answer you read, note that the 0 in echo 0
is going to be your default brightness setting. I had set this up and it was driving me crazy for a long time : every time I booted up, it would set it to the lowest brightness setting. I prefer mine to start at max brightness, so I used echo 10
instead. Your hardware might vary in brightness scale.
This function, the backlight control, is dependent on your bios and kernel version.
Try these four things.
Kernel (boot) options
When you boot, at the grub screen, hit e to edit. To the kernel line add nomodeset acpi_backlight=vendor
Some hardware may work with different options.
Intel - nomodeset acpi_backlight=intel
Acer - acpi_backlight=acer_acpi
or even acpi_osi=Linux acpi_backlight=legacy
.
As you can see, you may need to google search for your settings.
quiet splash nomodeset acpi_backlight=vendor
If that works, edit /etc/default/grub
and add those options to the default options.
# command line
sudo -e /etc/default/grub
# graphical
gksu gedit /etc/default/grub
Edit the "GRUB_CMDLINE_LINUX_DEFAULT" line so it looks like this
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset acpi_backlight=vendor"
Save your edit, update grub
sudo update-grub
Command line
If that does not work, you can try to manually set the brightness.
Note: Path may vary with hardware / kernel version, may be /proc/acpi/video0 ...
, you may need to browse the /proc/acpi directory to find the brightness setting and adjust the following commands accordingly.
cat /proc/acpi/video/VGA/LCD/brightness
The output of that command varies a bit with hardware, 1 -> 10 , 1 -> 12 , 1 -> 100 ??? Choose a value and set it (choose the value for your hardware).
sudo echo 80 > /proc/acpi/video/VGA/LCD/brightness
If that works, add it to /etc/rc.local
# command line
sudo -e /etc/rc.local
# graphical
gksu gedit /etc/rc.local
Add in your setting above "exit 0"
echo 80 > /proc/acpi/video/VGA/LCD/brightness
xbacklight
You can also try xbacklight
sudo apt-get install xbacklight
You then adjust with the command line
# For 80 % brightness
xbacklight -set 80
Again, add that to /etc/rc.local
# command line
sudo -e /etc/rc.local
# graphical
gksu gedit /etc/rc.local
Add in, above "exit 0"
xbacklight -set 80
setpci
You can try to set your brightness with setpci
The general syntax is
sudo setpci -s <address> f4.B=your_setting
You identify your pci bus address with
sudo lspci | grep VGA
Example
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
setpci -s 00:02.0 F4.B=80
If you get your setting wrong, most likely you will just loose your display, and have to reboot. As this is a hardware setting, you really need to identify your hardware and research the settings first.
Examples
Intel - https://bbs.archlinux.org/viewtopic.php?id=74914
Toshiba - http://www.linlap.com/wiki/toshiba+satellite+t130
Acer extensa - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/518002
Ubuntu man page setpci
This is supposed to be configurable in the energy options, set the brightness to the desired level and it will always be used. If you use a laptop you will also need to configure the level for battery mode as well...
I found that Gnome has some issues about lcd panel brightness, e.g. if I run on battery mode and set the brightness manually to a given level and leave the laptop unattended for 10 seconds it will go back to the preset brightness when I take control back. Same goes when on A/C mode except it takes longer so goes unnoticed more easily. I believe all those settings should be saved somewhere and restored - at least for A/C mode.
EDIT: For gnome3 this does not work (at least for me).