我正在尝试在启动时启用 XRDP,并且我使用 systemd 完成了此操作,但我的问题是在我的 Windows PC 上使用 rdp 连接到它之前,显示会话似乎没有运行。有没有办法在启动时做到这一点?systemctl 显示了这个
pi@raspberrypi:~ $ systemctl status xrdp
● xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-02-05 18:20:18 PST; 1min 37s ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Process: 579 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, status=0/SUCCESS)
Process: 629 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 718 (xrdp)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/xrdp.service
└─718 /usr/sbin/xrdp
Feb 05 18:20:16 raspberrypi systemd[1]: Starting xrdp daemon...
Feb 05 18:20:17 raspberrypi xrdp[629]: (629)(-1225107424)[DEBUG] Testing if xrdp can listen on 0.0.0.0 port 3389.
Feb 05 18:20:17 raspberrypi xrdp[629]: (629)(-1225107424)[DEBUG] Closed socket 7 (AF_INET6 :: port 3389)
Feb 05 18:20:17 raspberrypi systemd[1]: xrdp.service: Can't open PID file /run/xrdp/xrdp.pid (yet?) after start: No such
Feb 05 18:20:18 raspberrypi systemd[1]: Started xrdp daemon.
Feb 05 18:20:19 raspberrypi xrdp[718]: (718)(-1225107424)[INFO ] starting xrdp with pid 718
Feb 05 18:20:19 raspberrypi xrdp[718]: (718)(-1225107424)[INFO ] listening to port 3389 on 0.0.0.0
一旦我运行了一个需要在 ssh 上显示的程序,例如 qbittorrent。
pi@raspberrypi:~ $ DISPLAY=:10 qbittorrent
qt.qpa.screen: QXcbConnection: Could not connect to display :10
Could not connect to any X display.
如果我首先在我的 Windows PC 上使用 rdp 连接到 pi,程序将照常启动。