首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当VNCing到Ubuntu时无法获得GUI

当VNCing到Ubuntu时无法获得GUI
EN

Ask Ubuntu用户
提问于 2020-02-04 22:40:21
回答 1查看 3.2K关注 0票数 1

当我试图通过VNC查看一台ubuntu机器时,我会得到一个带有3个复选框的灰色屏幕。我试过了一些我在网上读到的建议,但是一个没有帮助。一个仍然给我灰色屏幕与3个复选框,一个给我灰色屏幕没有三个复选框,一个给我一个网格!以下是关于如何修改vnc的xstartup文件的各种建议。下文将作进一步阐述。

我有一个Ubuntu18.03.3LTS的计算机运行USB。它提供了两个选项,‘尝试ubuntu’和‘安装ubuntu’我选择了‘尝试ubuntu’。

$lsb_release -a显示我在Ubuntu 18.04.03 LTS

我看到了这篇文章并使用这些命令安装vnc服务器。

代码语言:javascript
复制
$ sudo apt-get install --no-install-recommends ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal gnome-core

$ sudo apt-get install vnc4server

这显示了我的xstartup文件

代码语言:javascript
复制
buntu@ubuntu:~/.vnc$ cat xstartup
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

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

ubuntu@ubuntu:~/.vnc$

我想这是默认的..。我得到的错误和前面提到的一样

VNC灰色屏幕并启动12.04

vncserver灰色屏幕ubuntu16.04LTS

https://www.linuxquestions.org/questions/linux-newbie-8/vnc-viewer-showing-only-grey-screen-with-3-checkboxes-899386/

但解决方案对我不起作用,我会解释的。

我得到一个带有3个复选框的灰色屏幕。

请参见我启动了vnc服务器(我还包括一些用于列出进程的其他命令,因为每当我更改xstartup时,我都会查看服务器是否正在运行,并关闭它并再次启动它)。我检查了它是否在运行,在哪个端口,端口5901。而且它没有被防火墙阻塞,ubuntu默认使用..ufw,我从ufw status中看到ufw防火墙没有启用,所以没有问题。vnc服务器已经启动。

代码语言:javascript
复制
ubuntu@ubuntu:~/.vnc$ ps
  PID TTY          TIME CMD
 6065 pts/0    00:00:00 bash
15274 pts/0    00:00:00 ps
ubuntu@ubuntu:~/.vnc$ cat xstartup
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

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



ubuntu@ubuntu:~/.vnc$ vnc4server

New 'ubuntu:1 (ubuntu)' desktop is ubuntu:1

Starting applications specified in /home/ubuntu/.vnc/xstartup
Log file is /home/ubuntu/.vnc/ubuntu:1.log

ubuntu@ubuntu:~/.vnc$ ps
  PID TTY          TIME CMD
 6065 pts/0    00:00:00 bash
15287 pts/0    00:00:00 Xvnc4
15293 pts/0    00:00:00 vncconfig
15303 pts/0    00:00:00 ps
ubuntu@ubuntu:~/.vnc$ lsof | grep LISTEN
lsof: WARNING: can't stat() tracefs file system /sys/kernel/debug/tracing
      Output information may be incomplete.
Xvnc4     15287                 ubuntu    0u     IPv4             295628      0t0        TCP *:x11-1 (LISTEN)
Xvnc4     15287                 ubuntu    3u     IPv6             295630      0t0        TCP *:5901 (LISTEN)
ubuntu@ubuntu:~/.vnc$ ufw status
ERROR: You need to be root to run this script
ubuntu@ubuntu:~/.vnc$ sudo ufw status
Status: inactive
ubuntu@ubuntu:~/.vnc$

我还运行ip add命令来查看我的IP。

然后,我转到另一台运行windows的机器,输入IP:5901并输入正确的密码,密码被接受。

我得到了这个带有三个复选框的灰色屏幕:“接受观众的剪贴板”、“向观众发送剪贴板”、“向观众发送主要选择”。

我根据第一个链接vnc-灰色屏幕(172384)进行修改,但得到相同的灰色屏幕相同的三个复选框,这与

代码语言:javascript
复制
ubuntu@ubuntu:~/.vnc$ echo https://askubuntu.com/questions/172384/vnc-grey-screen-and-start-on-boot-12-04
https://askubuntu.com/questions/172384/vnc-grey-screen-and-start-on-boot-12-04
ubuntu@ubuntu:~/.vnc$ cat xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc

gnome-session --session=gnome-classic &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey
vncconfig -iconic &

#x-terminal-emulator -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &

ubuntu@ubuntu:~/.vnc$ ps
  PID TTY          TIME CMD
 6065 pts/0    00:00:00 bash
15287 pts/0    00:00:00 Xvnc4
15293 pts/0    00:00:00 vncconfig
15572 pts/0    00:00:00 ps
ubuntu@ubuntu:~/.vnc$ killall Xvnc4
ubuntu@ubuntu:~/.vnc$ ps
  PID TTY          TIME CMD
 6065 pts/0    00:00:00 bash
15575 pts/0    00:00:00 ps
ubuntu@ubuntu:~/.vnc$ vnc4server

New 'ubuntu:1 (ubuntu)' desktop is ubuntu:1

Starting applications specified in /home/ubuntu/.vnc/xstartup
Log file is /home/ubuntu/.vnc/ubuntu:1.log

ubuntu@ubuntu:~/.vnc$

然后,我尝试使用第二个ubuntu链接(vncserver-灰色屏幕- 800302)中的xstartup。

代码语言:javascript
复制
ubuntu@ubuntu:~/.vnc$ vi xstartup
ubuntu@ubuntu:~/.vnc$ echo https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-lts
ubuntu@ubuntu:~/.vnc$ cat xstartup
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

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

gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
ubuntu@ubuntu:~/.vnc$ ps
  PID TTY          TIME CMD
 6065 pts/0    00:00:00 bash
15710 pts/0    00:00:00 ps
ubuntu@ubuntu:~/.vnc$ vnc4server

New 'ubuntu:1 (ubuntu)' desktop is ubuntu:1

Starting applications specified in /home/ubuntu/.vnc/xstartup
Log file is /home/ubuntu/.vnc/ubuntu:1.log

ubuntu@ubuntu:~/.vnc$

我得到了一个灰色屏幕,但这次没有复选框。

然后,我尝试第三种解决方案。

如果我看上去像https://www.linuxquestions.org/questions/linux-newbie-8/vnc-viewer-showing-only-grey-screen-with-3-checkboxes-899386/

一项建议是确保xstartup文件的权限为755,我的建议是,另一项建议是取消注释以下两行:

代码语言:javascript
复制
unset SESSION MANAGER
exec /etc/X11/xinit/xinitrc

这样做(当然还会杀死和启动vnc服务器) $killall Xvnc4$vnc4server

当我试图连接时,我得到了这个屏幕,它就像一个网格

添加的

我听到一个建议,要尝试查看日志文件/home/ubuntu/.vnc/ubuntu:1.log

代码语言:javascript
复制
ubuntu@ubuntu:~/.vnc$ cat ubuntu:1.log

Xvnc Free Edition 4.1.1 - built Feb 25 2015 23:02:21
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 40300000, The XFree86 Project, Inc


Tue Feb  4 21:56:29 2020
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on port 5901
 vncext:      created VNC server for screen 0
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!

Tue Feb  4 21:56:39 2020
 Connections: accepted: 0.0.0.0::62323
 SConnection: Client needs protocol version 3.8
 SConnection: Client requests security type VncAuth(2)

Tue Feb  4 21:56:43 2020
 VNCSConnST:  Server default pixel format depth 16 (16bpp) little-endian rgb565
 VNCSConnST:  Client pixel format depth 6 (8bpp) rgb222

Tue Feb  4 21:56:44 2020
 VNCSConnST:  Client pixel format depth 16 (16bpp) little-endian rgb565
ubuntu@ubuntu:~/.vnc$

我还发现了一个没有复选框的灰色屏幕的建议https://stackoverflow.com/questions/51415427/whats-wrong-with-my-vncserver-setting

我听到了一个尝试这个xstartup文件的建议,特别是第14-17行可能对https://www.linode.com/docs/applications/remote-desktop/install-vnc-on-ubuntu-18-04/有帮助。

所以我在那里使用了整个xstartup文件,因为我更改了我的xstartup文件很多。

我有一个没有复选框的灰色屏幕,日志上写着

代码语言:javascript
复制
ubuntu@ubuntu:~/.vnc$ cat ubuntu\:1.log 

Xvnc Free Edition 4.1.1 - built Feb 25 2015 23:02:21
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 40300000, The XFree86 Project, Inc


Tue Feb  4 23:10:06 2020
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on port 5901
 vncext:      created VNC server for screen 0
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!
/home/ubuntu/.vnc/xstartup: 15: /home/ubuntu/.vnc/xstartup: gnome-settings-daemon: not found

** (gnome-panel:16733): WARNING **: 23:10:09.203: Failed to request name: the name already has an owner
xkbcommon: ERROR: xkb_x11_keymap_new_from_device: illegal device ID: -1
xkbcommon: ERROR: xkb_x11_state_new_from_device: illegal device ID: -1metacity-Message: 23:10:09.279: could not find XKB extension.

(metacity:16735): metacity-WARNING **: 23:10:09.285: Failed to create MetaCompositorXRender: Missing composite extension required for compositing
# Failed to parse arguments: Unknown option --login

Tue Feb  4 23:10:17 2020
 Connections: accepted: 0.0.0.0::63052
 SConnection: Client needs protocol version 3.8
 SConnection: Client requests security type VncAuth(2)

Tue Feb  4 23:10:20 2020
 VNCSConnST:  Server default pixel format depth 16 (16bpp) little-endian rgb565
 VNCSConnST:  Client pixel format depth 6 (8bpp) rgb222
 VNCSConnST:  Client pixel format depth 16 (16bpp) little-endian rgb565

Tue Feb  4 23:10:25 2020
 Connections: closed: 0.0.0.0::63052 (Clean disconnection)
 SMsgWriter:  framebuffer updates 3
 SMsgWriter:    raw rects 1, bytes 16396
 SMsgWriter:    ZRLE rects 3, bytes 304
 SMsgWriter:    raw bytes equivalent 2375888, compression ratio 142.268743
ubuntu@ubuntu:~/.vnc$
EN

回答 1

Ask Ubuntu用户

发布于 2021-02-08 09:19:15

我遵循https://itectec.com/ubuntu/ubuntu-ubuntu-18-04-vnc-grey-screen/指令,它解决了我在vnc灰色屏幕上的问题。

代码语言:javascript
复制
sudo apt install gnome-session-flashback

然后更改~/.vnc/xstartup

代码语言:javascript
复制
 #!/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 &
票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1208112

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档