本文共 2134 字,大约阅读时间需要 7 分钟。
报错信息:
查看vnc服务是否开启:
sudo systemctl status vncserver@:1.service -l
[root@localhost ~]# sudo systemctl status vncserver@:1.service -l
vncserver@:1.service - Remote desktop service (VNC) Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled) Active: failed (Result: resources) since 二 2019-07-09 10:57:10 CST; 41min ago7月 09 10:57:07 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...
7月 09 10:57:10 localhost.localdomain systemd[1]: PID file /home/root/.vnc/localhost.localdomain:1.pid not readable (yet?) after start. 7月 09 10:57:10 localhost.localdomain systemd[1]: Failed to start Remote desktop service (VNC). 7月 09 10:57:10 localhost.localdomain systemd[1]: Unit vncserver@:1.service entered failed state. 7月 09 10:57:10 localhost.localdomain systemd[1]: vncserver@:1.servivice failed.
vi /root/.vnc/xstartup 配置vnc的很多bug,主要就是这个配置文件要修改好
解决方法:
[Service] #Type=forking Type=simple
解决了 成功开启服务
[root@localhost ~]# sudo systemctl status vncserver@:1.service -l vncserver@:1.service - Remote desktop service (VNC) Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled) Active: inactive (dead) since 二 2019-07-09 13:06:29 CST; 35s ago Process: 3437 ExecStop=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS) Process: 3406 ExecStart=/usr/sbin/runuser -l root -c /usr/bin/vncserver %i (code=exited, status=0/SUCCESS) Process: 3400 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS) Main PID: 3406 (code=exited, status=0/SUCCESS)7月 09 13:06:24 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...
7月 09 13:06:24 localhost.localdomain systemd[1]: Started Remote desktop service (VNC). 7月 09 13:06:28 localhost.localdomain runuser[3406]: Starting applications specified in /root/.vnc/xstartup 7月 09 13:06:28 localhost.localdomain runuser[3406]: Log file is /root/.vnc/localhost.localdomain:1.log刷新服务
# systemctl daemon-reload启动服务
# systemctl start vncserver@:1.service停止vncserver
vncserver -kill :1 启动 VNC Server vncserver转载地址:http://arzsi.baihongyu.com/