我正在Ubuntu22.04.2LTS(GNU/Linux5.15.0-1031-AWS x86_64)上运行吃紧的系统:
$ vncserver :0 -geometry 1980x1080
New 'X' desktop is ip-172-31-14-62:0
Starting applications specified in /home/hc/.vnc/xstartup
Log file is /home/hc/.vnc/ip-172-31-14-62:0.log
$ ps aux | grep vnc
hc 408153 0.0 0.0 14836 12448 pts/0 S 13:37 0:00 Xtightvnc :0 -desktop X -auth /home/hc/.Xauthority -geometry 1980x1080 -depth 24 -rfbwait 120000 -rfbauth /home/hc/.vnc/passwd -rfbport 5900 -fp /usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/share/fonts/X11/100dpi/ -co /etc/X11/rgb
hc 408163 0.0 0.0 7004 2196 pts/0 S+ 13:37 0:00 grep --color=auto vnc然而,我得到了一个灰色的屏幕:

这是我的~/..vnc/xstartup:
$ cat ~/.vnc/xstartup
#!/bin/sh
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 &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &这里是tightvnc的日志
28/03/23 13:44:01 Xvnc version TightVNC-1.3.10
28/03/23 13:44:01 Copyright (C) 2000-2009 TightVNC Group
28/03/23 13:44:01 Copyright (C) 1999 AT&T Laboratories Cambridge
28/03/23 13:44:01 All Rights Reserved.
28/03/23 13:44:01 See http://www.tightvnc.com/ for information on TightVNC
28/03/23 13:44:01 Desktop name 'X' (my_host:0)
28/03/23 13:44:01 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
28/03/23 13:44:01 Listening for VNC connections on TCP port 5900
Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring
Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring
sh: 1: /home/hc/.vnc/xstartup: Permission denied
28/03/23 13:44:10 Got connection from client [client's ip]
28/03/23 13:44:10 Using protocol version 3.8
28/03/23 13:44:10 Got connection from client [some hacker's IP]
28/03/23 13:44:10 (other clients [client's ip])
28/03/23 13:44:10 Using protocol version 3.3
28/03/23 13:44:10 rfbVncAuthProcessResponse: authentication failed from [some hacker's IP]
28/03/23 13:44:10 Client [some hacker's IP] gone
28/03/23 13:44:10 Statistics:
28/03/23 13:44:10 framebuffer updates 0, rectangles 0, bytes 0
28/03/23 13:44:15 Full-control authentication passed by [client's ip]
28/03/23 13:44:15 Pixel format for client [client's ip]:
28/03/23 13:44:15 32 bpp, depth 24, little endian
28/03/23 13:44:15 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0
28/03/23 13:44:15 no translation needed
28/03/23 13:44:15 Enabling X-style cursor updates for client [client's ip]
28/03/23 13:44:15 rfbProcessClientNormalMessage: ignoring unknown encoding -314
28/03/23 13:44:15 rfbProcessClientNormalMessage: ignoring unknown encoding -223
28/03/23 13:44:15 rfbProcessClientNormalMessage: ignoring unknown encoding -308
28/03/23 13:44:15 rfbProcessClientNormalMessage: ignoring unknown encoding -307
28/03/23 13:44:15 Enabling LastRect protocol extension for client [client's ip]
28/03/23 13:44:15 rfbProcessClientNormalMessage: ignoring unknown encoding -313
28/03/23 13:44:15 rfbProcessClientNormalMessage: ignoring unknown encoding -312
28/03/23 13:44:15 Using tight encoding for client [client's ip]
28/03/23 13:44:15 rfbProcessClientNormalMessage: ignoring unknown encoding 16
28/03/23 13:44:15 Using image quality level 8 for client [client's ip]========================更新#1:按照Saxtheowl的建议安装Tigervnc:
$ sudo apt install tigervnc-standalone-server tigervnc-xorg-extension tigervnc-viewer使xstartup可执行:
$ chmod +x ~/.vnc/xstartup
$ ls -la | grep xstartup
-rwxrwxr-x 1 hc hc 371 Mar 29 12:02 xstartup被迫重新安装:
$ sudo apt --reinstall install gnome-session-flashback metacity更新的xstartup:
$ cat xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
export XKL_XMODMAP_DISABLE=1
export XDG_CURRENT_DESKTOP="GNOME-Flashback:Unity"
export XDG_MENU_PREFIX="gnome-flashback-"
gnome-session --session=gnome-flashback-metacity --disable-acceleration-check &但未能从显示0开始:
$ vncserver :0
A X11 server is already running for display :0 on machine ip-172-31-14-62.ap-northeast-2.compute.internal.
$ ps aux | grep vnc
hc 3233 0.0 0.0 7004 2324 pts/0 S+ 12:13 0:00 grep --color=auto vnc从显示1开始,但立即死亡:
$ vncserver :1 -geometry 1980x1080 -localhost no
New Xtigervnc server 'my_host.ap-northeast-2.compute.internal:1 (hc)' on port 5901 for display :1.
Use xtigervncviewer -SecurityTypes VncAuth,TLSVnc -passwd /home/hc/.vnc/passwd my_host.ap-northeast-2.compute.internal:1 to connect to the VNC server.
=================== tail /home/hc/.vnc/my_host.ap-northeast-2.compute.internal:5901.log ===================
===================================================================================================================
Session startup via '/home/hc/.vnc/xstartup' cleanly exited too early (< 3 seconds)!
Maybe try something simple first, e.g.,
tigervncserver -xstartup /usr/bin/xterm
The X session cleanly exited!
Killing Xtigervnc process ID 2940... success!发布于 2023-03-29 04:27:57
您的问题来自不正确的权限或过时的TightVNC版本。
下面是如何解决这个问题的方法:
首先,您可以尝试设置正确的权限chmod +x ~/.vnc/xstartup
如果这不起作用,请获得更好的VNC,如TigerVNC sudo apt install tigervnc-standalone-server tigervnc-xorg-extension tigervnc-viewer,然后创建一个新的xstartup文件nano ~/.vnc/xstartup将其放入其中:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
export XKL_XMODMAP_DISABLE=1
export XDG_CURRENT_DESKTOP="GNOME-Flashback:Unity"
export XDG_MENU_PREFIX="gnome-flashback-"
gnome-session --session=gnome-flashback-metacity --disable-acceleration-check &然后chmod +x ~/.vnc/xstartup杀死所有剩余的VNC会话vncserver -kill :0,然后启动一个新的VNC会话vncserver :0 -geometry 1980x1080 -localhost no,然后您可以尝试连接到VNC服务器和VNC客户端。
如果这样做不起作用,请重新安装适当的gnome包sudo apt install gnome-session-flashback metacity,然后重新启动VNC,它应该可以工作。
发布于 2023-04-04 19:39:44
如果RDP是您的选择,这里有一个教程,介绍如何在EC2上启动Ubuntu。屏幕截图中缺少的部分与Ubuntu会话有关,这里向您展示了如何为RDS解决它。
https://askubuntu.com/questions/1461273
复制相似问题