Ubuntu – nvidia backlight brightness problem

16.04backlightbrightnessnvidiaxorg

Problem

Unity shows control while I press the Fn+Increase/Descrese brightness, but nothing happens. In console brightness doesn't work too while X server is running.

Checked solutions

I have tried ALL POSSIBLE solutions of this problem in google and nothing works:

  1. write acpi_backlight in grub
  2. reinstall drivers with apt purge nvidia*
  3. write "EnableBrightnessControl=1" in xorg.conf
  4. install nvidia-375.66, nvidia-378.13, 381.22, 384.47
  5. "xbacklight -set X" doesn't work
  6. changing /sys/class/backlight/brightness
  7. update linux kernel from 4.8 to 4.10 and 4.12
  8. replace EDID from old matrix (it breaks everything)
  9. setpci -v -H1 -s 00:01.0 3e.W=0 and then change backlight using Fn+keys.
  10. xrandr –output DP-0 –brightness 0.5 — bad solution

My system and situation

I used N173HHE-G32 display matrix in my laptop before and everything was OK. But today I've replaced it to B173HAN01.2 and this problem has started. On Windows 10 I've solved it by reinstalling drivers on nvidia-376 from official MSI website.

So, I can see the next sequence: at laptop start brightness is maximum, then it is minimum (and working) while "initramfs …" text is showing in console. And after X server starts brightness is maximum (broken) again. When X server stops brightness is working again!

MSI GT73VR 7RF, Ubuntu 16.04.2 LTS, NVidia GeForce GTX1080, B173HAN01.2 display matrix

uname -a 
4.8.0-58-generic #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

lspci | grep -i vga
01:00.0 VGA compatible controller: NVIDIA Corporation Device 1be0 (rev a1)

However!

But when I use nvidia-378 it WORKS! Unfortunately
378 has a critical bugs after suspend mode in Unity interface :(((

Please help, my eyes are in blood (it's very bright for them) and I don't know what to do…

Updated!
After two years I understood that problem is inside of lightdm (or X server). When I stop it everything is ok…

Best Answer

Update June 16, 2019

Last month, 2 years after problem was reported, OP discovered LightDM (Ubuntu Unity Desktop Manager) was source of problem. That said, in addition to the list below, there is another grub parameter that can be tried:

video.use_native_backlight=1

See this answer for more.


Original Answer

The ultimate reference seems to be in Arch Linux which is a site I've turned to many times to fix difficult problems.

Kernel Parameters

Looking at your cat /proc/cmdline there are no extra kernel parameters passed. The above link states:

Sometimes, ACPI does not work well due to different motherboard implementations and ACPI quirks. This includes some laptops with dual graphics (e.g. Nvidia/Radeon dedicated GPU with Intel/AMD integrated GPU). On Nvidia Optimus laptops, the kernel parameter nomodeset can interfere with the ability to adjust the backlight. Additionally, ACPI sometimes needs to register its own acpi_video0 backlight even if one already exists (such as intel_backlight), which can be done by adding one of the following kernel parameters:

acpi_backlight=video
acpi_backlight=vendor
acpi_backlight=native

If you find that changing the acpi_video0 backlight does not actually change the brightness, you may need to use acpi_backlight=none.

Try each of the acpi_backlight=xxxx options on your grub kernel paremeters line

When xbacklight doesn't work

You've tried xbacklight already and the link above addresses this:

On some systems, the brighness hotkeys on your keyboard correctly modify the values of the acpi interface in /sys/class/backlight/acpi_video0/actual_brightness (As we tried in comments) but the brightness of the screen is not changed. Brigthness applets from desktop environments (ie Ubuntu brightness setting slider bar) may also show changes to no effect.

If you have tested the recommended kernel parameters and only xbacklight works, then you may be facing an incompatibility between your BIOS and kernel driver.

In this case the only solution is to wait for a fix either from the BIOS or GPU driver manufacturer.

A workaround is to use the inotify kernel api to trigger xbacklight each time the value of /sys/class/backlight/acpi_video0/actual_brightness changes.

First install inotify-tools. Then create a script around inotify that will be launched upon each boot or through autostart.

Below is script you need to create called: /usr/local/bin/xbacklightmon

#!/bin/sh

path=/sys/class/backlight/acpi_video0

luminance() {
    read -r level < "$path"/actual_brightness
    factor=$((100 / max))
    printf '%d\n' "$((level * factor))"
}

read -r max < "$path"/max_brightness

xbacklight -set "$(luminance)"

inotifywait -me modify --format '' "$path"/actual_brightness | while read; do
    xbacklight -set "$(luminance)"
done

There is a lot more in the link above but these steps are a good place to start.


Dedicated Forums

For additional support there are dedicated Linux Graphics forums: