VNC

From SciNet Users Documentation
Revision as of 18:58, 6 July 2021 by Pinto (talk | contribs)
Jump to navigation Jump to search

Configuring your account to run VNC on niagara

The use case here is you want to start vncserver on a compute node, and have it display remotely on your home computer.

On niagara this presents 2 sets of issues:

  • the compute nodes are not accessible from the internet, hence, you can not connect directly from your home computer to them. You will need to establish and ssh tunnel via a login node.
  • compute nodes have $HOME mounted as read-only, and therefore this presents some challenges to start VNC server, since it wants to change several dot files on your account.

The recipe below complements the general set os instructions already on the Compute Canada wiki for Windows clients using Cygwin:

https://docs.computecanada.ca/wiki/VNC/en


A) Create symlinks on your home for all pertinent dot files:


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

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

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

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

The soft link isn't sufficient for xauth so use the following on the
compute node before starting vncserver.

$ export XAUTHORITY=$SCRATCH/.Xauthority

After starting vncserver and connecting to the desktop remotely you
may see an .ICEauthority error, just click close and wait a few
seconds and the desktop should come up normally.

Also it's highly recommended to modify the default .vnc/xstartup script
and add "xterm &" at the end. That way if there is an issue with the
window manager you will at least see a terminal.

B) Create the tunnel via a login node (similar to the instructions on CC docs):


1) Using Cygwin, log in as usual :
   [laptop:~]$ ssh <user>@niagara.scinet.utoronto.ca

2) Request resources with salloc:
   [nia-login01:~]$ salloc --time=3:00:00 --nodes=1 --cpus-per-task=40

3) Send these commands:
   [nia1969:~]$ export XDG_RUNTIME_DIR=${SLURM_TMPDIR}
   [nia1969:~]$ export XAUTHORITY=$SCRATCH/.Xauthority

4 Launch the vnc server on the compute node assigned to your job:
   [nia1969:~]$ module load CCEnv StdEnv
   [nia1969:~]$ vncserver

5) Find the port used by the VNC server :
   [nia1969:~]$ grep port $HOME/.vnc/"nia1969.scinet.local:1.log"
   (adapt to situation)

6) From your laptop, launch a second instance of Cygwin and establish the ssh tunnel to the node assigned to you:
   [laptop:~]$ ssh <user>@niagara.scinet.utoronto.ca -L 5902:nia1969:5901 

   where 5901 is the port from step 5, and 5902 is the local port on the machine. 
   also change nia1969 to whatever compute node you get at the time (nia1969 is just an example)

7) On tigerVNC, log in to "localhost:5902"
   [laptop:~]$ vncviewer localhost:5902