Xrdp: Cannot open /dev/tty0 (Permission denied) - Debian 9.4

Created on 28 Jun 2018  路  21Comments  路  Source: neutrinolabs/xrdp

Hello!

I know this has been reported like thousand times but I really cannot wrap my head around it. I have compiled both xrdp and xorgxrdp from source on Debian stretch and it has been working well so far until suddenly it doesn't anymore. I believe some update has broken it but I am not able to pinpoint which one.

xVNC backend still works, but xorg backend fails with the following everytime I start a session:

```rock64@rock64:~$ cat .xorgxrdp.10.log
[ 19.449]
X.Org X Server 1.19.2
Release Date: 2017-03-02
[ 19.449] X Protocol Version 11, Revision 0
[ 19.449] Build Operating System: Linux 4.9.0-4-arm64 aarch64 Debian
[ 19.449] Current Operating System: Linux rock64 4.4.126-rockchip-ayufan-239 #1 SMP Sun May 27 18:38:24 UTC 2018 aarch64
[ 19.449] Kernel command line: rw root=LABEL=linux-root rootwait rootfstype=ext4 panic=10 init=/sbin/init coherent_pool=1M ethaddr=ea:36:e6:fe:e4:45 eth1addr=ea:36:e6:fe:e4:65 serial=412ad2801a30d12 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1
[ 19.449] Build Date: 16 October 2017 08:11:43AM
[ 19.449] xorg-server 2:1.19.2-1+deb9u2 (https://www.debian.org/support)
[ 19.449] Current version of pixman: 0.34.0
[ 19.450] Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
[ 19.450] Markers: (--) probed, () from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 19.450] (++) Log file: ".xorgxrdp.10.log", Time: Thu Jun 28 11:27:28 2018
[ 19.457] (++) Using config file: "/etc/X11/xrdp/xorg.conf"
[ 19.457] (==) Using config directory: "/etc/X11/xorg.conf.d"
[ 19.457] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[ 19.458] (==) ServerLayout "X11 Server"
[ 19.458] (
) |-->Screen "Screen (xrdpdev)" (0)
[ 19.458] () | |-->Monitor "Monitor"
[ 19.458] (
) | |-->Device "Video Card (xrdpdev)"
[ 19.458] () | |-->GPUDevice "Rockchip Graphics"
[ 19.458] (
) | |-->GPUDevice "Video Card (xrdpdev)"
[ 19.458] () |-->Input Device "xrdpMouse"
[ 19.458] (
) |-->Input Device "xrdpKeyboard"
[ 19.458] () Option "DontVTSwitch" "on"
[ 19.458] (
) Option "AutoAddDevices" "off"
[ 19.458] (**) Not automatically adding devices
[ 19.458] (==) Automatically enabling devices
[ 19.458] (==) Automatically adding GPU devices
[ 19.458] (==) Max clients allowed: 256, resource mask: 0x1fffff
[ 19.459] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[ 19.459] Entry deleted from font path.
[ 19.459] (==) 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
[ 19.459] (==) ModulePath set to "/usr/lib/xorg/modules"
[ 19.459] (II) Loader magic: 0x558f93edc8
[ 19.459] (II) Module ABI versions:
[ 19.459] X.Org ANSI C Emulation: 0.4
[ 19.459] X.Org Video Driver: 23.0
[ 19.459] X.Org XInput driver : 24.1
[ 19.459] X.Org Server Extension : 10.0
[ 19.468] (II) systemd-logind: took control of session /org/freedesktop/login1/session/c1
[ 19.470] (II) xfree86: Adding drm device (/dev/dri/card0)
[ 19.471] (EE) systemd-logind: failed to take device /dev/dri/card0: Operation not permitted
[ 19.471] (II) no primary bus or device found
[ 19.471] falling back to /sys/devices/platform/display-subsystem/drm/card0
[ 19.472] (II) "glx" will be loaded. This was enabled by default and also specified in the config file.
[ 19.472] (II) LoadModule: "dbe"
[ 19.472] (II) Module "dbe" already built-in
[ 19.472] (II) LoadModule: "ddc"
[ 19.472] (II) Module "ddc" already built-in
[ 19.472] (II) LoadModule: "extmod"
[ 19.472] (II) Module "extmod" already built-in
[ 19.472] (II) LoadModule: "glx"
[ 19.472] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[ 19.477] (II) Module glx: vendor="X.Org Foundation"
[ 19.477] compiled for 1.19.2, module version = 1.0.0
[ 19.477] ABI class: X.Org Server Extension, version 10.0
[ 19.477] (II) LoadModule: "int10"
[ 19.477] (II) Loading /usr/lib/xorg/modules/libint10.so
[ 19.486] (II) Module int10: vendor="X.Org Foundation"
[ 19.486] compiled for 1.19.2, module version = 1.0.0
[ 19.486] ABI class: X.Org Video Driver, version 23.0
[ 19.486] (II) LoadModule: "record"
[ 19.486] (II) Module "record" already built-in
[ 19.486] (II) LoadModule: "vbe"
[ 19.486] (II) Loading /usr/lib/xorg/modules/libvbe.so
[ 19.489] (II) Module vbe: vendor="X.Org Foundation"
[ 19.489] compiled for 1.19.2, module version = 1.1.0
[ 19.489] ABI class: X.Org Video Driver, version 23.0
[ 19.489] (II) LoadModule: "xorgxrdp"
[ 19.489] (II) Loading /usr/lib/xorg/modules/libxorgxrdp.so
[ 19.497] (II) Module XORGXRDP: vendor="X.Org Foundation"
[ 19.497] compiled for 1.19.2, module version = 0.2.7
[ 19.497] ABI class: X.Org Video Driver, version 23.0
[ 19.497] xorgxrdpSetup:
[ 19.497] (II) LoadModule: "fb"
[ 19.497] (II) Loading /usr/lib/xorg/modules/libfb.so
[ 19.505] (II) Module fb: vendor="X.Org Foundation"
[ 19.505] compiled for 1.19.2, module version = 1.0.0
[ 19.505] ABI class: X.Org ANSI C Emulation, version 0.4
[ 19.505] (II) LoadModule: "xrdpdev"
[ 19.505] (II) Loading /usr/lib/xorg/modules/drivers/xrdpdev_drv.so
[ 19.512] (II) Module XRDPDEV: vendor="X.Org Foundation"
[ 19.512] compiled for 1.19.2, module version = 0.2.7
[ 19.512] ABI class: X.Org Video Driver, version 23.0
[ 19.512] xrdpdevSetup:
[ 19.512] (II) LoadModule: "modesetting"
[ 19.512] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[ 19.512] (II) Module modesetting: vendor="X.Org Foundation"
[ 19.513] compiled for 1.19.2, module version = 1.19.2
[ 19.513] Module class: X.Org Video Driver
[ 19.513] ABI class: X.Org Video Driver, version 23.0
[ 19.513] (II) LoadModule: "xrdpmouse"
[ 19.513] (II) Loading /usr/lib/xorg/modules/input/xrdpmouse_drv.so
[ 19.515] (II) Module XRDPMOUSE: vendor="X.Org Foundation"
[ 19.515] compiled for 1.19.2, module version = 0.2.7
[ 19.515] Module class: X.Org XInput Driver
[ 19.515] ABI class: X.Org XInput driver, version 24.1
[ 19.515] rdpmousePlug:
[ 19.515] (II) LoadModule: "xrdpkeyb"
[ 19.515] (II) Loading /usr/lib/xorg/modules/input/xrdpkeyb_drv.so
[ 19.518] (II) Module XRDPKEYB: vendor="X.Org Foundation"
[ 19.518] compiled for 1.19.2, module version = 0.2.7
[ 19.518] Module class: X.Org XInput Driver
[ 19.518] ABI class: X.Org XInput driver, version 24.1
[ 19.518] rdpkeybPlug:
[ 19.518] rdpIdentify:
[ 19.518] (II) XRDPDEV: driver for xrdp: XRDPDEV
[ 19.518] rdpDriverFunc: op 10
[ 19.518] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[ 19.518] (EE)
Fatal server error:
[ 19.518] (EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)
[ 19.518] (EE)
[ 19.518] (EE)
Please consult the The X.Org Foundation support

Debian is 9.4 stretch
xrdp is running on a Rock64 board.

I have modified /etc/X11/Xwrapper.config as well, but no change:

```rock64@rock64:~$ cat /etc/X11/Xwrapper.config
# Xwrapper.config (Debian X Window System server wrapper configuration file)
#
# This file was generated by the post-installation script of the
# xserver-xorg-legacy package using values from the debconf database.
#
# See the Xwrapper.config(5) manual page for more information.
#
# This file is automatically updated on upgrades of the xserver-xorg-legacy
# package *only* if it has not been modified since the last upgrade of that
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command as root:
#   dpkg-reconfigure xserver-xorg-legacy
allowed_users = anybody
needs_root_rights = no

Any pointer would be super appreciated. I can provide any extra information needed. Thanks a lot! I really love xrdp and it was working very well until now :(

Most helpful comment

Fail! I forgot to install xorgxrdp!! 馃槩 At least on Ubuntu 18.04 I confirm it works out of the box by installing xrdp, xorgxrdp and doing "echo 'mate-session' ~/.xsession"

Thanks everyone! :)

All 21 comments

I will also try to install a ubuntu build on the Rock64 and see if it makes any difference. I preferred to use the Debian image since it is more stable.

Do you really need to modify /etc/X11/Xwrapper.config?

It seemed to be the way to go before so I gave it try. Even without xserver-xorg-legacy installed I get the same error. I cannot seem to find anything else around in the logs :(

In any case, why editing /etc/X11/Xwrapper.config is not required anymore?

Just installed the xrdp package from the repo on a ubuntu bionic image. Exactly the same error.

Don't see anything weird when running on interactive mode, apart from the tty error:
Gonna compile from scratch and report back.

```
rock64@rock64:~$ sudo xrdp-sesman -ns
[sudo] password for rock64:
starting sesman in foreground...
sesman config:
ListenAddress: 127.0.0.1
ListenPort: 3350
EnableUserWindowManager: 1
UserWindowManager: startwm.sh
DefaultWindowManager: startwm.sh
AuthFilePath: disabled
Xvnc parameters:
Parameter 00 Xvnc
Parameter 01 -bs
Parameter 02 -nolisten
Parameter 03 tcp
Parameter 04 -localhost
Parameter 05 -dpi
Parameter 06 96
X11rdp parameters:
XOrg parameters:
Parameter 00 /usr/lib/xorg/Xorg
Parameter 01 -config
Parameter 02 xrdp/xorg.conf
Parameter 03 -noreset
Parameter 04 -nolisten
Parameter 05 tcp
Parameter 06 -logfile
Parameter 07 .xorgxrdp.%s.log
security configuration:
AllowRootLogin: 1
MaxLoginRetry: 4
AlwaysGroupCheck: 0
No TSUsersGroup defined
No TSAdminsGroup defined
session configuration:
MaxSessions: 50
X11DisplayOffset: 10
KillDisconnected: 0
IdleTimeLimit: 0
DisconnectedTimeLimit: 0
Policy: 0
SessionVariables parameters:
Parameter 00 PULSE_SCRIPT=/etc/xrdp/pulse/default.pa
[20180628-19:35:11] [DEBUG] libscp initialized
[20180628-19:35:11] [INFO ] starting xrdp-sesman with pid 1417
[20180628-19:35:11] [INFO ] listening to port 3350 on 127.0.0.1
[20180628-19:35:19] [INFO ] A connection received from ::1 port 54126
[20180628-19:35:20] [INFO ] ++ created session (access granted): username rock64, ip ::ffff:192.168.178.213:57965 - socket: 12
[20180628-19:35:20] [INFO ] starting Xorg session...
[20180628-19:35:20] [DEBUG] Closed socket 9 (AF_INET6 :: port 5910)
[20180628-19:35:20] [DEBUG] Closed socket 9 (AF_INET6 :: port 6010)
[20180628-19:35:20] [DEBUG] Closed socket 9 (AF_INET6 :: port 6210)
[20180628-19:35:20] [DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
[20180628-19:35:20] [INFO ] calling auth_start_session from pid 1419
[20180628-19:35:20] [DEBUG] Closed socket 7 (AF_INET6 ::1 port 3350)
[20180628-19:35:20] [DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
[20180628-19:35:20] [INFO ] /usr/lib/xorg/Xorg :10 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log

Build Date: 13 April 2018 08:08:56PM
xorg-server 2:1.19.6-1ubuntu4 (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: ".xorgxrdp.10.log", Time: Thu Jun 28 19:35:20 2018
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)
(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 ".xorgxrdp.10.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
[20180628-19:35:30] [ERROR] X server for display 10 startup timeout
[20180628-19:35:30] [CORE ] waiting for window manager (pid 1420) to exit
chansrv::main: using log file [/home/rock64/.local/share/xrdp/xrdp-chansrv.10.log]
[20180628-19:35:30] [CORE ] main: app started pid 1424(0x00000590)
[20180628-19:35:30] [INFO ] main: DISPLAY env var set to :10.0
[20180628-19:35:30] [INFO ] main: using DISPLAY 10
[20180628-19:35:30] [INFO ] channel_thread_loop: thread start
[20180628-19:35:30] [ERROR] X server for display 10 startup timeout
[20180628-19:35:30] [ERROR] another Xserver might already be active on display 10 - see log
[20180628-19:35:30] [DEBUG] aborting connection...
[20180628-19:35:30] [CORE ] window manager (pid 1420) did exit, cleaning up session
[20180628-19:35:30] [INFO ] calling auth_stop_session and auth_end from pid 1419
[20180628-19:35:30] [INFO ] term_signal_handler: got signal 15
[20180628-19:35:30] [DEBUG] cleanup_sockets:
[20180628-19:35:30] [DEBUG] cleanup_sockets: deleting /var/run/xrdp/sockdir/xrdp_chansrv_socket_10
[20180628-19:35:30] [INFO ] channel_thread_loop: g_term_event set
[20180628-19:35:30] [DEBUG] cleanup_sockets: deleting /var/run/xrdp/sockdir/xrdpapi_10
xrdp-chansrv [1206173523]: scard_deinit:
chansrv:smartcard_pcsc [1206173523]: scard_pcsc_deinit:
[20180628-19:35:30] [INFO ] channel_thread_loop: thread stop
[20180628-19:35:30] [DEBUG] cleanup_sockets: failed to delete /var/run/xrdp/sockdir/xrdpapi_10
[20180628-19:35:30] [INFO ] main: app exiting pid 1424(0x00000590)
[20180628-19:35:30] [INFO ] ++ terminated session: username rock64, display :10.0, session_pid 1419, ip ::ffff:192.168.178.213:57965 - socket: 12```

Trying xrdp on a new Linux Mint 19 install and the same problem:

[ 13149.834] (EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)

and to make matters worse:

$ ps aux | grep xrdp
root     13384  0.0  0.0  42472   504 ?        S    12:00   0:00 /usr/sbin/xrdp-sesman
xrdp     13394  0.0  0.0  26100   520 ?        S    12:00   0:00 /usr/sbin/xrdp
bernd    13414  0.0  0.0  14428  1132 pts/2    S+   12:00   0:00 grep xrdp

it seems xrdp-sesman is running as root. But in case xrdp needs to open /dev/tty0:

$ ll /dev/tty0
crw--w---- 1 root tty 4, 0 Jul 4 11:52 /dev/tty0
$ sudo usermod -a -G tty xrdp
$ groups xrdp
xrdp : xrdp tty
~$ sudo chmod g+r /dev/tty0
$ ll /dev/tty0
crw-rw---- 1 root tty 4, 0 Jul 4 11:52 /dev/tty0
```

Alas, same error still in ~/.xorgxrdp.10.log:

[ 14950.248] (EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)

Hmmm, why oh why?

I had rdp working on Linux Mint 18 without a hitch ... oddities.

Have sam problem as "bernd-wechner" -with XRDP on my brand new Mint 19.

The user experience:
Giving username and pw in XRDP login gives blue screen then after approx 1 minutes i got this error:

connecting to sesman ip 127, O.O. 1 port 3350
sesman connect ok
sending login info to session manager, please wait...
login successful for display 10
started connecting
connection problem, giving up
some problem

Fail! I forgot to install xorgxrdp!! 馃槩 At least on Ubuntu 18.04 I confirm it works out of the box by installing xrdp, xorgxrdp and doing "echo 'mate-session' ~/.xsession"

Thanks everyone! :)

Installing xorgxrdp helped. Thanks. Now I get further than before but it still bombs with "could not acquire name on session bus" written on the client screen (am using mRemoteNG). The best clue I have is from ~/.xsession-errors the tail of which reads:

cinnamon-session[8989]: WARNING: t+0.00363s: Failed to acquire org.gnome.SessionManager
Gtk-Message: 15:17:41.007: GtkDialog mapped without a transient parent. This is discouraged.

Not real specific.

As the original error stated in the subject is resolved, it's probably better to start another bug if needed for this different problem.
It will help people having the same error Cannot open /dev/tty0 to find the exact solution on the end of this thread :)

Installing xorgxrdp helped me too, I was able to log in with root. Thanks. Unfortunately normal user still not work. I also agree to open a different bug report now.

I tried again with Debian 9.4, compiling from source (both xrdp and xorgxrdp). Still Cannot open /dev/tty0. There is no other error in the logs. No idea how to get around this.

The original issue in the subject seems to be solved. Closing.

I tried again with Debian 9.4, compiling from source (both xrdp and xorgxrdp). Still Cannot open /dev/tty0. There is no other error in the logs. No idea how to get around this.

I have the same issue with Archlinux. Did you figure it out?

Same issue with openSUSE Tumbleweed: it is possible to login as root but not as a user, with a Cannot open /dev/tty0 (Permission denied) error. xorgxrdp is installed.

Problem fixed by setting /usr/bin/Xorg setuid root, which can be done (on openSUSE) by editing /etc/permission.local to uncomment the Xorg line, then running chkstat --system --set to make it setuid.

@bubbleguuum Setting setuid is not a very good idea. Edit param=Xorg part in sesman.ini to fit your distro. See comments in sesman.ini.

[Xorg]
; Specify the path of non-suid Xorg executable. It might differ depending
; on your distribution and version. The typical path is shown as follows:
;
; Fedora 26 or later    :  param=/usr/libexec/Xorg
; Debian 9 or later     :  param=/usr/lib/xorg/Xorg
; Ubuntu 16.04 or later :  param=/usr/lib/xorg/Xorg
; Arch Linux            :  param=/usr/lib/xorg-server/Xorg
; CentOS 7              :  param=/usr/bin/Xorg or param=Xorg
;
param=Xorg

@bubbleguuum Setting setuid is not a very good idea. Edit param=Xorg part in sesman.ini to fit your distro. See comments in sesman.ini.

[Xorg]
; Specify the path of non-suid Xorg executable. It might differ depending
; on your distribution and version. The typical path is shown as follows:
;
; Fedora 26 or later    :  param=/usr/libexec/Xorg
; Debian 9 or later     :  param=/usr/lib/xorg/Xorg
; Ubuntu 16.04 or later :  param=/usr/lib/xorg/Xorg
; Arch Linux            :  param=/usr/lib/xorg-server/Xorg
; CentOS 7              :  param=/usr/bin/Xorg or param=Xorg
;
param=Xorg

I'm using manjaro. The Xorg.wrap is stored at /usr/lib/Xorg.wrap. I tried but it still doesn't work. The error is the same.

If I run the command shown in sesman.log directly, the terminal stucks at xrdpdevTearDown:. There is no error in the log /var/log/Xorg.10.log.

Why did you specified Xorg.wrap? The purpose of the instruction is to bypass wrapper. Specifying Xorg.wrap is no effect at all.

Take care of the server layout currently used:
~
[ 19.458] (==) ServerLayout "X11 Server"
~

It's much better to call it with a layout dedicated to xrdp and not trying to use actual hardware :-)

/etc/xrdp/sesman.ini
~
param=Xorg
; Leave the rest paramaters as-is unless you understand what will happen.
param=-config
param=xrdp/xorg.conf
param=-noreset
param=-nolisten
param=tcp
param=-logfile
param=.xorgxrdp.%s.log
param=-layout
param=xrdp
~

The last two lines have to become mandatory.
These days xorg includes crawler for config files having no stop directive ;)

/etc/X11/xrdp/xorg.conf
~
Section "ServerLayout"
Identifier "xrdp"
Screen "Screen (xrdpdev)"
InputDevice "xrdpMouse" "CorePointer"
InputDevice "xrdpKeyboard" "CoreKeyboard"
EndSection
~

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlexNikolaenko picture AlexNikolaenko  路  3Comments

zilongo picture zilongo  路  7Comments

eduardolucioac picture eduardolucioac  路  3Comments

Rubarius picture Rubarius  路  5Comments

joakim-tjernlund picture joakim-tjernlund  路  9Comments