Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return of the dreaded Cannot open /dev/tty0 (Permission denied) issue on modern Ubuntu! #1550

Open
Nexarian opened this issue Apr 16, 2020 · 15 comments

Comments

@Nexarian
Copy link
Contributor

Nexarian commented Apr 16, 2020

As requested from my comment in #1546, I keep seeing this issue with the latest versions of xrdp and xorgxrdp (built from source) on Ubuntu 18.04 with Gnome 3.32.

I had XRDP working with Ubuntu 18.04 on Gnome 3.32 (Yes, I recognize Gnome 3.32 doesn't come standard with Ubuntu 18.04, but I wanted fractional scaling!), but then made the following changes:

  1. Installed Chrome Remote Desktop (CRD) around the time the coronavirus crisis hit (I liked that CRD supported dynamic xrandr resolution by changing the window size, which XRDP currently doesn't)
  2. Installed VirtualGL (2.6.3) and then ran: /opt/VirtualGL/bin/vglserver_config (I also liked that CRD worked with VirtualGL, and I'm not sure XRDP does).
  3. Updated my Nvidia binary drivers (440.64). Nvidia-smi wasn't working and I wanted to get stats on my VirtualGL GPU usage.
    ...
    Enjoyed CRD until my company blocked it due to some sort of nebulous security justification.
    Now, I tried to go back to XRDP but I can't, because of the Cannot open /dev/tty0 (Permission denied) error. If memory serves, it was something vglserver_config did that broke it, but running the "uninstall" command on it doesn't fix things, so that might not be it.

I have tried all sorts of variants of xserver-xorg-legacy. I tried uninstalling dbus-user-session and installing dbus-x11 (for a while, both were installed SxS). I've tried the chmod 0660 trick on dev/tty* but that only moves the error down the pipe so that it can't access psaux for the mouse.

Still nothing. I'd love to help test patches or debug in any way I can. I would love to have XRDP back, because otherwise I have to suffer with NoMachine (my company's supported solution barf)

XVNC works (it's glacially slow), but xorgxrdp doesn't. I have both xrdp and xorgxrdp building from source at the head of their respective github repos.

Here is the log from .xorgxrdp.10.log:

X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
[   225.802] Build Operating System: Linux 4.4.0-143-generic x86_64 Ubuntu
[   225.802] Current Operating System: Linux [hostname] 4.15.0-97-generic #98-Ubuntu SMP Tue Apr 7 10:21:29 UTC 2020 x86_64
[   225.802] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-97-generic root=UUID=fb7276dc-f68e-40f3-b88d-09a52f3a52b5 ro quiet splash vt.handoff=1
[   225.802] Build Date: 03 April 2019  09:03:57AM
[   225.802] xorg-server 2:1.20.4-1ubuntu3 (For technical support please see http://www.ubuntu.com/support) 
[   225.802] Current version of pixman: 0.34.0
[   225.802] 	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[   225.802] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[   225.803] (++) Log file: ".xorgxrdp.10.log", Time: Thu Apr 16 13:13:13 2020
[   225.806] (++) Using config file: "/etc/X11/xrdp/xorg.conf"
[   225.806] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[   225.806] (==) ServerLayout "Layout0"
[   225.807] (**) |-->Screen "Screen0" (0)
[   225.807] (**) |   |-->Monitor "Monitor0"
[   225.807] (**) |   |-->Device "Device0"
[   225.807] (**) |   |-->GPUDevice "Video Card (xrdpdev)"
[   225.807] (**) |-->Input Device "Keyboard0"
[   225.807] (**) |-->Input Device "Mouse0"
[   225.807] (**) Option "DontVTSwitch" "on"
[   225.807] (**) Option "AutoAddDevices" "off"
[   225.807] (**) Not automatically adding devices
[   225.807] (==) Automatically enabling devices
[   225.807] (==) Automatically adding GPU devices
[   225.807] (==) Automatically binding GPU devices
[   225.807] (==) Max clients allowed: 256, resource mask: 0x1fffff
[   225.807] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[   225.807] 	Entry deleted from font path.
[   225.807] (==) FontPath set to:
	/usr/share/fonts/X11/misc,
	/usr/share/fonts/X11/100dpi/:unscaled,
	/usr/share/fonts/X11/75dpi/:unscaled,
	/usr/share/fonts/X11/Type1,
	/usr/share/fonts/X11/100dpi,
	/usr/share/fonts/X11/75dpi,
	built-ins
[   225.807] (==) ModulePath set to "/usr/lib/xorg/modules"
[   225.807] (II) Loader magic: 0x56376f304020
[   225.807] (II) Module ABI versions:
[   225.807] 	X.Org ANSI C Emulation: 0.4
[   225.807] 	X.Org Video Driver: 24.0
[   225.807] 	X.Org XInput driver : 24.1
[   225.807] 	X.Org Server Extension : 10.0
[   225.809] (--) using VT number 2

[   225.809] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[   225.809] (II) xfree86: Adding drm device (/dev/dri/card0)
[   225.823] (--) PCI:*(101@0:0:0) 10de:1bb0:1028:11b2 rev 161, Mem @ 0xd7000000/16777216, 0xc0000000/268435456, 0xd0000000/33554432, I/O @ 0x0000b000/128, BIOS @ 0x????????/131072
[   225.824] (II) "glx" will be loaded. This was enabled by default and also specified in the config file.
[   225.824] (II) LoadModule: "dbe"
[   225.824] (II) Module "dbe" already built-in
[   225.824] (II) LoadModule: "ddc"
[   225.824] (II) Module "ddc" already built-in
[   225.824] (II) LoadModule: "extmod"
[   225.824] (II) Module "extmod" already built-in
[   225.824] (II) LoadModule: "glx"
[   225.824] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[   225.825] (II) Module glx: vendor="X.Org Foundation"
[   225.825] 	compiled for 1.20.4, module version = 1.0.0
[   225.825] 	ABI class: X.Org Server Extension, version 10.0
[   225.825] (II) LoadModule: "int10"
[   225.825] (II) Loading /usr/lib/xorg/modules/libint10.so
[   225.826] (II) Module int10: vendor="X.Org Foundation"
[   225.826] 	compiled for 1.20.4, module version = 1.0.0
[   225.826] 	ABI class: X.Org Video Driver, version 24.0
[   225.826] (II) LoadModule: "record"
[   225.826] (II) Module "record" already built-in
[   225.826] (II) LoadModule: "vbe"
[   225.826] (II) Loading /usr/lib/xorg/modules/libvbe.so
[   225.826] (II) Module vbe: vendor="X.Org Foundation"
[   225.826] 	compiled for 1.20.4, module version = 1.1.0
[   225.826] 	ABI class: X.Org Video Driver, version 24.0
[   225.826] (II) LoadModule: "xorgxrdp"
[   225.826] (II) Loading /usr/lib/xorg/modules/libxorgxrdp.so
[   225.827] (II) Module XORGXRDP: vendor="X.Org Foundation"
[   225.827] 	compiled for 1.20.4, module version = 0.2.13
[   225.827] 	ABI class: X.Org Video Driver, version 24.0
[   225.827] xorgxrdpSetup:
[   225.827] (II) LoadModule: "fb"
[   225.827] (II) Loading /usr/lib/xorg/modules/libfb.so
[   225.827] (II) Module fb: vendor="X.Org Foundation"
[   225.827] 	compiled for 1.20.4, module version = 1.0.0
[   225.827] 	ABI class: X.Org ANSI C Emulation, version 0.4
[   225.827] (II) LoadModule: "nvidia"
[   225.827] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[   225.828] (II) Module nvidia: vendor="NVIDIA Corporation"
[   225.828] 	compiled for 1.6.99.901, module version = 1.0.0
[   225.828] 	Module class: X.Org Video Driver
[   225.828] (II) LoadModule: "xrdpdev"
[   225.828] (II) Loading /usr/lib/xorg/modules/drivers/xrdpdev_drv.so
[   225.828] (II) Module XRDPDEV: vendor="X.Org Foundation"
[   225.828] 	compiled for 1.20.4, module version = 0.2.13
[   225.828] 	ABI class: X.Org Video Driver, version 24.0
[   225.828] xrdpdevSetup:
[   225.828] (II) LoadModule: "kbd"
[   225.829] (II) Loading /usr/lib/xorg/modules/input/kbd_drv.so
[   225.829] (II) Module kbd: vendor="X.Org Foundation"
[   225.829] 	compiled for 1.19.3, module version = 1.9.0
[   225.829] 	Module class: X.Org XInput Driver
[   225.829] 	ABI class: X.Org XInput driver, version 24.1
[   225.829] (II) LoadModule: "mouse"
[   225.829] (II) Loading /usr/lib/xorg/modules/input/mouse_drv.so
[   225.830] (II) Module mouse: vendor="X.Org Foundation"
[   225.830] 	compiled for 1.20.0, module version = 1.9.3
[   225.830] 	Module class: X.Org XInput Driver
[   225.830] 	ABI class: X.Org XInput driver, version 24.1
[   225.830] (II) NVIDIA dlloader X Driver  440.64  Fri Feb 21 00:49:33 UTC 2020
[   225.830] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[   225.830] rdpIdentify:
[   225.830] (II) XRDPDEV: driver for xrdp: XRDPDEV
[   225.830] rdpDriverFunc: op 10
[   225.830] (EE) 
Fatal server error:
[   225.830] (EE) xf86OpenConsole: Cannot open virtual console 2 (Permission denied)
[   225.830] (EE) 
[   225.830] (EE) 
Please consult the The X.Org Foundation support 
	 at http://wiki.x.org
 for help. 
[   225.830] (EE) Please also check the log file at ".xorgxrdp.10.log" for additional information.
[   225.830] (EE) 
[   225.830] (WW) xf86CloseConsole: KDSETMODE failed: Bad file descriptor
[   225.830] (WW) xf86CloseConsole: VT_GETMODE failed: Bad file descriptor
[   225.830] (EE) Server terminated with error (1). Closing log file.
@Nexarian
Copy link
Contributor Author

Nexarian commented Apr 16, 2020

Here is my /etc/X11/xorg.conf:

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 440.64

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "DELL U3419W"
    HorizSync       30.0 - 89.0
    VertRefresh     48.0 - 85.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "Quadro P5000"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "HardDPMS" "false"
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-3"
    Option         "metamodes" "2560x1080 +0+0"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

@Nexarian
Copy link
Contributor Author

And here is my /etc/X11/xrdp/xorg.conf:

Section "ServerLayout"
    Identifier "X11 Server"
    Screen "Screen (xrdpdev)"
    InputDevice "xrdpMouse" "CorePointer"
    InputDevice "xrdpKeyboard" "CoreKeyboard"
EndSection

Section "ServerFlags"
    Option "DontVTSwitch" "on"
    Option "AutoAddDevices" "off"
EndSection

Section "Module"
    Load "dbe"
    Load "ddc"
    Load "extmod"
    Load "glx"
    Load "int10"
    Load "record"
    Load "vbe"
    Load "xorgxrdp"
    Load "fb"
EndSection

Section "InputDevice"
    Identifier "xrdpKeyboard"
    Driver "xrdpkeyb"
EndSection

Section "InputDevice"
    Identifier "xrdpMouse"
    Driver "xrdpmouse"
EndSection

Section "Monitor"
    Identifier "Monitor"
    Option "DPMS"
    HorizSync 30-80
    VertRefresh 60-75
    ModeLine "1920x1080" 138.500 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsync
    ModeLine "1280x720" 74.25 1280 1720 1760 1980 720 725 730 750 +HSync +VSync
    Modeline "1368x768" 72.25 1368 1416 1448 1528 768 771 781 790 +hsync -vsync
    Modeline "1600x900" 119.00 1600 1696 1864 2128 900 901 904 932 -hsync +vsync
EndSection

Section "Device"
    Identifier "Video Card (xrdpdev)"
    Driver "xrdpdev"
    Option "DRMDevice" "/dev/dri/renderD128"
    Option "DRI3" "1"
EndSection

Section "Screen"
    Identifier "Screen (xrdpdev)"
    Device "Video Card (xrdpdev)"
    Monitor "Monitor"
    DefaultDepth 24
    SubSection "Display"
        Depth 24
        Modes "640x480" "800x600" "1024x768" "1280x720" "1280x1024" "1600x900" "1920x1080"
    EndSubSection
EndSection

@jsorg71
Copy link
Contributor

jsorg71 commented Apr 16, 2020

If you see this in the log
[ 225.830] (II) NVIDIA dlloader X Driver 440.64 Fri Feb 21 00:49:33 UTC 2020
[ 225.830] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
it means Xorg is loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
I have not seen that work yet with xrdpdev
Strange, I don't see it in your xrdp/xorg.conf file.
Something else must triggering it to load.

@Nexarian
Copy link
Contributor Author

That was all the hint I needed to fix it!

When you install the Nvidia Binary drivers it also dropped in /usr/share/X11/xorg.conf.d/20-nvidia.conf, contents were:

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 440.64

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    Option         "HardDPMS" "false"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
    Option         "HardDPMS" "false"
EndSection

Removed that file and XRDP immediately started working.

@Nexarian
Copy link
Contributor Author

I'm happy to answer more questions about this, otherwise you can resolve.

@jsorg71
Copy link
Contributor

jsorg71 commented Apr 17, 2020

If we can get /usr/lib/xorg/modules/drivers/nvidia_drv.so working with xorgxrdp I think that's pretty big. It means we can use prime offloading to make use of the NVidia OpenGL. It works already with modesetting / glamor drivers so I'm hopeful.

@Nexarian
Copy link
Contributor Author

Then we need to figure out why there are permission issues here, as a start.

These articles look like they have promising information:

It looks like the problem here might be that XRDP isn't using vtX. When I have other virtualized remote desktop systems that do work with Nvidia, they all have commands that look like this to load Xorg:

/usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1001/gdm/Xauthority -background none -noreset -keeptty -verbose 3

but my XRDP command uses:

/usr/lib/xorg/Xorg :11 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log

Is there a reason why XRDP doesn't load using the virtual terminal system? (vtX)

@Nexarian
Copy link
Contributor Author

/usr/lib/xorg/Xorg vt3 -displayfd 3 -auth /run/user/1001/gdm/Xauthority -background none -noreset -keeptty -verbose 1
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(--) Log file renamed from "/home/[username]/.local/share/xorg/Xorg.pid-21310.log" to "/home/[username]/.local/share/xorg/Xorg.2.log"

X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-143-generic x86_64 Ubuntu
Current Operating System: Linux [hostname] 4.15.0-97-generic #98-Ubuntu SMP Tue Apr 7 10:21:29 UTC 2020 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-97-generic root=UUID=fb7276dc-f68e-40f3-b88d-09a52f3a52b5 ro quiet splash vt.handoff=1
Build Date: 03 April 2019  09:03:57AM
xorg-server 2:1.20.4-1ubuntu3 (For technical support please see http://www.ubuntu.com/support) 
Current version of pixman: 0.34.0
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/home/[username]/.local/share/xorg/Xorg.2.log", Time: Fri Apr 17 16:31:41 2020
(==) Using config file: "/etc/X11/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(==) ServerLayout "Layout0"
(**) |-->Screen "Screen0" (0)
(**) |   |-->Monitor "Monitor0"
(**) |   |-->Device "Device0"
(**) |-->Input Device "Keyboard0"
(**) |-->Input Device "Mouse0"
(==) Automatically adding devices
(==) Automatically enabling devices
(==) Automatically adding GPU devices
(==) Automatically binding GPU devices
(==) Max clients allowed: 256, resource mask: 0x1fffff
(WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
	Entry deleted from font path.
(==) FontPath set to:
	/usr/share/fonts/X11/misc,
	/usr/share/fonts/X11/100dpi/:unscaled,
	/usr/share/fonts/X11/75dpi/:unscaled,
	/usr/share/fonts/X11/Type1,
	/usr/share/fonts/X11/100dpi,
	/usr/share/fonts/X11/75dpi,
	built-ins
(==) ModulePath set to "/usr/lib/xorg/modules"
(WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
(WW) Disabling Keyboard0
(WW) Disabling Mouse0
(++) using VT number 3

(II) systemd-logind: took control of session /org/freedesktop/login1/session/_358
(II) xfree86: Adding drm device (/dev/dri/card0)
(EE) systemd-logind: failed to take device /dev/dri/card0: Operation not permitted
(--) PCI:*(101@0:0:0) 10de:1bb0:1028:11b2 rev 161, Mem @ 0xd7000000/16777216, 0xc0000000/268435456, 0xd0000000/33554432, I/O @ 0x0000b000/128, BIOS @ 0x????????/131072
(II) Loading /usr/lib/xorg/modules/extensions/libglx.so
(II) Module glx: vendor="X.Org Foundation"
	compiled for 1.20.4, module version = 1.0.0
(II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
(II) Module nvidia: vendor="NVIDIA Corporation"
	compiled for 1.6.99.901, module version = 1.0.0
(II) NVIDIA dlloader X Driver  440.64  Fri Feb 21 00:49:33 UTC 2020
(II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
(WW) xf86OpenConsole: VT_ACTIVATE failed: Operation not permitted
(EE) 
Fatal server error:
(EE) xf86OpenConsole: Switching VT failed
(EE) 
(EE) 
Please consult the The X.Org Foundation support 
	 at http://wiki.x.org
 for help. 
(EE) Please also check the log file at "/home/[username]/.local/share/xorg/Xorg.2.log" for additional information.
(EE) 
(WW) xf86CloseConsole: KDSETMODE failed: Operation not permitted
(WW) xf86CloseConsole: VT_SETMODE failed: Operation not permitted
(WW) xf86CloseConsole: VT_ACTIVATE failed: Operation not permitted
(EE) Server terminated with error (1). Closing log file.

@Nexarian
Copy link
Contributor Author

sudo /usr/lib/xorg/Xorg vt3 -displayfd 3 -auth /run/user/1001/gdm/Xauthority -background none -noreset -keeptty -verbose 1
[sudo] password for [username]: 
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(--) Log file renamed from "/var/log/Xorg.pid-25893.log" to "/var/log/Xorg.2.log"

X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-143-generic x86_64 Ubuntu
Current Operating System: Linux [hostname] 4.15.0-97-generic #98-Ubuntu SMP Tue Apr 7 10:21:29 UTC 2020 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-97-generic root=UUID=fb7276dc-f68e-40f3-b88d-09a52f3a52b5 ro quiet splash vt.handoff=1
Build Date: 03 April 2019  09:03:57AM
xorg-server 2:1.20.4-1ubuntu3 (For technical support please see http://www.ubuntu.com/support) 
Current version of pixman: 0.34.0
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.2.log", Time: Fri Apr 17 16:58:31 2020
(==) Using config file: "/etc/X11/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(==) ServerLayout "Layout0"
(**) |-->Screen "Screen0" (0)
(**) |   |-->Monitor "Monitor0"
(**) |   |-->Device "Device0"
(**) |-->Input Device "Keyboard0"
(**) |-->Input Device "Mouse0"
(==) Automatically adding devices
(==) Automatically enabling devices
(==) Automatically adding GPU devices
(==) Automatically binding GPU devices
(==) Max clients allowed: 256, resource mask: 0x1fffff
(WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
	Entry deleted from font path.
(==) FontPath set to:
	/usr/share/fonts/X11/misc,
	/usr/share/fonts/X11/100dpi/:unscaled,
	/usr/share/fonts/X11/75dpi/:unscaled,
	/usr/share/fonts/X11/Type1,
	/usr/share/fonts/X11/100dpi,
	/usr/share/fonts/X11/75dpi,
	built-ins
(==) ModulePath set to "/usr/lib/xorg/modules"
(WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
(WW) Disabling Keyboard0
(WW) Disabling Mouse0
(++) using VT number 3

(II) systemd-logind: took control of session /org/freedesktop/login1/session/_358
(II) xfree86: Adding drm device (/dev/dri/card0)
(EE) systemd-logind: failed to take device /dev/dri/card0: Operation not permitted
(--) PCI:*(101@0:0:0) 10de:1bb0:1028:11b2 rev 161, Mem @ 0xd7000000/16777216, 0xc0000000/268435456, 0xd0000000/33554432, I/O @ 0x0000b000/128, BIOS @ 0x????????/131072
(II) Loading /usr/lib/xorg/modules/extensions/libglx.so
(II) Module glx: vendor="X.Org Foundation"
	compiled for 1.20.4, module version = 1.0.0
(II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
(II) Module nvidia: vendor="NVIDIA Corporation"
	compiled for 1.6.99.901, module version = 1.0.0
(II) NVIDIA dlloader X Driver  440.64  Fri Feb 21 00:49:33 UTC 2020
(II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
(II) Loading /usr/lib/xorg/modules/libfb.so
(II) Module fb: vendor="X.Org Foundation"
	compiled for 1.20.4, module version = 1.0.0
(II) Loading /usr/lib/xorg/modules/libwfb.so
(II) Module wfb: vendor="X.Org Foundation"
	compiled for 1.20.4, module version = 1.0.0
(**) NVIDIA(0): Depth 24, (--) framebuffer bpp 32
(==) NVIDIA(0): RGB weight 888
(==) NVIDIA(0): Default visual is TrueColor
(==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
(**) NVIDIA(0): Stereo disabled by request
(**) NVIDIA(0): NVIDIA SLI disabled.
(**) NVIDIA(0): NVIDIA Multi-GPU disabled.
(**) NVIDIA(0): Enabling 2D acceleration
(II) Loading /usr/lib/xorg/modules/extensions/libglxserver_nvidia.so
(II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
	compiled for 1.6.99.901, module version = 1.0.0
(II) NVIDIA GLX Module  440.64  Fri Feb 21 00:46:14 UTC 2020
(II) NVIDIA: The X server does not support PRIME Render Offload.
(--) NVIDIA(0): Valid display device(s) on GPU-0 at PCI:101:0:0
(--) NVIDIA(0):     DFP-0
(--) NVIDIA(0):     DFP-1
(--) NVIDIA(0):     DFP-2
(--) NVIDIA(0):     DFP-3 (boot)
(--) NVIDIA(0):     DFP-4
(--) NVIDIA(0):     DFP-5
(--) NVIDIA(0):     DFP-6
(--) NVIDIA(0):     DFP-7
(--) NVIDIA(0):     DFP-8
(II) NVIDIA(0): NVIDIA GPU Quadro P5000 (GP104GL-A) at PCI:101:0:0 (GPU-0)
(--) NVIDIA(0): Memory: 16777216 kBytes
(--) NVIDIA(0): VideoBIOS: 86.04.69.00.3f
(II) NVIDIA(0): Detected PCI Express Link width: 16X
(--) NVIDIA(GPU-0): DFP-0: disconnected
(--) NVIDIA(GPU-0): DFP-0: Internal TMDS
(--) NVIDIA(GPU-0): DFP-0: 330.0 MHz maximum pixel clock
(--) NVIDIA(GPU-0): 
(--) NVIDIA(GPU-0): DFP-1: disconnected
(--) NVIDIA(GPU-0): DFP-1: Internal DisplayPort
(--) NVIDIA(GPU-0): DFP-1: 1440.0 MHz maximum pixel clock
(--) NVIDIA(GPU-0): 
(--) NVIDIA(GPU-0): DFP-2: disconnected
(--) NVIDIA(GPU-0): DFP-2: Internal TMDS
(--) NVIDIA(GPU-0): DFP-2: 165.0 MHz maximum pixel clock
(--) NVIDIA(GPU-0): 
(--) NVIDIA(GPU-0): DELL U3419W (DFP-3): connected
(--) NVIDIA(GPU-0): DELL U3419W (DFP-3): Internal DisplayPort
(--) NVIDIA(GPU-0): DELL U3419W (DFP-3): 1440.0 MHz maximum pixel clock
(--) NVIDIA(GPU-0): 
(--) NVIDIA(GPU-0): DFP-4: disconnected
(--) NVIDIA(GPU-0): DFP-4: Internal TMDS
(--) NVIDIA(GPU-0): DFP-4: 165.0 MHz maximum pixel clock
(--) NVIDIA(GPU-0): 
(--) NVIDIA(GPU-0): DFP-5: disconnected
(--) NVIDIA(GPU-0): DFP-5: Internal DisplayPort
(--) NVIDIA(GPU-0): DFP-5: 1440.0 MHz maximum pixel clock
(--) NVIDIA(GPU-0): 
(--) NVIDIA(GPU-0): DFP-6: disconnected
(--) NVIDIA(GPU-0): DFP-6: Internal TMDS
(--) NVIDIA(GPU-0): DFP-6: 165.0 MHz maximum pixel clock
(--) NVIDIA(GPU-0): 
(--) NVIDIA(GPU-0): DFP-7: disconnected
(--) NVIDIA(GPU-0): DFP-7: Internal DisplayPort
(--) NVIDIA(GPU-0): DFP-7: 1440.0 MHz maximum pixel clock
(--) NVIDIA(GPU-0): 
(--) NVIDIA(GPU-0): DFP-8: disconnected
(--) NVIDIA(GPU-0): DFP-8: Internal TMDS
(--) NVIDIA(GPU-0): DFP-8: 165.0 MHz maximum pixel clock
(--) NVIDIA(GPU-0): 
(II) NVIDIA(0): Validated MetaModes:
(II) NVIDIA(0):     "2560x1080+0+0"
(II) NVIDIA(0): Virtual screen size determined to be 2560 x 1080
(--) NVIDIA(0): DPI set to (81, 83); computed from "UseEdidDpi" X config
(--) NVIDIA(0):     option
(II) NVIDIA: Using 24576.00 MB of virtual memory for indirect memory
(II) NVIDIA:     access.
(II) NVIDIA(0): Setting mode "2560x1080+0+0"
(==) NVIDIA(0): Disabling shared memory pixmaps
(==) NVIDIA(0): Backing store enabled
(==) NVIDIA(0): Silken mouse enabled
(**) NVIDIA(0): DPMS enabled
(II) NVIDIA(0): [DRI2] Setup complete
(II) NVIDIA(0): [DRI2]   VDPAU driver: nvidia
(II) SELinux: Disabled on system
(II) Initializing extension GLX
(II) Indirect GLX disabled.
(II) GLX: Another vendor is already registered for screen 0
(II) config/udev: Adding input device Power Button (/dev/input/event2)
(**) Power Button: Applying InputClass "evdev keyboard catchall"
(**) Power Button: Applying InputClass "libinput keyboard catchall"
(II) Loading /usr/lib/xorg/modules/input/libinput_drv.so
(II) Module libinput: vendor="X.Org Foundation"
	compiled for 1.20.4, module version = 0.28.2
(II) Using input driver 'libinput' for 'Power Button'
(EE) systemd-logind: failed to take device /dev/input/event2: Operation not permitted
(**) Power Button: always reports core events
(II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 6)
(II) config/udev: Adding input device Power Button (/dev/input/event1)
(**) Power Button: Applying InputClass "evdev keyboard catchall"
(**) Power Button: Applying InputClass "libinput keyboard catchall"
(II) Using input driver 'libinput' for 'Power Button'
(EE) systemd-logind: failed to take device /dev/input/event1: Operation not permitted
(**) Power Button: always reports core events
(II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 7)
(II) config/udev: Adding input device Sleep Button (/dev/input/event0)
(**) Sleep Button: Applying InputClass "evdev keyboard catchall"
(**) Sleep Button: Applying InputClass "libinput keyboard catchall"
(II) Using input driver 'libinput' for 'Sleep Button'
(EE) systemd-logind: failed to take device /dev/input/event0: Operation not permitted
(**) Sleep Button: always reports core events
(II) XINPUT: Adding extended input device "Sleep Button" (type: KEYBOARD, id 8)
(II) config/udev: Adding input device HDA Intel PCH Rear Mic (/dev/input/event5)
(II) No input driver specified, ignoring this device.
(II) This device may have been added with another device file.
(II) config/udev: Adding input device HDA Intel PCH Front Mic (/dev/input/event6)
(II) No input driver specified, ignoring this device.
(II) This device may have been added with another device file.
(II) config/udev: Adding input device HDA Intel PCH Line Out (/dev/input/event7)
(II) No input driver specified, ignoring this device.
(II) This device may have been added with another device file.
(II) config/udev: Adding input device HDA Intel PCH Front Headphone (/dev/input/event8)
(II) No input driver specified, ignoring this device.
(II) This device may have been added with another device file.
(II) config/udev: Adding input device HDA NVidia HDMI/DP,pcm=7 (/dev/input/event10)
(II) No input driver specified, ignoring this device.
(II) This device may have been added with another device file.
(II) config/udev: Adding input device HDA NVidia HDMI/DP,pcm=8 (/dev/input/event11)
(II) No input driver specified, ignoring this device.
(II) This device may have been added with another device file.
(II) config/udev: Adding input device HDA NVidia HDMI/DP,pcm=9 (/dev/input/event12)
(II) No input driver specified, ignoring this device.
(II) This device may have been added with another device file.
(II) config/udev: Adding input device HDA NVidia HDMI/DP,pcm=3 (/dev/input/event9)
(II) No input driver specified, ignoring this device.
(II) This device may have been added with another device file.
(II) config/udev: Adding input device Dell WMI hotkeys (/dev/input/event4)
(**) Dell WMI hotkeys: Applying InputClass "evdev keyboard catchall"
(**) Dell WMI hotkeys: Applying InputClass "libinput keyboard catchall"
(II) Using input driver 'libinput' for 'Dell WMI hotkeys'
(EE) systemd-logind: failed to take device /dev/input/event4: Operation not permitted
(**) Dell WMI hotkeys: always reports core events
(II) XINPUT: Adding extended input device "Dell WMI hotkeys" (type: KEYBOARD, id 9)
(II) config/udev: Adding input device AT Translated Set 2 keyboard (/dev/input/event3)
(**) AT Translated Set 2 keyboard: Applying InputClass "evdev keyboard catchall"
(**) AT Translated Set 2 keyboard: Applying InputClass "libinput keyboard catchall"
(II) Using input driver 'libinput' for 'AT Translated Set 2 keyboard'
(EE) systemd-logind: failed to take device /dev/input/event3: Operation not permitted
(**) AT Translated Set 2 keyboard: always reports core events
(II) XINPUT: Adding extended input device "AT Translated Set 2 keyboard" (type: KEYBOARD, id 10)
(EE) 
Fatal server error:
(EE) Cannot write display number to fd 3
(EE) 
(EE) 
Please consult the The X.Org Foundation support 
	 at http://wiki.x.org
 for help. 
(EE) Please also check the log file at "/var/log/Xorg.2.log" for additional information.
(EE) 
(EE) Server terminated with error (1). Closing log file.

@ganeshjkale
Copy link

@metalefty any update for newer xorg version support

@matt335672
Copy link
Member

Hi @Nexarian

I've been looking at a similar issue in #2010 where a load of the modesetting driver causes the X server to try to open the console. The solution I adopted in that instance was to prevent modesetting driver loading.

I know you've been looking into this area with Jay. Is there anything at this point you'd like to add to the above, or is the best solution currently to stop the hardware driver (modesetting/nvidia/whatever) from loading?

Thanks for any info.

@Nexarian
Copy link
Contributor Author

Hi @matt335672!

Thanks for reaching out. I feel like I'm often learning about how these systems work in the same way physicists learn using a particle accelerator, by smashing things about and investigating what cracks open, but I'll give you what I know and my recommendations:

First, some definitions?

  • What is "the console"? I assume it's not the terminal, right? And why do you need superuser permissions to open it? This is a piece I'm still struggling to understand.
  • I'm still not 100% sure what modesetting is, especially in the context of XRDP.

Next, here's what I know so far:

  1. Anecdotally, I've found that turning modesetting on/off never seems to affect this error with XRDP. You can change this in the Kernel boot parameters or alter it all you wish, but my best investigations have shown modesetting to be a red herring. It's actually not the thing that's important.
  2. What is important is what driver is being loaded. The issue is that XRDP needs special provisions to load non-default drivers. So what's happening here is the Optimus driver is "weird" and XRDP doesn't know how to load it. One solution is to block Linux from loading it, that is true, but that's like using a nuke to kill an ant.
  3. However, a BETTER solution is to see if we can get the driver loaded. There are two ways:
  4. First, for non-Nvidia stuff, you can recompile xorgxrdp with the --enable-glamor flag. I think that actually allows for the system to directly load Intel and AMD drivers into the Xorg session.
  5. Second, I think it's time we get at least a prototype of the Nvidia driver compatibility merged into xorgxrdp. It's actually an incredibly small change all things considered, and we can put it behind an optional build flag and document it as-is, and then iterate (Jay has big plans for enabling user-selectable sessions that enable or disable nvidia on the fly). But I've been using the Nvidia compat for over a year, and it's been rock solid ever since I discovered this next thing...
  6. Make sure the drivers on your system are in a clean state. Windows used to have this concept known as "DLL HELL" and Linux has its own version of this. When xorgxrdp hits this modesetting error, it doesn't actually exit, which enables us to use lsof to investigate what *.so module files Xorg has actually loaded. Most of the time, I think you'll find that it's loading a driver we don't want or, in the case of the thing that made this difficult for me, two different versions of the same Nvidia driver that were incompatible. Once I figured that out, it's been rock-solid ever since.
  7. While removing the xorg config directory "works" I'd be curious as to which config file actually is the problem. I think you can do a scientific method approach here, remove one file and see if it fails, until we narrow down exactly which one is causing the issue. I suspect we might be surprised by which file in Optimus is causing the issue. It might simply be that in spite of the configuration for Optimus, it's always trying to load the Nvidia driver, which would explain this error succinctly.
  8. Also, if nouveau is installed, remove it. I've never found it to be worthwhile. Nvidia has essentially nerfed it.

To conclude, both Glamor and "nvidia_hack" allow for the driver files to be directly loaded into the Xorg session without superuser permissions, and allow for direct access to the hardware. That's what Optimus is trying to do here, but to be sure we should do a scientific "remove and test" solution to see which file in the config directory of the affected system is really the culprit, and analyze further from there. Without special provisions to load whatever driver is being targeted, the xorgxrdp driver fails with this modesetting error, which is ultimately misleading. Finally, we should use lsof on the failed process to confirm what it is that's attempting to be loaded.

Does this help?

@matt335672
Copy link
Member

Thanks for the info @Nexarian

From what I can tell from the X server sources, if certain modules are loaded, the X server will try to open the 'console', which is indeed a physical or virtual terminal. This is done by a call to xf86OpenConsole() :-

https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/hw/xfree86/os-support/linux/lnx_init.c#L173

The code which makes that determination is here:-

https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/hw/xfree86/common/xf86Init.c#L413-436

When the modesetting (or nvidia or whatever) module is loaded into the xf86DriverList, it's looks pretty inevitable that we will try to open the console. So I can only think that your existing loading methods are somehow bypassing this.

It's always possible of course I'm completely misreading the code here!

I've tried to be more scientific about this with the OP for the issue, but frankly I wasn't getting anywhere, and config management was not working at all. However:-

  • The logging told me consistently however that loading modesetting was game over
  • There were only two files in /etc/X11/xorg.conf.d/. The other file was related to the keyboard, so I think we can be pretty sure that the load of the modesetting driver caused the error.

I'm unable to reproduce the original fault here sadly. I don't have any hardware which seems to make this happen.

I'll bear the above in mind however, and next time I get a similar fault to triage (it shouldn't be long!), I'll be better prepared.

I hope the above is at least of some interest.

@slalomsk8er
Copy link

slalomsk8er commented Jun 29, 2023

Just had the same error after Debian 12 upgrade.

Somehow the new lines in /etc/X11/xrdp/xorg.conf.dpkg-dist didn't help

Section "ServerFlags"
    # This line prevents "ServerLayout" sections in xorg.conf.d files
    # overriding the "X11 Server" layout (xrdp #1784)
    Option "DefaultServerLayout" "X11 Server"
    Option "DontVTSwitch" "on"

But the comment gave me a idea.

A mv /etc/X11/xorg.conf.d/ /etc/X11/xorg.conf.d.bak did make xrdp work again but I guess it broke anything else.

@matt335672
Copy link
Member

@Nexarian - can we close this one now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants