I have a Ubuntu 21.10 headless and I need to connect to it using remote desktop. When I attempt to start using vncservercommand I get the below too early exit code
hd2900@hd2900:~/.vnc$ vncserver New Xtigervnc server 'hd2900:1 (hd2900)' on port 5901 for display :1. Use xtigervncviewer -SecurityTypes VncAuth -passwd /home/hd2900/.vnc/passwd :1 to connect to the VNC server. =================== tail /home/hd2900/.vnc/hd2900:5901.log =================== ============================================================================== Session startup via '/home/hd2900/.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 10156... success! hd2900@hd2900:~/.vnc$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 21.10 Release: 21.10 Codename: impish My xstartup file is configured as
cat xstartup #!/bin/sh # Start Gnome 3 Desktop [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources vncconfig -iconic & dbus-launch --exit-with-session gnome-session & The VNC was set up by
apt install ubuntu-gnome-desktop apt install tigervnc-standalone-server Then I set up the password using vncpasswd command followed by vncserver to command to launch the server.
1 Answer
tigervncserver -xstartup /usr/bin/gnome-session will work. Indeed all you need to do is to remove & from the last line:
dbus-launch --exit-with-session gnome-session Looks like newer versions of tigervncserver expects the ~/.vnc/xstartup (or ~/.vnc/Xtigervnc-session) script to stay in foreground. (I am on Ubuntu 21.10 and the ending & is the problem. On 20.04LTS the ending & is not an issue.)