我在 CentOS Linux(版本 7.7.1908)上安装了 tigervnc-server。
我成功配置并启用了 VNC 服务,但是,运行
sudo systemctl status vncserver@:1.service
输出结果如下:
vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled)
Active: failed (Result: resources) since Thu 2019-10-10 13:57:15 +03; 34s ago
Process: 1379 ExecStart=/usr/sbin/runuser -l user-1 -c /usr/bin/vncserver %i (code=exited, status=0/SUCCESS)
Process: 1291 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Oct 10 13:57:09 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...
Oct 10 13:57:15 localhost.localdomain systemd[1]: New main PID 1779 does not belong to service, and PID file is not owned by root. Refusing.
Oct 10 13:57:15 localhost.localdomain systemd[1]: New main PID 1779 does not belong to service, and PID file is not owned by root. Refusing.
Oct 10 13:57:15 localhost.localdomain systemd[1]: Failed to start Remote desktop service (VNC).
Oct 10 13:57:15 localhost.localdomain systemd[1]: Unit vncserver@:1.service entered failed state.
Oct 10 13:57:15 localhost.localdomain systemd[1]: vncserver@:1.service failed.
我可以看到 VNC 服务器正在运行:
ps aux | grep vnc
user+ 1779 0.2 0.7 184456 30936 ? S 13:57 0:00 /usr/bin/Xvnc :1 -auth /home/user-1/.Xauthority -desktop localhost.localdomain:1 (user-1) -fp catalogue:/etc/X11/fontpath.d -geometry 1920x1080 -pn -rfbauth /home/user-1/.vnc/passwd -rfbport 5901 -rfbwait 30000
user+ 1895 0.0 0.0 113184 1184 ? S 13:57 0:00 /bin/sh /home/user-1/.vnc/xstartup
并且我也可以通过 VNC 客户端连接到机器,但屏幕分辨率并没有改变为 1920x1080。
什么原因可能导致这样的问题?
答案1
我发现这个链接解释了 systemd 发生了一些变化,所以问题很可能出在这里。
https://community.oracle.com/thread/4286364
我已经从 vncserver@:x 文件中删除了引用 pid 的行,不再收到错误报告,尽管 pid 仍在报告错误。希望很快能修复。
希望这会有所帮助并能解决您的问题