Unity screen brightness fix for Ubuntu 18.04

Updated: May 25, 2019

Just recently, I upgraded my Asus Vivobook to Bionic. After five great years, Trusty had come to the end of its supported life, and I had to make a choice. So I did. I made two choices. I upgraded the system, and then decided to test and eventually use both Unity and Plasma desktops, sort of in tandem. In both cases, the results are quite good. Especially with the former, this is rather encouraging, because Unity is no longer an official thing.

The one really outstanding problem that I've discovered in this setup is that my laptop Fn brightness and volume keys had stopped working. Not a major thing, but it does mar the overall feel, plus on laptops, you sort of expect to be able to use them. The rest of the keys work fine (including, for instance, screen off), and there are no such issues in either the Ubuntu (Gnome) or Plasma environments. I spent a bit of time reading, tweaking, and I do have a fix.

All roads lead to Rome - problem

If you search for any combo of words brightness, unity and not working, you will get a lot of results. But this is true for pretty much everything in Linux, and even other operating systems. Apparently, the problems I was facing aren't new, they had not affected me on Trusty. Specifically, there's this volume bug, and then for the screen brightness, this one covers it well.

Here, I will just focus on the brightness part. First, the symptoms. The brightness keys do nothing, even after a long delay. There are no visible errors anywhere. Even the slider is missing in the brightness section of the power management facility in the Unity settings.

No brightness slider

Please note that I have Intel graphics on this ultrabook, and therefore the proposed solution is only relevant to that hardware configuration. However, as you've seen in the linked bug for a specific Nvidia-graphics use case, the first part of the listed solution should help, regardless of your graphics card choice.

Solution, step 1: GRUB update

The solution seems to be a combination of changing the boot parameters and adding a configuration file for how X11 handles PCI devices. This is not that different from how I fixed a similar set of problems on my old eeePC netbook, both a decade ago and indeed just a few weeks back. You need to edit the default GRUB2 configuration by appending a different implementation.

sudo nano /etc/default/grub

And then inside this file, change the line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

To the following:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi="

After that you need to update the GRUB configuration by running an update:

sudo update-grub

The change above tells the kernel to actually NOT use the default (Linux) OS interface, as apparently, it is not working correctly. Now, for your own convenience, if the above does not work for, once you've fully implemented the solution, you can also try one of the the following:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=native"

Reboot. When the system comes up, verify that you have the right parameters by inspecting the kernel command line via: cat /proc/cmdline. The ACPI string you've appended should be there. Check the brightness keys. If they work, great. If not, then there's also the second (optional) step for systems with Intel graphics.

Solution, step 2: X11 configuration (Intel only)

Here, we will create a tweak for the Intel graphics card, specifically the backlight option. You also need to check the BUS ID for your graphics card. You can do this with the lspci command, which will give you the desired output. Then, create the following file:

sudo nano /usr/share/X11/xorg.conf.d/XX-intel.conf

And add the following block of text:

Section "Device"
        Identifier  "card0"
        Driver      "intel"
        Option      "Backlight"  "intel_backlight"
        BusID       "PCI:X:Y:Z"
EndSection

Replace XX-intel.conf with a number, e.g. 20-intel.conf, 30-intel.conf. The number simply tell the system when to load the particular configuration, as it parses the contents of the directory in sequential numerical order. Replace PCI:X:Y:Z with the right bus ID number, like PCI:0:2:0. Once again, reboot and check whether your problem is solved. For me, this had done the trick, I had the brightness control, and the slider shows correctly. The one "downside" is that the boot splash screen looks darker than before. That's the only thing.

Brightness works

Conclusion

I am never happy when I need to tweak system configurations, and until recently, the Vivobook & Trusty have had a perfect record. This is no longer true with Unity, then again, this is also an unsupported scenario. But I do feel it's important to resolve, because it gives me a better understanding of what I can do and expect to achieve with Unity, especially since this is a production system.

We still have the Fn volume keys issues to fix. The idea is to do this without having to resort to using PPA or any external, third-party packages. I'll explore this in a follow-up article, even if the results may not have a happy ending like here. True, worst case, I can simply use Plasma, which works splendidly, looks the part even in its tweaked Unity-like guise, and it's already proven its worth on my Slimbook. Anyway, I hope this little hack tutorial was useful. Happy Linuxing and see you around.

Cheers.

You may also like: