VNC 启动时出现如下报错:

VNC 启动时出现如下报错:

1
vncserver

出现如下报错,无法启动.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Warning: localhost.localdomain:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server localhost.localdomain:1

Warning: localhost.localdomain:2 is taken because of /tmp/.X11-unix/X2
Remove this file if there is no X server localhost.localdomain:2

Warning: localhost.localdomain:3 is taken because of /tmp/.X11-unix/X3
Remove this file if there is no X server localhost.localdomain:3

Warning: localhost.localdomain:4 is taken because of /tmp/.X11-unix/X4
Remove this file if there is no X server localhost.localdomain:4

New 'localhost.localdomain:5 (root)' desktop is localhost.localdomain:5

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:5.log

原因: 根据提示大概知道是以前的临时文件还存在,因此删除掉就OK

1. 删除掉临时文件

1
2
3
rm -rf /tmp/.X11-unix/X1
rm -rf /tmp/.X11-unix/X2
rm -rf /tmp/.X11-unix/X3

2. 重启vncserver

1
2
3
systemctl restart vncserver@:1.service
systemctl restart vncserver@:2.service
systemctl restart vncserver@:3.service

3. 查看是否启动成功,发现都已经成功了

1
2
3
systemctl status vncserver@:1.service
systemctl status vncserver@:2.service
systemctl status vncserver@:3.service

Leave a Reply

Your email address will not be published. Required fields are marked *