neutrinolabs / xrdp

xrdp: an open source RDP server
http://www.xrdp.org/
Apache License 2.0
5.62k stars 1.73k forks source link

xrdp fails to start on boot #2017

Closed prabhinmp closed 2 years ago

prabhinmp commented 2 years ago

getting below error when xrdp start, once the system is up , if I do start the service manullay. it works perfectly.

● xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; disabled; vendor preset: enabled)
     Active: failed (Result: timeout) since Thu 2021-10-14 09:52:10 UTC; 10ms ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)

Oct 14 09:50:40 tdk-instance xrdp[1024]: (1024)(140456066168640)[DEBUG] Closed socket 7 (AF_INET6 :: port 3389)
Oct 14 09:50:40 tdk-instance systemd[1]: xrdp.service: Can't open PID file /run/xrdp/xrdp.pid (yet?) after start: Operation not permitted
Oct 14 09:50:42 tdk-instance xrdp[1038]: (1038)(140456066168640)[INFO ] starting xrdp with pid 1038
Oct 14 09:50:42 tdk-instance xrdp[1038]: (1038)(140456066168640)[INFO ] address [0.0.0.0] port [3389] mode 1
Oct 14 09:50:42 tdk-instance xrdp[1038]: (1038)(140456066168640)[INFO ] listening to port 3389 on 0.0.0.0
Oct 14 09:50:42 tdk-instance xrdp[1038]: (1038)(140456066168640)[INFO ] xrdp_listen_pp done
Oct 14 09:52:10 tdk-instance systemd[1]: xrdp.service: start operation timed out. Terminating.
Oct 14 09:52:10 tdk-instance xrdp[1038]: (1038)(140456066168640)[DEBUG] Closed socket 11 (AF_INET6 :: port 3389)
Oct 14 09:52:10 tdk-instance systemd[1]: xrdp.service: Failed with result 'timeout'.
Oct 14 09:52:10 tdk-instance systemd[1]: Stopped xrdp daemon.
matt335672 commented 2 years ago

Hi @prabhinmp

We'll need a bit more information that that. How's this for starters:-

Also I note that the service is disabled which seems a little odd.

Thanks.

prabhinmp commented 2 years ago

Hi @matt335672 , Please find the below info

xrdp -v

xrdp 0.9.12
  A Remote Desktop Protocol Server.
  Copyright (C) 2004-2018 Jay Sorg, Neutrino Labs, and all contributors.
  See https://github.com/neutrinolabs/xrdp for more information.
 Configure options:
      --enable-ipv6
      --enable-jpeg
      --enable-fuse
      --enable-rfxcodec
      --enable-opus
      --enable-painter
      --enable-vsock
      --build=x86_64-linux-gnu
      --prefix=/usr
      --includedir=${prefix}/include
      --mandir=${prefix}/share/man
      --infodir=${prefix}/share/info
      --sysconfdir=/etc
      --localstatedir=/var
      --disable-silent-rules
      --libdir=${prefix}/lib/x86_64-linux-gnu
      --libexecdir=${prefix}/lib/x86_64-linux-gnu
      --disable-maintainer-mode
      --disable-dependency-tracking
      --with-socketdir=/run/xrdp/sockdir
      build_alias=x86_64-linux-gnu
      CFLAGS=-g -O2 -fdebug-prefix-map=/build/xrdp-GJgww4/xrdp-0.9.12=. -fstack-protector-strong -Wformat -Werror=format-security
      LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed
      CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2
      PKG_CONFIG_PATH=/build/xrdp-GJgww4/xrdp-0.9.12/pkgconfig

systemctl cat xrdp.service

# /lib/systemd/system/xrdp.service
[Unit]
Description=xrdp daemon
Documentation=man:xrdp(8) man:xrdp.ini(5)
Requires=xrdp-sesman.service
After=network.target xrdp-sesman.service

[Service]
Type=forking
PIDFile=/run/xrdp/xrdp.pid
RuntimeDirectory=xrdp
EnvironmentFile=-/etc/sysconfig/xrdp
EnvironmentFile=-/etc/default/xrdp
User=xrdp
Group=xrdp
PermissionsStartOnly=true
ExecStartPre=/bin/sh /usr/share/xrdp/socksetup
ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS
ExecStop=/usr/sbin/xrdp $XRDP_OPTIONS --kill

[Install]
WantedBy=multi-user.target

I tried to disable the service and enable it again that why you have seen the service-disabled in the first comment.

matt335672 commented 2 years ago

It looks like systemd is failing to see the PID file created by the xrdp service

What's the output of these commands when this happens:-

ls -l /run/xrdp
ls -ld /run/xrdp
sudo systemctl status xrdp-sesman.service
prabhinmp commented 2 years ago

here is the output

root@tapp:/home/dev# ls -l /run/xrdp
total 8
drwxrwsrwt 2 xrdp xrdp 140 Oct 19 04:59 sockdir
-rw------- 1 xrdp xrdp   4 Oct 19 01:39 xrdp-sesman.pid
-rw------- 1 xrdp xrdp   4 Oct 19 01:40 xrdp.pid
root@prabhin-instance:/home/dev# ls -ld /run/xrdp
drwxr-xr-x 3 xrdp xrdp 100 Oct 19 01:40 /run/xrdp
root@prabhin-instance:/home/dev# sudo systemctl status xrdp-sesman.service
● xrdp-sesman.service - xrdp session manager
     Loaded: loaded (/lib/systemd/system/xrdp-sesman.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-10-19 01:39:58 UTC; 4h 23min ago
       Docs: man:xrdp-sesman(8)
             man:sesman.ini(5)
   Main PID: 1139 (xrdp-sesman)
      Tasks: 1 (limit: 135208)
     Memory: 4.2M
     CGroup: /system.slice/xrdp-sesman.service
             └─1139 /usr/sbin/xrdp-sesman

Oct 19 02:33:45 prabhin-instance xrdp-sesman[1139]: (1139)(140537479259712)[DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
Oct 19 02:48:44 prabhin-instance xrdp-sesman[1139]: (1139)(140537479259712)[INFO ] A connection received from ::1 port 34868
Oct 19 02:48:45 prabhin-instance xrdp-sesman[1139]: (1139)(140537479259712)[INFO ] ++ reconnected session: username dev, display :10.0, session_pid 2073, ip ::ffff:106.xx.xxx.xxx:32070 - socket: 12
Oct 19 02:48:45 prabhin-instance xrdp-sesman[1139]: (1139)(140537479259712)[DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
Oct 19 03:14:42 prabhin-instance xrdp-sesman[1139]: (1139)(140537479259712)[INFO ] A connection received from ::1 port 40388
Oct 19 03:14:42 prabhin-instance xrdp-sesman[1139]: (1139)(140537479259712)[INFO ] ++ reconnected session: username dev, display :10.0, session_pid 2073, ip ::ffff:106.xx.xxx.xxx:33305 - socket: 12
Oct 19 03:14:42 prabhin-instance xrdp-sesman[1139]: (1139)(140537479259712)[DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
Oct 19 04:59:10 prabhin-instance xrdp-sesman[1139]: (1139)(140537479259712)[INFO ] A connection received from ::1 port 33946
Oct 19 04:59:10 prabhin-instance xrdp-sesman[1139]: (1139)(140537479259712)[INFO ] ++ reconnected session: username dev, display :10.0, session_pid 2073, ip ::ffff:106.xx.xxx.xxx:33093 - socket: 12
Oct 19 04:59:10 prabhin-instance xrdp-sesman[1139]: (1139)(140537479259712)[DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
matt335672 commented 2 years ago

That all looks fine to me, and that's working on my system here so there's something else going on here which isn't obvious.

Are those commands the result directly after the problem occurs, or have you restarted xrdp manually in the meantime? That sesman log looks like sesman is accepting connections from xrdp which it wouldn't be if xrdp wasn't running.

matt335672 commented 2 years ago

@prabhinmp - have you gotten any further with this?

Thanks.