Diagnosing why xrdp fails to start the service after boot

I am having some trouble with diagnosing why xrdp fails to start the service after boot.

× xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
     Active: failed (Result: timeout)
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
        CPU: 8ms

[INFO ] xrdp_listen_pp done
systemd[1]: xrdp.service: Can't open PID file /run/xrdp/xrdp.pid (yet?) after start: Operation not perm>
xrdp[1440]: [INFO ] starting xrdp with pid 1440
xrdp[1440]: [INFO ] address [0.0.0.0] port [3389] mode 1
xrdp[1440]: [INFO ] listening to port 3389 on 0.0.0.0
xrdp[1440]: [INFO ] xrdp_listen_pp done
systemd[1]: xrdp.service: start operation timed out. Terminating.
xrdp[1440]: [INFO ] Received termination signal, stopping the server accept new connections thread
systemd[1]: xrdp.service: Failed with result 'timeout'.
systemd[1]: Stopped xrdp daemon.

but if started manually, it works fine.

● xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2023-04-14 11:49:58 IDT; 9s ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
    Process: 2852 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, status=0/SUCCESS)
    Process: 2860 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0/SUCCESS)
   Main PID: 2861 (xrdp)
      Tasks: 1 (limit: 38359)
     Memory: 860.0K
        CPU: 5ms
     CGroup: /system.slice/xrdp.service
             └─2861 /usr/sbin/xrdp

systemd[1]: Starting xrdp daemon...
xrdp[2860]: [INFO ] address [0.0.0.0] port [3389] mode 1
xrdp[2860]: [INFO ] listening to port 3389 on 0.0.0.0
xrdp[2860]: [INFO ] xrdp_listen_pp done
systemd[1]: xrdp.service: Can't open PID file /run/xrdp/xrdp.pid (yet?) after start: Operation not perm>
systemd[1]: Started xrdp daemon.
xrdp[2861]: [INFO ] starting xrdp with pid 2861
xrdp[2861]: [INFO ] address [0.0.0.0] port [3389] mode 1
xrdp[2861]: [INFO ] listening to port 3389 on 0.0.0.0
xrdp[2861]: [INFO ] xrdp_listen_pp done

How would you suggest diagnosing this issue? I am clueless and the top results don’t seem to work or make sense to me why they would work.

Asked By: Yorai Levi

||

having the same problem. thought that error about "Can’t open PID file" might be the issue but during the 90 seconds it takes the xrdp service to fail to start the /run/xrdp directory exists with pid files in it for both xrdp and xrdp-sesman.

I’m thinking something else is going wrong.

Answered By: randy rue

based on: https://www.suse.com/support/kb/doc/?id=000019917
this solved the issue:

systemctl edit xrdp.service

and then type the following above the ### Lines below this comment will be discarded line (we’re basically adding ‘multi-user.target’ to the original definition):

[Unit]
After=multi-user.target network.target xrdp-sesman.service

Cause
By default xrdp is set to start after the network. In some
cases xrdp appears to start a bit too early leading to a timeout. This
work around creates an override for the default xrdp service so that
it starts after multi-user.target delaying its start in the boot
process a little bit. This change is persistent between updates.

Answered By: Yorai Levi
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.