2

I am running tightvnc on Ubuntu 22.04.2 LTS (GNU/Linux 5.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

However, I am getting a grey screen: enter image description here

I have tried this solution and this solution.

Here is my ~/.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 &

Here is tightvnc's log

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]

======================== Update #1: Followed Saxtheowl's suggestion: Installed Tigervnc instead:

$ sudo apt install tigervnc-standalone-server tigervnc-xorg-extension tigervnc-viewer

Made xstartup executable:

$ chmod +x ~/.vnc/xstartup
$ ls -la | grep xstartup
-rwxrwxr-x  1 hc hc  371 Mar 29 12:02 xstartup

Forced a reinstall:

$ sudo apt --reinstall install gnome-session-flashback metacity

Updated 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 &

But failed to start with display 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

Started with display 1 but died immediately:

$ 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!
HCSF
  • 121
  • 1
  • 4

2 Answers2

0

Your problem come from incorrect permission or an outdated version of TightVNC.

Here is how to fix this:

first you can try to set the correct permission chmod +x ~/.vnc/xstartup

If that dont work get a better VNC like TigerVNC sudo apt install tigervnc-standalone-server tigervnc-xorg-extension tigervnc-viewer then create a new xstartup file nano ~/.vnc/xstartup put this inside:

#!/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 &

then chmod +x ~/.vnc/xstartup then kill any remaining VNC session vncserver -kill :0 then start a new VNC session vncserver :0 -geometry 1980x1080 -localhost no then you can try connecting to your VNC server with your VNC client

if that dont work reinstall the appropriate gnome package sudo apt install gnome-session-flashback metacity then restart the VNC it should work.

Saxtheowl
  • 1,609
  • 2
  • 9
  • 20
  • Thanks for your suggestion but it still doesn't work. I updated my post with more info. – HCSF Mar 29 '23 at 12:16
0

If RDP is an option to you, here is a tutorial[1] that covers how to launch Ubuntu Desktop on EC2. The part missing in your screenshot is related to the Ubuntu-session, which here is shown how to solve it for RDS.

[1] https://discourse.ubuntu.com/t/deploy-ubuntu-desktop-jammy-jellyfish-on-aws-ec2/30381

Carlos B
  • 111
  • 3