Ubuntu: Brightness is reset to maximum on every restart



Question:

The brightness of my laptop is reset to max on every restart. I tried the solution provided at this website but had no luck.

This command

cat /sys/class/backlight/acpi_video0/max_brightness  

Returns

cat: /sys/class/backlight/acpi_video0/max_brightness: No such file or directory  

Then I found that I don't have a folder named acpi_video0, but a folder called intel_backlight:

screenshot of /sys/class/backlight/intel_backlight in Nautilus

Every time I increase or decrease the brightness using the brightness control keys, the values in brightness and actual_brightness get updated.

Is there any method I could follow to set the brightness to a fixed value on every boot and vary it as and when I need it using the brightness control keys?


Solution:1

You could try adding a line to /etc/rc.local that will set the desired brightness level. To edit the file, run

sudo -H gedit /etc/rc.local  

and add the following

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

so that the end result looks 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 X > /sys/class/backlight/intel_backlight/brightness    exit 0  

Substitute X by the desired brightness level.

PS: Alternatively, there may be /sys/class/backlight/acpi_video0/brightness instead of the above. Brightness levels vary wildly, and may range from 0 to 10 or to 1000. To find the maximum value, try

cat /sys/class/backlight/acpi_video0/max_brightness  or  cat /sys/class/backlight/intel_backlight/max_brightness  


Solution:2

I converted my small script for saving and restoring backlight (brightness) level to Ubuntu package. It is located in my PPA and named sysvinit-backlight. It contain syvinit init-script, placed in /etc/init.d/sysvinit-backlight. It is compatible with Ubuntu 12.04 LTS and 14.04 LTS. Ubuntu 14.10 users should upgrade to 15.04 and use builtin systemd-backlight service.

You can install my script with the following commands:

sudo add-apt-repository ppa:nrbrtx/sysvinit-backlight  sudo apt-get update  sudo apt-get install sysvinit-backlight  

You can remove it by

sudo apt-get purge sysvinit-backlight  

Please note: if you have installed the previous version of my script, please remove it by

sudo rm /etc/rc?.d/?25backlight /etc/init.d/brightness /etc/rc?.d/?25brightness  

The script functionality is:

  • save backlight (brightness) levels of all video adapters and keyboard on reboot and shutdown (runlevel 0 and 6)
  • load backlight (brightness) levels for all video adapters and keyboard on boot (runlevels S, 1, 2, 3, 4 and 5)

The script options are:

  • sudo service sysvinit-backlight status (show current brightness levels and saved in files values)
  • sudo service sysvinit-backlight start (set saved levels from files)
  • sudo service sysvinit-backlight stop (save current levels to files)

You can contact me here or on launchpad.


Solution:3

Easiest way:

  1. Open a terminal window.

  2. Type in the following command then hit Enter after it.

    sudo apt-get install xbacklight  
  3. Open the Startup Applications Preferences menu.

  4. Click the Add button and add the following information:

    • Name: Brightness
    • Command: xbacklight -set 60
  5. Replace 60 with whatever brightness level you prefer.

Source: Set Startup Display Brightness


Solution:4

Before try workarounds in rc.local, it is worth to try the following:

  • adding simple: quiet splash acpi_backlight=vendor to grub looks to be enough on my configuration.

    1. sudo gedit /etc/default/grub
    2. replace
      GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
      with
      GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset acpi_backlight=vendor"

    3. sudo update-grub and reboot.

worked on:

  • Ubuntu 12.04 LTS (Asus U31SD-XH51 )
  • Ubuntu 14.04 LTS (Dell 14z)
  • Ubuntu 14.04 LTS (Lenovo g500, remove nomodeset and it will work fine)


Solution:5

I modified the code in /etc/rc.local like this:

Get maximum brightness:

$ cat /sys/class/backlight/intel_backlight/max_brightness  4882  

Run gksudo gedit /etc/rc.local and edit the file:

#!/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 4882 > /sys/class/backlight/intel_backlight/brightness  exit 0  

That worked for me.


Solution:6

The solutions offered here are somehow system-dependent.

A good design is to have one place that takes care of system-dependent details and provide a unified interface. It seems that currently the kernel does not offer such an easy interface through /sys. At X level, though, there is one : xbacklight.

A solution based on xbacklight is offered on How do I set default display brightness?, for 11.10 and up.

Plus, it should not have the problems reported on some areas (e.g. http://ubuntuguide.net/how-to-save-screen-brightness-settings-in-ubuntu-12-04-laptop ) that wrong brightness comes back in some situations.


Solution:7

Install xbacklight (sudo apt-get install xbacklight) and add

xbacklight -set x  

(where 'x' = 0 to 100 desired brightness) to the startup applications via dashboard. For example:

xbacklight -set 50  


Solution:8

How to debug backlighting:

https://wiki.ubuntu.com/Kernel/Debugging/Backlight

Unfortunately just adding acpi_backlight=vendor doesn't seem to save the default value for my 12.04 Lenovo G575.


Solution:9

I use a Sony Vaio S model and hybrid graphics. I disabled my ATI G card and so my intel HD 3000 serves as my only g card.

I found that setting the brightness value to the file actual_brightness in the intel_backlight folder will help. and the other wont.

for me my minimum brightness value is 236 and maximum is 4648, so you may set a value anywhere between this.

so try this:

echo 236 > /sys/class/backlight/intel_backlight/actual_brightness  


Solution:10

My laptop is Compaq Presario CQ62 111TU, installed Ubuntu 12.04. The Following steps worked for me well.

  1. Adjust the screen brightness to your preferred level.
  2. Open Terminal and enter cat /sys/class/backlight/intel_backlight/actual_brightness and take down the value.
  3. Enter cat /sys/class/backlight/acpi_video0/actual_brightness and take down the value.
  4. Enter sudo gedit /etc/rc.local and add these before the last line exit 0 in gedit:

    echo ValueFromStep2 > /sys/class/backlight/intel_backlight/brightness  echo ValueFromStep3 > /sys/class/backlight/acpi_video0/brightness  

save and enjoy.

My settings are shown below

#!/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 478 > /sys/class/backlight/intel_backlight/brightness  echo 0 > /sys/class/backlight/acpi_video0/brightness    exit 0  


Solution:11

I find N0rbert's solution to be the best one, as the script that he's provided allows to restore your previous brightness level on startup.

Although, there was a small modification that I had to introduce to his solution to make it work. Instead of creating symbolic links that he's mentioned, I've provided the following:

ln -s /etc/init.d/brightness /etc/rc0.d/S25backlight  ln -s /etc/init.d/brightness /etc/rc2.d/S25backlight  ln -s /etc/init.d/brightness /etc/rc6.d/S25backlight  

Notice, that instead of rcS.d, I've added a symbolic link to rc2.d, which is a runlevel for "Graphical multi-user with networking" (see more). I believe that the reason why the former one doesn't work for me is Ubuntu overriding brightness level after it has been set up by the /etc/init.d/brightness script during S runlevel.

With that subtle change, restoring brightness level works like a charm, especially for Ubuntu 14.04 LTS on Lenovo ThinkPad L540.


Solution:12

No need to fall into scripting and coding.

Just follow these simple steps:

If screen brightness is stuck at maximum every startup, install xbacklight (sudo apt-get install xbacklight) and add "xbacklight -set x" (where 'x' = 0 to 100 desired brightness) to the startup applications via dashboard. For example, "xbacklight -set 50".

I have set brightness for my laptop to 30.

Source: https://help.ubuntu.com/community/AsusZenbookPrime [Search for word "brightness" and read related paragraphs on this source page.]

Enjoy!!


Solution:13

I added the following into /etc/rc.local, to manage the display brightness and keyboard backlit and it works perfectly

...  echo 30 | sudo tee /sys/class/backlight/acpi_video0/brightness  echo 3 | sudo tee /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness    exit 0  


Solution:14

Use this command to discover your current brightness level:

cat /sys/class/backlight/intel_backlight/brightness  

Then, edit rc.local file using this command:

gksudo gedit /etc/rc.local  

Add this line before exit 0 line:

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

If this don't solve the problem, can be that something in your system is overwriting the brightness level. Then, you can try add a sleep command to delay the execution of the previous command:

(sleep 10 && echo X > /sys/class/backlight/intel_backlight/brightness)  

Source


Solution:15

It is well worth checking the max_brightness files for the absolute maximum values in /sys/class/backlight/intel_backlight and /sys/class/backlight/acpi_video0 directories to avoid setting unusable values.

My Dell Inspiron 5720 uses maximum values of 4882 and 100 respectively. I have set these to 2508 and 52 to prolong battery life. ACPI value in this case is equivalent to the percentage of the maximum brightness.

Editing rc.local works for me. I added comments to clarify how the values were determined. set required brightness with function keys and read values in brightness or actual_brightness files in each of the above Intel / ACPI directories.


Solution:16

For mint mate 17, you can set the default brightness by following steps:

  • sudo apt-get install dconf-tools
  • Applications -> System Tools -> dconf tools,
  • search for backlight, find and change following options:

    • brightness-ac
      brightness when use AC powser (charged),
    • brightness-dim-battery
      brightness when use battery (not charged),


Solution:17

all replies are helpful but didnt help me what i was trying to achieve. i wanted pre-defined levels of brightness for battery and ac power.

  1. use laptop mode tools from here laptop mode tools
  2. edit the conf file for brightness and replace [values] with the values you want. like "echo 1" for battery.wiki

works for me :)


Solution:18

Change default brightness level in Ubuntu 14. 04 LTS / Brightness is reset to Maximum on every Restart on Ubuntu 14.04 LTS

Here is what i found out.

In my case I had both the folders.

And when I changed the default brightness level, it took the change from the file in the folder acpi_video0. i.e. from the second line of code.

Here is the code that will be helpful for setting the default brightness level for Ubuntu 14.04 LTS.

#!/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.  #  #  #  #if you are changing the default brightness in Ubuntu 14.4 LTS  #the brightness under the folder acpi_video0 is important.  #Because brightness is set from that folder and not from intel_backlight  #(in case of my PC. It may very in others)  #That means you can omit the first echo line.  #However the command lines are given if any one has some problem and doesnot  #have the acpi_video0 folder  echo 1020 > /sys/class/backlight/intel_backlight/brightness  #Under the above given address the range of brightness is from 0 to 4648.  echo 3 > /sys/class/backlight/acpi_video0/brightness  #Under the above given address the range of brightness is from 0 to 7.  exit 0  


Solution:19

This works on ubuntu 16.10

Create a file brightness.service in /lib/systemd/system with the following contents(Change 100 to whatever brightness you want, roughly it's between 0 ~ 1000).

[Unit]  Description=Lower default brightness    [Service]  ExecStart=/usr/bin/zsh -c "echo 100 > /sys/class/backlight/intel_backlight/brightness"    [Install]  WantedBy=multi-user.target  

Enable it.

sudo systemctl enable brightness.  

Restart. It will work.


Solution:20

This is yet another workaround

$ sudo dd if=/dev/tty of=/sys/class/backlight/intel_backlight/brightness  3000  

Press Ctrl+D

less typing for fumble fingers...


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »