首頁 > 軟體

Ubuntu 15.10安裝VNC灰屏問題解決

2020-06-16 17:04:55

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/75dpi/, 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!

在Ubuntu 15.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 關閉這個連線號

CentOS 6.7下VNC安裝  http://www.linuxidc.com/Linux/2017-09/146884.htm

CentOS 7 安裝設定 VNC 詳解  http://www.linuxidc.com/Linux/2017-05/143324.htm

CentOS7.1安裝VNC,讓Win7遠端桌面Linux  http://www.linuxidc.com/Linux/2017-05/143346.htm

CentOS下VNC連線黑畫面問題解決  http://www.linuxidc.com/Linux/2017-01/139995.htm 

Ubuntu下安裝設定VNC遠端工具  http://www.linuxidc.com/Linux/2017-03/141936.htm


IT145.com E-mail:sddin#qq.com