Set Default Brightness level – Ubuntu – HP Laptop

Having installed and used Ubuntu 20.10 and 20.04.2, I realised that my HP Envy Laptop’s brightness was being set to minimum by default. Though I could just increase it with brightness keys on my keyboard, I was having to do this on every boot. So I started to look for a solution.

It seems Ubuntu removed /etc/rc.local file quite a few versions ago which is used to execute commands at system startup. This is the file that you can use to set the brightness level that suits you when the system is booting up.

Create /etc/rc.local file and for this you would either need to be root or use sudo.

The file where you would be setting the brightness level will differ depending on the system/laptop you have but it is fairly obvious as it usually can be found at a location similar to

/sys/class/backlight/intel_backlight/brightness

/sys/class/backlight/amdgpu_bl0/brightness

Coming back to our /etc/rc.local file, it needs to have the following content:

#!/bin/sh
echo 225 > /sys/class/backlight/intel_backlight/brightness
exit 0

On my HP Envy laptop, 225 seemed to be just about right for me. The maximum I could set it to was 255. You can check the max_brightness file for the highest value.

Apply the required permissions and make the file executable.

chmod 755 /etc/rc.local

Save and restart the system. You will see shortly after the Splash screen, the brightness level will be adjusted as per the value you just specified in the file above.

I have only tested this on Ubuntu but I am certain with the recent kernel version, ~5.8, this should work on all flavours of Linux.

You can also use sysfsutils tool to do the same. I will update this post once I have tried it on my system.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s