I have tigervnc on ubuntu 20.04 (Yes I tried 24.04, it does not run vnc). I can start the vnc on the command line manually, but can't get it to run automatically on startup.
The xstartup file is:
#!/bin/sh
echo "Starting xsetup" > ~/xlog
# 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 &
To start vnc manually from the command line, I have a script:
/usr/bin/vncserver -kill :1
/usr/bin/vncserver :1 -depth 24 -geometry 1920x1080 -localhost no
To start vnc on power on, I use the script /etc/init.d/vncserver:
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: networking
# Default-Start: 3 4 5
# Default-Stop: 0 6
### END INIT INFO
PATH="$PATH:/usr/X11R6/bin/"
# The Username:Group that will run VNC
export USER="test"
#${RUNAS}
# The display that VNC will use
DISPLAY="1"
# Color depth (between 8 and 32)
DEPTH="24"
# The Desktop geometry to use.
GEOMETRY="1920x1080"
#GEOMETRY="800x600"
#GEOMETRY="1024x768"
#GEOMETRY="1280x1024"
# The name that the VNC Desktop will have.
NAME="test-vnc-server"
OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
. /lib/lsb/init-functions
case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;
stop)
log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;
restart)
$0 stop
$0 start
;;
esac
exit 0
These are all things I got from instructions on how to set up a vnc server.
On manual start, it is fine, has the GDM environment. On power up restart, it comes up black with no cursor.
What am I doing wrong?