1. 問題描述
運行vncserver :1
屏幕顯示正常,但是沒有vncserver并沒有起來。用vncserver -list
沒有輸出。
環境是 OLE-7
$ vncserver :1
New '<host>:1 (<user>)' desktop is <host>:1
Starting applications specified in ~/.vnc/xstartup
Log file is ~/.vnc/<host>:1.log
$ vncserver -list
TigerVNC server sessions:
X DISPLAY # PROCESS ID
查看log信息
$ cat ~/.vnc/<host>:1.log
...
vncext: VNC extension running!
vncext: Listening for VNC connections on all interface(s), port 5901
vncext: created VNC server for screen 0
Killing Xvnc process ID 17879
XIO: fatal IO error 2 (No such file or directory) on X server ":1"^M
after 109 requests (109 known processed) with 10 events remaining.^M
XIO: fatal IO error 2 (No such file or directory) on X server ":1"^M
after 45 requests (45 known processed) with 0 events remaining.^M
Error: cannot open display: :1
2. 解決步驟
$ cat ~/.vnc/xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/etc/X11/xinit/xinitrc
# Assume either Gnome or KDE will be started by default when installed
# We want to kill the session automatically in this case when user logs out. In case you modify
# /etc/X11/xinit/Xclients or ~/.Xclients yourself to achieve a different result, then you should
# be responsible to modify below code to avoid that your session will be automatically killed
if [ -e /usr/bin/gnome-session -o -e /usr/bin/startkde ]; then
vncserver -kill $DISPLAY
fi
檢查
$ ls /etc/X11/xinit/xinitrc /usr/bin/gnome-session /usr/bin/startkde
ls: cannot access /usr/bin/startkde: No such file or directory
/etc/X11/xinit/xinitrc /usr/bin/gnome-session
發現是因為/usr/bin/startkde
不存在。所以重裝kde。
$ sudo yum group list | grep KDE
$ sudo yum groupinstall "KDE Desktop"
重啟vncserver即可。