1. 程式人生 > >Ubuntu 15.10 安裝VNC 灰屏的問題

Ubuntu 15.10 安裝VNC 灰屏的問題

1.在Ubuntu上首先需要安裝vnc4server

# apt-get install vnc4server

2. 第一次執行vncserver的時候需要為客戶端連線設定8位的密碼

3. 開啟服務後,根據客戶端號連線。也可以指定客戶端號

$vncserver -geometry 1366x768 :1
// 其中-geometry 指定客戶端視窗的大小,:1 指的是客戶端連線號
// 客戶端在vnc viewer中輸入 192.168.0.253:1 來連線伺服器

4. 出現灰色螢幕和×型滑鼠是因為vncserver找不到指定的圖形化軟體

該網站處,其中有位網友指出:

There are a number of things which can cause the grey screen problem. Your best bet is to look at the log file in .vnc to see what the error is. The log file name is hostName:display#.log, for example, on my machine, whose name is “golden”, it was golden:1.log.

In my case the ./vnc/xstartup file did not have the right permissions, so chmod +x ./vnc/xstartup fixed the problem. I could have fiddled with the contents of xstartup until the cows came home and it wouldn’t have helped.

我們通過檢視~/.vnc/xxx:1.log可以查看出現問題的原因。
說明一下,此處的日誌1.log表示客戶端號為1的連線日誌。

error opening security policy file
/etc/X11/xserver/SecurityPolicy Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/75
dpi/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list! Could not init font path element /usr/share/fonts/X11/75dpi/, removing from list! Could not init font path element /usr/share/fonts/X11/100dpi/, removing from list!

在Ubuntu15.10 下沒有看到相關的資料夾,可能是版本路徑的改變問題,我們通過find指令找到fonts其實是在/usr/share/fonts/下。
此處需我們建立指定目錄,然後用ln 軟連線將後者的路徑指過來,拼接成日誌中的路徑名。

配置完成後還會出現下面的幾個錯誤,但是並不會報錯了。

error opening security policy file /etc/X11/xserver/SecurityPolicy
Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/75dpi/, removing from list!

5. 需要更改~/.vnc/xstartup檔案

在安裝之前,我們先安裝如下軟體:

$sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

然後修改xstartup檔案

#!/bin/sh

# Uncomment the following two lines for normal desktop:
export XKL_XMODMAP_DISABLE=1
 unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
unset DBUS_SESSION_BUS_ADDRESS

gnome-panel &
gnmoe-settings-daemon &
metacity &
nautilus &
gnome-terminal &

重啟VNCserver就ok了。

令注:
vncserver :1 開啟服務
vncserver -kill :1 關閉這個連線號