Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a problem with my brightness setting. When I decrease brightness to 1 and I reboot the computer, it reset to maximum brightness value. I tired to adjust it and decrease it again to 1. Why the setting doesn't save the last brightness setting for me? How can I save the current value and restore it after reboot via programming?

I also tried to add echo 0 > /sys/class/backlight/intel_backlight/brightness in /etc/rc.local file, but after rebooting, it reset to the maximum again.

My laptop model is Vaio SVF1521DCXW.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I had another folder named acpi_video0 in this location /sys/class/backlight/

I added following command at the end but before exit 0 in gksu gedit /etc/rc.local file:

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

It worked for me. And now I want to get current brightness and save it into a file to restore it at next restart.

How to functionality last adjusted brightness load after next reboot?

Step 1: Check brightness levels

Set your brightness to maximum and check current level by below command:

 cat /sys/class/backlight/acpi_video0/max_brightness

   (my laptop max brightness is 100 :)

Now set your brightness to minimum and check current level by evoking next command:

 cat /sys/class/backlight/acpi_video0/brightness

   (my laptop min brightness level is 0 :)

Step 2: Create a file to store your current brightness:

 sudo touch /etc/init.d/prev_brightness
 sudo chmod o+w /etc/init.d/prev_brightness

Step 3: Create a script that stores your current brightness(the save_screen_brightness file) when shutting down into the file prev_brightness that you created in the previous step:

 sudo touch /etc/init.d/save_current_brightness
 sudo chmod +x /etc/init.d/save_screen_brightness

Open the save_screen_brightness file with your favorite editor app:

 gksu gedit /etc/init.d/save_screen_brightness

And put this script into it:

 cat /sys/class/backlight/acpi_video0/brightness > /etc/init.d/prev_brightness

Save it and go to next step ;)

Step 4: Make the script run every time we shutdown or reboot the computer:

 sudo ln -s /etc/init.d/save_current_brightness /etc/rc0.d/K99save_screen_brightness
## Shuttingdown ^^
 sudo ln -s /etc/init.d/save_current_brightness /etc/rc6.d/K99save_screen_brightness
## Rebooting ^^

Step 5: Load the value we stored when starting the computer:

Add the following line at the end and before exit 0 into your /etc/rc.local file:

 cat /etc/init.d/prev_brightness > /sys/class/backlight/acpi_video0/brightness

That's it ;)

Thanks to @Hevilath's answer and @user207402's answer and also @AiPdimi's answer

share|improve this answer

make a file like fixMaxBrightness.sh

copy all these line to it, make it executable by chmod +x fixMaxBrightness.sh and run it by this command sudo ./fixMaxBrightness.sh restart your system.

#this script are going to get last change screen Brightness
#and put it in /.FixBritness
#this folder is in home directory that the following line make it 
mkdir $HOME/.FixBritness
cd $HOME/.FixBritness

#make two another script that put current brightness in "currntBritness" file, 
#and it must run when system is going down
cat > getBritness.sh <<_EOF_
cat /sys/class/backlight/acpi_video0/actual_brightness > $HOME/.FixBritness/currntBritness
exit 0

#to get last brightness that saved in "currntBritness" file
#and put it in system brightness file 
cat > putLastBritness.sh <<_EOF_
cat $HOME/.FixBritness/currntBritness > /sys/class/backlight/acpi_video0/brightness
exit 0

# create currntBritness file and put zero to defult value
touch currntBritness
echo 0 > currntBritness

chmod 755 getBritness.sh
chmod 755 putLastBritness.sh
#put in /etc/init.d/ because these file will use in /etc/rc1 through rc6
mv getBritness.sh /etc/init.d/
mv putLastBritness.sh /etc/init.d/

#make a symbolic link to  getBritness.sh that get brightness when:
#shutting down
ln -s /etc/init.d/getBritness.sh /etc/rc0.d/S11getBritness.sh
#and restart
ln -s /etc/init.d/getBritness.sh /etc/rc6.d/S11getBritness.sh

#symlink to put last brightness when system start.
ln -s /etc/init.d/putLastBritness.sh /etc/rc1.d/S66putLastBritness.sh
ln -s /etc/init.d/putLastBritness.sh /etc/rc2.d/S66putLastBritness.sh
ln -s /etc/init.d/putLastBritness.sh /etc/rc3.d/S66putLastBritness.sh

exit 0
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.