ubuntu 18.04 VNC 灰屏

ubuntu 18.04 VNC 灰屏

我无法通过 vnc 加载我的 gnome 桌面

最初我遵循 xfce vnc 的这个指南 https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-18-04

工作的 Xfce 配置:

#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
/usr/bin/autocutsel -s CLIPBOARD -fork
vncconfig -iconic &
x-terminal-emulator -geometry 80x24x10x10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &

我正在尝试改变这一点以允许我的 gnome 会话:

我从以下位置找到了一个配置: 如何让 VNC 服务器在没有 xfce 的情况下与 ubuntu-desktop 一起工作

export XKL_XMODMAP_DISABLE=1
# unset SESSION_MANAGER
# unset DBUS_SESSION_BUS_ADDRESS

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24x10x10 -ls -title "$VNCDESKTOP Desktop" &

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

屏幕变灰了,但 Nautilus 可以正常工作(有点好笑)

我的日志如下:

25/01/20 16:12:35 Xvnc version TightVNC-1.3.10
25/01/20 16:12:35 Copyright (C) 2000-2009 TightVNC Group
25/01/20 16:12:35 Copyright (C) 1999 AT&T Laboratories Cambridge
25/01/20 16:12:35 All Rights Reserved.
25/01/20 16:12:35 See http://www.tightvnc.com/ for information on TightVNC
25/01/20 16:12:35 Desktop name 'X' (Ubuntu-server:1)
25/01/20 16:12:35 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
25/01/20 16:12:35 Listening for VNC connections on TCP port 5901
Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring
Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring
No VNC extension on display :1
/home/dev/.vnc/xstartup: 14: /home/dev/.vnc/xstartup: gnome-settings-daemon: not found

** (gnome-panel:3635): WARNING **: 16:12:36.071: Failed to request name: the name already has an owner
metacity-Message: 16:12:36.101: could not find XKB extension.

(metacity:3637): metacity-WARNING **: 16:12:36.105: Failed to create MetaCompositorXRender: Missing composite extension required for compositing

25/01/20 16:12:40 Got connection from client 192.168.0.5
25/01/20 16:12:40 Using protocol version 3.8
25/01/20 16:12:40 Full-control authentication passed by 192.168.0.5
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 24
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 16
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 22
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 21
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 15
25/01/20 16:12:40 Using zlib encoding for client 192.168.0.5
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding -314
25/01/20 16:12:40 Enabling full-color cursor updates for client 192.168.0.5
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding -223
25/01/20 16:12:40 Pixel format for client 192.168.0.5:
25/01/20 16:12:40   8 bpp, depth 6
25/01/20 16:12:40   true colour: max r 3 g 3 b 3, shift r 4 g 2 b 0
25/01/20 16:12:40 Using raw encoding for client 192.168.0.5
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 24
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 22
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 21
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 16
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 15
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding -314
25/01/20 16:12:40 Enabling full-color cursor updates for client 192.168.0.5
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding -223
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 24
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 16
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 22
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 21
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding 15
25/01/20 16:12:40 Using zlib encoding for client 192.168.0.5
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding -314
25/01/20 16:12:40 Enabling full-color cursor updates for client 192.168.0.5
25/01/20 16:12:40 rfbProcessClientNormalMessage: ignoring unknown encoding -223
25/01/20 16:12:40 Pixel format for client 192.168.0.5:

我做了一些研究,发现使用 gnome flashback 可能是个不错的选择

将我的配置更改为:

#!/bin/sh

export XKL_XMODMAP_DISABLE=1
export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
export XDG_MENU_PREFIX="gnome-flashback-"

gnome-session --session=gnome-flashback-metacity --disable-acceleration-check --debug &

日志看起来更好,但文件不存在或无效:

25/01/20 21:25:19 Xvnc version TightVNC-1.3.10
25/01/20 21:25:19 Copyright (C) 2000-2009 TightVNC Group
25/01/20 21:25:19 Copyright (C) 1999 AT&T Laboratories Cambridge
25/01/20 21:25:19 All Rights Reserved.
25/01/20 21:25:19 See http://www.tightvnc.com/ for information on TightVNC
25/01/20 21:25:19 Desktop name 'X' (Ubuntu-server:1)
25/01/20 21:25:19 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
25/01/20 21:25:19 Listening for VNC connections on TCP port 5901
Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring
Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring
gnome-session-binary[2658]: DEBUG(+): Enabling debugging
gnome-session-binary[2658]: DEBUG(+): hardware acceleration check is disabled
gnome-session-binary[2658]: DEBUG(+): Using systemd for session tracking
gnome-session-binary[2658]: DEBUG(+): GsmManager: setting client store 0x56286684db70
gnome-session-binary[2658]: DEBUG(+): GsmXsmpServer: SESSION_MANAGER=local/Ubuntu-server:@/tmp/.ICE-unix/2658,unix/Ubuntu-server:/tmp/.ICE-unix/2658

gnome-session-binary[2658]: DEBUG(+): emitting SessionIsActive
gnome-session-binary[2658]: DEBUG(+): fill: *** Getting session 'gnome-flashback-metacity'
gnome-session-binary[2658]: DEBUG(+): fill: *** Looking if /home/dev/.config/gnome-session/sessions/gnome-flashback-metacity.session is a valid session file
gnome-session-binary[2658]: DEBUG(+): Cannot use session '/home/dev/.config/gnome-session/sessions/gnome-flashback-metacity.session':

我对 Linux 和 Ubuntu 还很陌生,通过 Windows 笔记本电脑使用 Ubuntu 盒子进行无头操作

有人可以帮忙吗?

干杯

答案1

按着这些次序:

  1. 安装gnome-session-flashback

     sudo apt install gnome-session-flashback
    
  2. 将其添加到~/.vnc/xstartup

     #!/bin/sh
     autocutsel -fork
     xrdb $HOME/.Xresources
     xsetroot -solid grey
     export XKL_XMODMAP_DISABLE=1
     export XDG_CURRENT_DESKTOP="GNOME-Flashback:Unity"
     export XDG_MENU_PREFIX="gnome-flashback-"
     unset DBUS_SESSION_BUS_ADDRESS
     gnome-session --session=gnome-flashback-metacity --disable-acceleration-check --debug &
    

答案2

原来我必须直接登录到盒子,然后注销登录到 gnnome 会话闪回。注销然后重试 vnc 并正常工作

相关内容