VNC

From SciNet Users Documentation
Jump to navigation Jump to search

Running VNC on Trillium

VNC starts a graphical desktop on a Trillium compute node and displays it on your local computer. For installing a VNC client, general VNC setup, and troubleshooting, see the Alliance VNC page. This page covers the Trillium-specific parts: the read-only $HOME, the salloc command, and the SSH tunnel.

Trillium specifics

  • Compute nodes are not reachable from the internet. Connect through trillium.scinet.utoronto.ca and forward a local port to the compute node.
  • $HOME is read-only on compute nodes; $SCRATCH is writable. See the Trillium Quickstart storage section.
  • StdEnv/2023 provides TurboVNC, including vncserver.
  • CPU jobs are whole-node. Request whole nodes with --nodes; do not use --cpus-per-task to ask for a fraction of a node.

One-time setup

Start vncserver once on a login node so that it creates the base dot files, then kill it:

[username@tri-login01:~]$ module load StdEnv/2023
[username@tri-login01:~]$ vncserver
...
[username@tri-login01:~]$ vncserver -kill :1

Because $HOME is read-only on compute nodes, move the VNC-related dot files to $SCRATCH and replace them with symlinks:

mkdir -p $SCRATCH/vnc

mv $HOME/.vnc $SCRATCH/vnc/.vnc
ln -s $SCRATCH/vnc/.vnc $HOME/.vnc

mv $HOME/.Xauthority $SCRATCH/vnc/.Xauthority
ln -s $SCRATCH/vnc/.Xauthority $HOME/.Xauthority

mv $HOME/.cache $SCRATCH/vnc/.cache
ln -s $SCRATCH/vnc/.cache $HOME/.cache

mv $HOME/.config $SCRATCH/vnc/.config
ln -s $SCRATCH/vnc/.config $HOME/.config

If .cache or .config does not exist yet, skip that pair. The .Xauthority symlink alone is not always enough; set XAUTHORITY explicitly on the compute node as shown below.

Start a session

Request one CPU node:

[username@tri-login01:~]$ salloc --export=NONE --nodes=1 --time=3:00:00

On the compute node:

[username@tri0123:~]$ export XDG_RUNTIME_DIR=${SLURM_TMPDIR}
[username@tri0123:~]$ export XAUTHORITY=$SCRATCH/vnc/.Xauthority
[username@tri0123:~]$ module load StdEnv/2023
[username@tri0123:~]$ vncserver

The first time, vncserver asks you to set a password. Do not leave it blank. Note the compute node name and find the port:

[username@tri0123:~]$ hostname
tri0123
[username@tri0123:~]$ grep -iE "\sport|kill" $HOME/.vnc/*.log
Listening for VNC connections on TCP port 5901

Connect from your computer

Create an SSH tunnel from your computer to the compute node:

[laptop:~]$ ssh <user>@trillium.scinet.utoronto.ca -L 5902:tri0123:5901

Replace tri0123 with the node from hostname, 5901 with the port from the log, and 5902 with a free local port. Then connect your VNC viewer to localhost:5902:

[laptop:~]$ vncviewer localhost:5902

Finishing

Kill the server when you are done:

[username@tri0123:~]$ vncserver -kill :1

Use the display number shown by vncserver -list if it is not :1. Exit the allocation with exit. If a session is stuck, pkill Xvnc -u $USER kills all of your VNC servers on the current node.

If the desktop reports an .ICEauthority error, close the message and wait a few seconds. Adding xterm & to the end of ~/.vnc/xstartup gives you a terminal if the window manager fails to start.