我在诊断为什么 xrdp 在启动后无法启动服务时遇到了一些麻烦。
× 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.
但如果手动启动,它可以正常工作。
● 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
您建议如何诊断此问题?我一无所知,而且顶级结果似乎不起作用,或者对我来说它们为什么起作用没有意义。
答案1
基于:https://www.suse.com/support/kb/doc/?id=000019917 这解决了这个问题:
systemctl edit xrdp.service
然后在该### Lines below this comment will be discarded
行上方输入以下内容(我们基本上将“multi-user.target”添加到原始定义中):
[Unit]
After=multi-user.target network.target xrdp-sesman.service
原因
默认情况下,xrdp 设置为在网络启动后启动。在某些情况下,xrdp 似乎启动得太早,导致超时。此解决方法为默认 xrdp 服务创建了一个覆盖,以便它在 multi-user.target 之后启动,从而在启动过程中稍微延迟其启动。此更改在更新之间保持不变。
答案2
有同样的问题。认为“无法打开 PID 文件”的错误可能是问题所在,但在 xrdp 服务启动失败的 90 秒内,/run/xrdp 目录中存在 xrdp 和 xrdp-sesman 的 pid 文件。
我在想肯定还有别的问题。