/sys/class/backlight/acpi_video0/brightness is broken

Bug #1518473 reported by Jason Gerard DeRose
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
System76
Triaged
High
Jason Gerard DeRose
nvidia-graphics-drivers-352 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

With nvidia-352 (and for that matter nvidia-346), the /sys/class/backlight interface is broken.

Writing to /sys/class/backlight/acpi_video0/brightness has no effect, and reading from it returns a value that does not necessarily reflect the current brightness.

I don't know when exactly this broke in the Nvidia driver, but I do know that not that long ago it worked because the system76-driver uses this to restore the previous backlight brightness level during boot. I believe this still worked with nvidia-343 and perhaps also worked in early nvidia-346 versions.

This problem is somewhat masked because with Ubuntu (Unity), unity-settings-daemon has two code paths for setting the brightness:

1) Using /sys/class/backlight

2) Using xrandr, which as far as I can tell takes (roughly) the same approach as the `xbacklight` command line tool

However, approach (2) does not work with Ubuntu GNOME because gnome-settings-daemon has dropped this code (it dropped gnome-settings-daemon/gsd-rr*).

I've started digging into the dkms module source code, but haven't come up with anything yet. Of course, there is a chance the problem is in the closed proprietary bits.

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: nvidia-352 352.63-0ubuntu0.15.10.1
ProcVersionSignature: Ubuntu 4.2.0-18.22-generic 4.2.3
Uname: Linux 4.2.0-18-generic x86_64
NonfreeKernelModules: nvidia
.proc.driver.nvidia.registry: Binary: ""
.proc.driver.nvidia.version:
 NVRM version: NVIDIA UNIX x86_64 Kernel Module 352.63 Sat Nov 7 21:25:42 PST 2015
 GCC version: gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2)
ApportVersion: 2.19.1-0ubuntu5
Architecture: amd64
CurrentDesktop: Unity
Date: Fri Nov 20 15:01:42 2015
DistUpgraded: Fresh install
DistroCodename: wily
DistroVariant: ubuntu
DkmsStatus:
 bbswitch, 0.7, 4.2.0-18-generic, x86_64: installed
 fwts-efi-runtime-dkms, 15.09.00, 4.2.0-18-generic, x86_64: installed
 nvidia-352, 352.63, 4.2.0-18-generic, x86_64: installed
GraphicsCard:
 NVIDIA Corporation GM204M [GeForce GTX 970M] [10de:1618] (rev a1) (prog-if 00 [VGA controller])
   Subsystem: CLEVO/KAPOK Computer Device [1558:7701]
MachineType: System76, Inc. Serval WS
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.2.0-18-generic.efi.signed root=UUID=d68b8062-f67c-495c-8c16-f2e11d9a9916 ro quiet splash
SourcePackage: nvidia-graphics-drivers-352
UdevLog: Error: [Errno 2] No such file or directory: '/var/log/udev'
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 06/09/2015
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 1.03.03RSY2
dmi.board.asset.tag: Tag 12345
dmi.board.name: Serval WS
dmi.board.vendor: System76, Inc.
dmi.board.version: serw8-17g
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 9
dmi.chassis.vendor: System76, Inc.
dmi.chassis.version: Serval WS
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr1.03.03RSY2:bd06/09/2015:svnSystem76,Inc.:pnServalWS:pvrserw8-17g:rvnSystem76,Inc.:rnServalWS:rvrserw8-17g:cvnSystem76,Inc.:ct9:cvrServalWS:
dmi.product.name: Serval WS
dmi.product.version: serw8-17g
dmi.sys.vendor: System76, Inc.
modified.conffile..etc.modprobe.d.nvidia.352.hybrid.conf: [deleted]
version.compiz: compiz 1:0.9.12.2+15.10.20151015-0ubuntu1
version.ia32-libs: ia32-libs N/A
version.libdrm2: libdrm2 2.4.64-1
version.libgl1-mesa-dri: libgl1-mesa-dri 11.0.2-1ubuntu4
version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
version.libgl1-mesa-glx: libgl1-mesa-glx 11.0.2-1ubuntu4
version.nvidia-graphics-drivers: nvidia-graphics-drivers-* N/A
version.xserver-xorg-core: xserver-xorg-core 2:1.17.2-1ubuntu9
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev 1:2.9.2-1ubuntu1
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:7.5.0+git20150819-0ubuntu1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.99.917+git20150808-0ubuntu4
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:1.0.11-1ubuntu3
xserver.bootTime: Fri Nov 20 08:41:35 2015
xserver.configfile: default
xserver.errors:

xserver.logfile: /var/log/Xorg.0.log
xserver.outputs:

xserver.version: 2:1.17.2-1ubuntu9

Revision history for this message
Jason Gerard DeRose (jderose) wrote :
description: updated
Changed in system76:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Jason Gerard DeRose (jderose)
Revision history for this message
Link Dupont (link-dupont) wrote :

I encountered the same issue when installing Fedora 23 onto my Oryx Pro (I know Fedora isn't supported, etc.). I found a solution on the Archlinux wiki that talks about using inotify to watch for changes to the brightness file and run xbacklight to adjust the backlight levels. For my own sake, I documented it, but this might help for you on Ubuntu. It really sounds like a regression with the proprietary NVIDIA drivers. Maybe a similar file-monitoring could be incorporated into system76-daemon?

http://www.moxbant.net/fedora-23-on-system76-oryx-pro/

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

Link,

Your write-up for getting this working on Fedora is great, thanks!

We're considering adding something like this to the system76-daemon assuming Nvidia isn't going to support this mechanism any more.

Thanks again!

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nvidia-graphics-drivers-352 (Ubuntu):
status: New → Confirmed
Revision history for this message
dhenry (tfc-duke) wrote :

Same issue with GTX 980M on Ubuntu 16.04, even with latest NVIDIA drivers (367.27).

I described this on NVIDIA forums:
https://devtalk.nvidia.com/default/topic/942337/linux/backlight-brightness-not-hooked-to-acpi-events-ubuntu-16-04-/

I manually fixed it by created an acpid event handler, however in my solution, it only works when changing the brightness with the Fn-keys, but not by changing /sys/class/backlight/acpi_video0/brightness value.

Link Dupont's fix works better (but I didn't use video.use_native_backlight=1 on GRUB_CMDLINE_LINUX as he said). By the way, the link to his solution is dead. This one works: http://sub-pop.net/post/fedora-23-on-system76-oryx-pro/

Revision history for this message
Alejandro Palacios (pamanes7) wrote :

link-dupont really nailed it! I am having the same issue on an HP Elitebook 8770w with ONLY an NVIDIA Quadro K3000M, using the proprietary driver version 387.34 on Fedora 27, Kernel 4.14.3-300

I tried all:

acpi_backlight=video
acpi_backlight=vendor
acpi_backlight=native

to no avail, so removed all of that and installed inotify-tools, I do have /sys/class/backlight/acpi_video0 so I ended up with the following script in /home/YOURUSERHERE/Scripts/backlight_inotify.sh

#!/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

nvidia-settings -n -a BacklightBrightness="$(luminance)"

inotifywait -me modify --format '' "$path"/actual_brightness | while read; do
    nvidia-settings -n -a BacklightBrightness="$(luminance)"
done

And then created file brightnessfix.desktop under /home/YOURUSERHERE/.config/autostart

[Desktop Entry]
Name=Brightness Fix
Exec=/home/YOURUSERHERE/Scripts/backlight_inotify.sh
Terminal=false
Type=Application
Name[en_US]=backlightfix.desktop

It is a very effective workaround, thanks.

Revision history for this message
Vaclav Cermak (disnel) wrote :

I have also this problem with Clevo P775DM3. With one (big) difference, neither xbacklight nor nvidia-settings works in my case :(

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.