Xorg.0.log: (EE) [drm] Failed to open DRM device for pci

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.

The purpose of this wiki page is to collect all possible causes leading to the given error, and offer appropriate solutions in each case.

Two concurrent X11 sessions

Example /var/log/Xorg.0.log output:

[   834.454] (EE) [drm] Failed to open DRM device for pci:0000:0b:00.0: -2
[   834.454] (**) modeset(0): claimed PCI slot 11@0:0:0
[   834.454] (II) modeset(0): using default device
[   834.454] (WW) Falling back to old probe method for fbdev
[   834.454] (II) Loading sub module "fbdevhw"
[   834.454] (II) LoadModule: "fbdevhw"
[   834.455] (II) Loading /usr/lib64/xorg/modules/libfbdevhw.so
[   834.455] (II) Module fbdevhw: vendor="X.Org Foundation"
[   834.455] compiled for 1.19.5, module version = 0.0.2
[   834.455] ABI class: X.Org Video Driver, version 23.0
[   834.455] (WW) Falling back to old probe method for vesa
[   834.457] (II) modeset(0): Creating default Display subsection in Screen section
"Default Screen Section" for depth/fbbpp 24/32
[   834.457] (==) modeset(0): Depth 24, (==) framebuffer bpp 32
[   834.457] (==) modeset(0): RGB weight 888
[   834.457] (==) modeset(0): Default visual is TrueColor
[   834.457] (II) Loading sub module "glamoregl"
[   834.457] (II) LoadModule: "glamoregl"
[   834.457] (II) Loading /usr/lib64/xorg/modules/libglamoregl.so
[   834.460] (II) Module glamoregl: vendor="X.Org Foundation"
[   834.460] compiled for 1.19.5, module version = 1.0.0
[   834.460] ABI class: X.Org ANSI C Emulation, version 0.4
[   834.460] (II) glamor: OpenGL accelerated X.org driver based.
[   834.548] (EE) modeset(0): eglGetDisplay() failed
[   834.549] (EE) modeset(0): glamor initialization failed
[   834.549] (II) modeset(0): ShadowFB: preferred YES, enabled YES
[   834.549] (II) modeset(0): Double-buffered shadow updates: off
...
[   834.551] (II) Loading sub module "fb"
[   834.551] (II) LoadModule: "fb"
[   834.551] (II) Loading /usr/lib64/xorg/modules/libfb.so
[   834.551] (II) Module fb: vendor="X.Org Foundation"
[   834.551] compiled for 1.19.5, module version = 1.0.0
[   834.551] ABI class: X.Org ANSI C Emulation, version 0.4
[   834.551] (II) Loading sub module "shadow"
[   834.551] (II) LoadModule: "shadow"
[   834.551] (II) Loading /usr/lib64/xorg/modules/libshadow.so
[   834.552] (II) Module shadow: vendor="X.Org Foundation"
[   834.552] compiled for 1.19.5, module version = 1.1.0
[   834.552] ABI class: X.Org ANSI C Emulation, version 0.4
[   834.552] (II) UnloadModule: "fbdev"
[   834.552] (II) Unloading fbdev
[   834.552] (II) UnloadSubModule: "fbdevhw"
[   834.552] (II) Unloading fbdevhw
[   834.552] (II) UnloadModule: "vesa"
[   834.552] (II) Unloading vesa
[   834.552] (==) Depth 24 pixmap format is 32 bpp
[   834.553] (==) modeset(0): Backing store enabled
[   834.553] (==) modeset(0): Silken mouse enabled
[   834.553] (II) modeset(0): RandR 1.2 enabled, ignore the following RandR disabled message.
[   834.553] (==) modeset(0): DPMS enabled
[   834.553] (--) RandR disabled
[   834.553] (EE) Failed to initialize GLX extension (Compatible NVIDIA X driver not found)
[   834.553] (II) modeset(0): Damage tracking initialized
[   834.553] (II) modeset(0): Setting screen physical size to 423 x 317
[   834.570] (II) config/udev: Adding input device Power Button (/dev/input/event1)
[   834.570] (**) Power Button: Applying InputClass "evdev keyboard catchall"
[   834.570] (II) LoadModule: "evdev"
[   834.570] (II) Loading /usr/lib64/xorg/modules/input/evdev_drv.so
[   834.570] (II) Module evdev: vendor="X.Org Foundation"
[   834.570] compiled for 1.19.5, module version = 2.10.5
[   834.570] Module class: X.Org XInput Driver
[   834.570] ABI class: X.Org XInput driver, version 24.1
[   834.570] (II) Using input driver 'evdev' for 'Power Button'
[   834.570] (**) Power Button: always reports core events
[   834.570] (**) evdev: Power Button: Device: "/dev/input/event1"
[   834.570] (--) evdev: Power Button: Vendor 0 Product 0x1
[   834.570] (--) evdev: Power Button: Found keys
[   834.570] (II) evdev: Power Button: Configuring as keyboard
[   834.570] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input1/event1"
[   834.570] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 6)
[   834.570] (**) Option "xkb_rules" "evdev"
[   834.571] (II) config/udev: Adding input device Power Button (/dev/input/event0)
[   834.571] (**) Power Button: Applying InputClass "evdev keyboard catchall"
[   834.571] (II) Using input driver 'evdev' for 'Power Button'
[   834.571] (**) Power Button: always reports core events
[   834.571] (**) evdev: Power Button: Device: "/dev/input/event0"
[   834.571] (--) evdev: Power Button: Vendor 0 Product 0x1
[   834.571] (--) evdev: Power Button: Found keys
[   834.571] (II) evdev: Power Button: Configuring as keyboard
[   834.571] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input0/event0"
[   834.571] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 7)
[   834.571] (**) Option "xkb_rules" "evdev"
[   834.571] (II) config/udev: Adding drm device (/dev/dri/card0)
[   834.571] (II) xfree86: Adding drm device (/dev/dri/card0)
[   834.571] (EE) /dev/dri/card0: failed to set DRM interface version 1.4: Permission denied
[   834.571] (II) config/udev: Adding input device HDA NVidia HDMI/DP,pcm=3 (/dev/input/event10)
[   834.571] (II) No input driver specified, ignoring this device.
[   834.571] (II) This device may have been added with another device file.

The most relevant lines are:

[   834.454] (EE) [drm] Failed to open DRM device for pci:0000:0b:00.0: -2
[   834.454] (**) modeset(0): claimed PCI slot 11@0:0:0
...
[   834.571] (II) config/udev: Adding drm device (/dev/dri/card0)
[   834.571] (II) xfree86: Adding drm device (/dev/dri/card0)
[   834.571] (EE) /dev/dri/card0: failed to set DRM interface version 1.4: Permission denied

The above occured when attempting to start a second X11 session. The user was properly logged into X11/Desktop session on tty7, and attempted to switch user in order to start a new session on tty8. In this case, the display manager, sddm, simply displayed a black screen.

The problem is that the graphic card on /dev/dri/card0 was already claimed by the Nvidia drivers for the X11 session on tty7.

The solution was to configure the Nvidia drivers to share the graphic card resources between sessions.
In the nvidia settings, simply adding the following was sufficient:

Section "Screen"
        Identifier "Default Screen"
        Device "DiscreteNvidia"
EndSection

On a Gentoo system, this was added in a new file: /etc/X11/xorg.conf.d/nvidia.conf.

There are a succession of problems that render debugging problems like above very difficult:
1) The display manager used, sddm, does not present to the user any useful feedback. The sddm logs are also very lacking. The user is left (almost litterally) in the dark as to what is wrong.
2) The nvidia documentation to configure X11 with the nvidia drivers are very poor. We couldn't find the official place where the use of "DescreteNvidia" was documented.
3) The X.org documentation is itself very poor.
Thus, users are left with the use of search engines, browsing linux forums and bug trackers, trying blindly to find a solution to their problems. This site has a long term goal to provide a solution to such problems: provide a clear documentation that gently leads the user to symptoms to the solution.