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.

Is it possible to set the default display brightness so you don't have to re-adjust it everytime you reboot? My laptop display is killing my eyes at the login screen already because it starts at 100% brightness every time.

share|improve this question
    
possible duplicate of How to make GNOME remember brightness setting –  Jorge Castro Oct 15 '11 at 11:32
    
Try this askubuntu.com/questions/481413/… –  KasiyA Jul 6 at 21:30
    
@jeremy why don't you accept the ans as my answer seems to be a valid one –  dhanvi Dec 15 at 19:25

5 Answers 5

Review of solutions and offering a (hopefully) better one

Previous solutions

/sys/-based : good for console

@gan

This works echo 5 > /sys/class/backlight/acpi_video0/brightness but does not play well with X. More specifically, X is not aware about your preferred settings and you may end up needing to set the brightness manually again at least once, similar to bug #1042359 .

setpci-based : system-dependent, dangerous

@erickjohncuevas

Solutions based on things like setpci -s 01:00.0 F4.B=50 are dangerous. There, 01:00.0 is actually an ID targeting a particular board on the PCI bus. And it is system-dependent. That means blindly following this may write configuration registers on some other boards where it may mean anything, from just nothing to crashing the system at some point in the future. Anyway it does not play well with X either.

Proposed solution

Advantages/drawbacks

The solution below has these advantages:

  • plays nice with X which is fully aware of the settings chosen
  • is more readable, thus maintainable
  • does not contain system-specific address, etc, and as a result may work on a wider range of hardware (e.g. where kernel does not know about backlight, or that don't even use PCI-based video board, think Ubuntu for ARM )

It assumes: Ubuntu using lightdm (that is 11.10 and beyond)

It only sets backlight when lightdm starts. But it can be combined with the /sys-based solution above if you really need to set backlight earlier.

The solution

Copy-paste of this should do what you need (sudo will probably ask your password).

# Install xbacklight in case it is not already installed (small).
sudo apt-get install xbacklight
# You should test xbacklight with command-line to see if it works. For example:
# xbacklight = 100 ; sleep 2 ; xbacklight = 30
# Try to figure out a suitable value for your hardware and lighting conditions.

# This creates a small script running xbacklight.
# You can change the =30 into another value if you wish. 
# The "|| true" ensures that if xbacklight fails for any reason, X can still start.
sudo bash -c '{
echo "#!/bin/bash"
echo "xbacklight =30 || true"
} >> /etc/lightdm/display-setup-script.sh '

# This makes that script executable
sudo chmod a+rx /etc/lightdm/display-setup-script.sh

# This instructs lightdm to run the script when starting X.
# Specifically, it adds a line display-setup-script in a lightdm configuration file/, but only if there is not one already.
if grep -ri ^display-setup-script /etc/lightdm/
then 
  echo "There may be already a display-setup-script. It may already do what you need. Else please adjust manually" ; 
else 
  if [[ -d /etc/lightdm/lightdm.conf.d ]]
  then
    # Ubuntu 13.10 and above have lightdm.conf.d. 14.04 *only* have lightdm.conf.d
    DESTCONFFILE=/etc/lightdm/lightdm.conf.d/20-default-brightness.conf
  else
    # Ubuntu 12.04, 12.10 do not have lightdm.conf.d, we change main configuration file
    DESTCONFFILE=/etc/lightdm/lightdm.conf
  fi
  echo "Writing into $DESTCONFFILE"
  sudo bash -c "{ echo '[SeatDefaults]' ; echo display-setup-script=/etc/lightdm/display-setup-script.sh ; } >>$DESTCONFFILE" ; 
fi

May be tested by restarting lightdm from a root session on the console. Or, more simply, by rebooting.

Tested on Ubuntu 12.04, 12.10, 13.10, works like a charm. Adjusted for 14.04.

Please provide feedback about your experience.

share|improve this answer
1  
On a freshly installed Ubuntu 12.10, copy-paste of the lines above just works. –  Stéphane Gourichon Jan 2 '13 at 15:38
    
Works for me too. –  Pawelmhm Sep 21 '13 at 11:01
    
On a freshly installed Xubuntu 13.10, copy-paste of the lines above just works. –  Stéphane Gourichon Nov 7 '13 at 5:41
    
Adjusted just now for Ubuntu 14.04, tested, works. If xbacklight fails, does not prevent X from starting. –  Stéphane Gourichon Jul 6 at 21:46

It isn't default. Whenever I reboot my brightness is set to 100%. Luckily I saw

$ echo 5 > /sys/class/backlight/acpi_video0/brightness

and before that,

$ chmod o+w /sys/class/backlight/acpi_video0/brightness
share|improve this answer

this works in my 12.04 How set brightness on startup – Ubuntu 12.04

every time i boot up, it is set already. hope it will help you.

share|improve this answer

This should do the trick:

System settings -> Screen -> Brightness

Use the slider to adjust default setting.

enter image description here

share|improve this answer
8  
Doesn't "stick" for reboots, at least for me on Precise (12.04) for an HP Envy Ultrabook –  hobs Aug 11 '12 at 18:14
    
Same with Acer Aspire One –  Martin Delille Nov 11 at 13:40

source

actually echoing some value to doesn't help in the brightness as the value will differ from system to system

first what you need to do is to set the brightness of the screen to the level comfortable to you, which can be easily done by in system settings --> brightness and lock or by using the function keys.

now go to the /sys/class/backlight/your_folder (mine was intel_backlight)

screen shot of the folder

in this folder you can see hte actual_brightness file and the max_brightness file (don't forget to refresh the files Ctrl+R or F5 to see the actual settings if you have done any changes to the brightness after opening this file)

Now we need the same value as in the brightness every time we start our system this can be done by changing every time the value in this folder at the startup we need to change the rc.local file

first type this command in the terminal (can be opened by searching for terminal in the dash or by pressing the shortcut Ctrl+Alt+T)

sudo -i
gedit /etc/rc.local

and make sure that you add the line

echo 900 > /sys/class/backlight/intel_backlight/brightness

Please replace the 900 value with what ever value you need (the value you get when see in the above procedure also the intel_backlight with what ever the folder name in the backlight folder)

screen shot of the gedit

the line rfkill block bluetooth was added in my rc.local file as I don't use bluetooth at all but ubuntu starts bluetooth everytime it reboots(even if the bluetooth was in off condition before), to avoid such thing I have used it. You can also add it (in case you wanted to use bluetooth you can always start it again even if this line is include in you rc.local)

Don't change the value of exit 0 in the ending if it doesn't exist just add it in the ending

Now even if you have restarted the system you will have the same value that you need (the value that you have given after the echo)

Be-careful don't give the value of brightness greater that max_brightness value as that will through you an error saying that it is an Invalid argument.

share|improve this answer

protected by Community Feb 13 '12 at 12:24

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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