0

I have a new (July 2021) Dell XPS Laptop running Ubuntu 20.04.3 LTS I have turned OFF Automatic Brightness and manually set the brightness that I want. But after rebooting often the brightness resets to near maximum brightness, and I have to manually change it back to the lower setting that I prefer. How do I get it to stop doing this?

2
  • This answer here may help you with the brightness issue (See the first update) 👍🏻
    – matigo
    Commented Feb 15, 2022 at 6:05
  • Won't the change In Update #1 hard-code the brightness to 80%? I just want it to quit overriding the brightness that is manually set via the slider bars.
    – MattB
    Commented Feb 15, 2022 at 7:11

1 Answer 1

1

One solution may be to set up a quick little script that will save the brightness value when the system shuts down, then configure the system to reload the value after booting. It's not perfect, but will do the job in a pinch.

Here's how you can set it up:

  1. Open Terminal (if it's not already open)
  2. Create a file in /etc/rc6.d, which contains actions to be performed when shutting down. For the sake of this example, the file will be called K99-save-brightness:
    sudo {editor of choice} /etc/rc6.d/K99-save-brightness 
    
    Note: Be sure to replace {editor of choice} with your editor of choice.
  3. Copy the following into the file:
    #!/bin/bash
    cat /sys/class/backlight/nvidia_0/actual_brightness > /etc/acpi/backlight-brightness
    
    Note: Be sure to replace nvidia_0 with the appropriate name that is found in /sys/class/backlight. It may be intel_backlight, nvidia_0, or something else entirely.
  4. Save the file and ensure it is set to be executable:
    sudo chmod +x /etc/rc6.d/K99-save-brightness 
    

Now every time your system shuts down, the value in actual-brightness will be written to the /etc/acpi/backlight-brightness file.

Next, you will need to run a little script after your system finishes booting. This can be accomplished via crontab like so:

  1. Open Terminal (if it's not already open)
  2. Edit crontab as the super user:
    sudo crontab -e 
    
  3. Add this one-liner:
    @reboot (sleep 10 ; cat /etc/acpi/backlight-brightness > /sys/class/backlight/nvidia_0/brightness
    
    Note: The sleep value can be anything from 2. When the value is less than 2, there is a higher probability that the backlight setting will be overridden and reset to maximum. Of course, be sure to replace nvidia_0 with the actual backlight device that you will be controlling.
  4. Save the crontab
  5. Reboot to test

This is certainly not an ideal solution, but it's one that does work on some of the notebooks that I help support at the day job. This should work on every modern version of Ubuntu from 18.04 to current.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .