I have a laptop running Xubuntu 12.10 that doesn't save the brightness setting on reboot. There are some explanations on Ask Ubuntu about how to have a specific brightness be set on reboot, but not how to save the brightness from last time. How can this be done?
1 Answer
Create a Bash script to save the brightness:
sudo nano /etc/acpi/save-brightness.sh
It should contain this:
#!/bin/bash
# Saves brightness settings on reboot/shutdown
cat /sys/class/backlight/acpi_video0/brightness > /etc/acpi/brightness
Make it executable:
sudo chmod +x /etc/acpi/save-brightness.sh
Switch to the /etc/rc0.d
directory and symlink the script to a link in /etc/rc0.d
:
cd /etc/rc0.d
sudo ln -s ../acpi/save-brightness.sh K99-save-brightness
Do this again in the /etc/rc6.d
directory (rc0
is for reboots and rc6
is for shutdowns).
Now edit /etc/rc.local
to reload the brightness setting on boot.
On a separate line just before the last line that's already there (exit 0
), put:
cat /etc/acpi/brightness > /sys/class/backlight/acpi_video0/brightness
Sources:
[1] http://en.kioskea.net/faq/3348-ubuntu-executing-a-script-at-startup-and-shutdown