我有一台装有 Ubuntu 18.04 服务器的 Raspberry Pi 4。我经常通过 VNC 控制它,因此我创建了一个 systemd 服务以在启动时启动 vnc4server,它直到昨天都运行良好,但现在服务无法启动。如果我使用 检查sudo systemctl status vnc4server@1
,我会得到:
[email protected] - Start VNC server at startup
Loaded: loaded (/etc/systemd/system/[email protected]; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-03-31 07:14:41 CEST; 11s ago
Process: 5103 ExecStart=/usr/bin/vnc4server -depth 24 -geometry 1280x720 :1 (code=exited, status=9
Process: 5098 ExecStartPre=/usr/bin/vnc4server -kill :1 > /dev/null 2>&1 (code=exited, status=2)
mar 31 07:14:40 bornonpiday systemd[1]: Starting Start VNC server at startup...
mar 31 07:14:40 bornonpiday systemd[5098]: pam_unix(login:session): session opened for user icolumbrmar 31 07:14:40 bornonpiday systemd[5103]: pam_unix(login:session): session opened for user icolumbrmar 31 07:14:41 bornonpiday systemd[1]: [email protected]: Control process exited, code=exited stmar 31 07:14:41 bornonpiday systemd[1]: [email protected]: Failed with result 'exit-code'.
mar 31 07:14:41 bornonpiday systemd[1]: Failed to start Start VNC server at startup.
这是我的 systemd 服务文件:
[Unit]
Description=Start VNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=icolumbro
PAMName=login
PIDFile=/home/icolumbro/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vnc4server -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vnc4server -depth 24 -geometry 1280x720 :%i
ExecStop=/usr/bin/vnc4server -kill :%i
[Install]
WantedBy=multi-user.target
如果我手动启动服务器,它就可以正常工作。出了什么问题?