Bug 82833 - backlight-helper gets upset
Summary: backlight-helper gets upset
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: highest blocker
Assignee: Chris Wilson
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-20 02:35 UTC by nebupookins
Modified: 2014-10-05 06:54 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
xorg log files (42.79 KB, text/plain)
2014-08-21 03:27 UTC, nebupookins
no flags Details

Description nebupookins 2014-08-20 02:35:02 UTC
I'm not sure I've selected the right product, as the version numbers are not what I expect. I'm runnong X.Org X Server 1.16.0

I originally filed this issue on the ArchLinux forums but had no luck there: https://bbs.archlinux.org/viewtopic.php?id=185800

I get a segfault whenever I run the command "startx". Here's what I believe to be the relevant lines from logs:

(EE) intel(0): Failed to set backlight acpi_video0 for output LVDS1 to brightness level 0, disabling
(EE)
(EE) Backtrace:
(EE) 0: /usr/bin/Xorg.bin (xorg_backtrace+0x52) [0x81de282]
(EE) 1: /usr/bin/Xorg.bin (0x8048000+0x19a502) [0x81e2502]
(EE) 2: linux-gate.so.1 (__kernel_rt_sigreturn+0x0) [0xb7792d34]
...

(Sorry if there are typos in the above, I had to retype them as I write this post here on my desktop, since I'm not sure how to do much with my laptop without X running).

I was trying to adjust my laptop brightness, and after running some commands in the terminal, the brightness ended up too high for me to see anything, so I rebooted the laptop.

If it helps any, here's the bash_history I have which records what commands I was running while trying to adjust my brightness settings:

cd /sys/class/backlight/
ls
cd acpi_video0
ls
less max_brightness
tee brightness <<< 5
sudo tee brightness <<< 5
sudo tee brightness <<< 1
sudo tee brightness <<< 0
sudo tee brightness <<< 10
sudo tee brightness <<< 1
yaourt calise
yaourt redshift
redshift
yaourt xcalib
man xcalib
xcalib --help
xcalib
xcalib -co 40 -a
xcalib -co 100 -a
xcalib -co 250 -a
xcalib -co 100 -a
xcalib -b 100 -a
xcalib -b 99 -a
xcalib -b 995

In my /sys/class/backlight directory, I have acpi_video0, acpi_video1, intel_backlight and radeon_bl1. Right now, the brightness file in each has the following content (as determined by, e.g., cat /sys/class/backlight/acpi_video0/brightness):

acpi_video0: 10
acpi_video1: 1
intel_backlight: 4422465
radeon_bl1: 255

I noticed that if I run startx as another user (e.g. root), X will start just fine.

So then I tried renaming my .xinitrc file to .xinitrc.bak, and again X started fine.

Then I tried having a completely empty .xinitrc file (by running `touch .xinitrc`). This time X will segfault with the above error again.

Then I tried copying the .xinitrc file from /etc/skel/.xinitrc to my home directory. Again, X segfaults with the above error.

So it seems like if I don't have an .xinitrc file, X can start up. But if I have an .xinitrc file, including an empty one or a "default" one, X will segfault.
Comment 1 Chris Wilson 2014-08-20 05:55:09 UTC
I need the full backtrace. Look for it in /var/log/Xorg.0.log (or friends). If you can grab it using gdb, that would be very helpful.
Comment 2 nebupookins 2014-08-21 03:27:47 UTC
Created attachment 104999 [details]
xorg log files

Attached the logs which contain the full backtrace
Comment 3 Chris Wilson 2014-08-21 07:03:38 UTC
==14408== Invalid read of size 8
==14408==    at 0x21EEC4: RRChangeOutputProperty (rrproperty.c:224)
==14408==    by 0x21F8B1: ProcRRChangeOutputProperty (rrproperty.c:539)
==14408==    by 0x15D8EE: Dispatch (dispatch.c:433)
==14408==    by 0x1619E5: dix_main (main.c:294)
==14408==    by 0x6D55EC4: (below main) (libc-start.c:287)
==14408==  Address 0x85ae678 is 56 bytes inside a block of size 88 free'd
==14408==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==14408==    by 0x21EB0E: RRDeleteProperty.isra.0 (rrproperty.c:79)
==14408==    by 0xA9818B8: sna_output_backlight_set (sna_display.c:612)
==14408==    by 0xA989DAA: sna_output_set_property (sna_display.c:3174)
==14408==    by 0x21EEB6: RRChangeOutputProperty (rrproperty.c:217)
==14408==    by 0x21F8B1: ProcRRChangeOutputProperty (rrproperty.c:539)
==14408==    by 0x15D8EE: Dispatch (dispatch.c:433)
==14408==    by 0x1619E5: dix_main (main.c:294)
==14408==    by 0x6D55EC4: (below main) (libc-start.c:287)
Comment 4 Chris Wilson 2014-08-21 07:16:44 UTC
Hmm, actually not returning FALSE from ChangeProperty is the failure mode here.
Comment 5 Chris Wilson 2014-08-21 07:19:49 UTC
commit 9b2cf5c7ab6e1a4a9aa46b297fb2f90cb09124ec
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Aug 21 08:17:41 2014 +0100

    sna: Propagate failure from changing backlight value
    
    Especially when we delete the output property halfway through and the
    ChangeProperty routine then attempts to wire it back up...
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82833
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Comment 6 Chris Wilson 2014-08-21 07:22:15 UTC
Jani, um, please fix asap. O is the backlight interface for minimum value, whatever you choose that to be.
Comment 7 Chris Wilson 2014-08-21 08:05:17 UTC
Let's get a drm.debug=6 dmesg to dig deeper into the failure to set the backlight
Comment 8 Chris Wilson 2014-08-21 08:05:33 UTC
Or maybe actually drm.debug=0xf just to be sure.
Comment 9 Chris Wilson 2014-08-21 08:13:12 UTC
Looking closer, it is acpi_video0 and not intel_backlight so not a result of any recent i915.ko changes. Oops, sorry Jani.
Comment 10 Chris Wilson 2014-08-21 08:14:25 UTC
Please ls /usr/libexec and ps ax.
Comment 11 Chris Wilson 2014-08-21 08:39:33 UTC
So that make that "ls -l /usr/libexec" and "pkexec --version"
Comment 12 nebupookins 2014-08-21 22:47:31 UTC
$ ls -l /usr/libexec
ls: cannot access /usr/libexec: No such file or directory

$ pkexec --version
pkexec version 0.112
Comment 13 Chris Wilson 2014-08-22 06:20:21 UTC
Your system relies on the xf86-video-intel-backlight-helper (since you are using an unprivileged Xserver) and that does not appear to be available. Closing as the original bug is now fixed.
Comment 14 Mohammad Akhlaghi 2014-09-18 10:28:31 UTC
I have the same problem on an updated Arch Linux, but I didn't understand, is there anything I can do to fix it? I have posted my question here:

https://bbs.archlinux.org/viewtopic.php?id=186939

Thanks
Comment 15 Chris Wilson 2014-09-18 10:35:31 UTC
It's an issue with the Arch configuration: they have disabled root privileges for Xorg which prevents us from changing the backlight value directly, and instead have a setuid helper with which we communicate to do so. However, that helper is not installed on your system and so it fails. The crash itself is fixed upstream, which should now be available in the 2.99.916 package.
Comment 16 Mohammad Akhlaghi 2014-09-21 05:16:09 UTC
Thank you for the explanation, I just done an update and xf86-video-intel 2.99.916-1 is installed. But there is no difference. Is there nothing I can manually do to allow root access to xorg?
Comment 17 Mohammad Akhlaghi 2014-09-21 05:39:52 UTC
I do have to add that it isn't only Xorg that can't load the dell-backlight. In the Linux boot log, I get this:

[FAILED] Failed to start Load/Save Screen Backlight Brightness of backlight:dell_backlight
See 'systemctl status systemd-backligh@backlight:dell_backlight.service

But after failing with dell_backlight, it succeeds in starting intell_backlight and the boot loading continues. 

Is there any way I can tell Xorg to also try intel_backlight when it fails with dell_backlight?

Thanks in advance
Comment 18 Chris Wilson 2014-09-21 06:03:49 UTC
It can be just as simple as setting the setuid bit on the Xorg binary (chmod +s). To override the choice in backlight use

Section "Device"
  Identifier "intel"
  Option "backlight" "intel_backlight"
EndSection

(and place that in /etc/X11/xorg.conf or /etc/X11/xorg.conf.d/backlight.conf)
Comment 19 Mohammad Akhlaghi 2014-09-21 07:29:57 UTC
Thank you, I changed the dell_backlight to intel_backlight, but only the name in the error changed. So this wan't the solution. 

I have to apologize for my ignorance, but could you guide me on how I can find The Xorg binary? I have 'Xorg' and 'Xorg.bin' in both the /bin and /usr/bin directories. So I applied 'chmod +s' to Xorg* files in both these directories but nothing changed.
Comment 20 Chris Wilson 2014-09-21 07:39:48 UTC
Could be that it is using the wrapper to drop any root privileges when run anyway. Try:

echo need_root_rights=yes >> /etc/X11/Xorg.wrapper

(I think at least from reading the code.)
Comment 21 Mohammad Akhlaghi 2014-09-21 08:11:08 UTC
thank you, this seems to have fixed it. however, it seems that I still need to disable systemd-backligh@backlight:dell_backlight.service for X to load. if I don't disable it, startx will fail the next time. 

Event though I used 'systemctl disable' it doesn't seem to stop its loading on the next time. is there a way I can permanently disable or delete dell_backlight?

I really appreciate your help, thank you.
Comment 22 Chris Wilson 2014-09-21 12:40:03 UTC
Maybe try acpi_backlight=vendor on the kernel commandline. (I am never certain which option is the right one).

Alternatively, you can try

echo blacklist dell-laptop >> /etc/modprobe.d/backlight.conf

and rebuild your initramfs just in case.
Comment 23 Mohammad Akhlaghi 2014-10-05 06:54:59 UTC
I applied these steps, and there is no more complaints about the dell_backlight. but when I run startx, it doesn't load, it seems it can't find the hardware! Here are the last four lines of /var/log/Xorg.0.log:

evdev: video Bus: Close
UnloadModule: "evdev" 
systemd-logins: releasing fd for 13:76
Server terminated successfully (0). Closing log file

The first three lines are repeated several times for the following issues too: 

Dell WMI hotkeys, AlpsPS/2 ALPS GuidePoint, AlpsPS/2 Device, AT translated Set 2 keyboard, Integrated_Webcam_1.3M, HID 413c:8162, HID 413c:8161, Sleep Button and Power Button.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.