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:
- Open Terminal (if it's not already open)
- 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.
- 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.
- 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:
- Open Terminal (if it's not already open)
- Edit
crontab
as the super user:
sudo crontab -e
- 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.
- Save the
crontab
- 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.