Running Blender remotely on Ubuntu with Tiger VNC



When I render animations with Blender on Windows, after a while background jobs kick in and rendering performance falls off a cliff. This post outlines how to get Blender running remotely on Ubuntu Desktop with Tiger VNC

Blender running on Ubuntu @ 3440x1440 connected using VNC image

Install Ubuntu

Probably the most straight-forward part of the post, grab the Ubuntu Desktop Iso and install on a USB stick with balenaEtcher. I installed Ubuntu Desktop on a second hard drive so I can dual boot with Windows.

Install Blender

This piece was also straight-forward, download the latest Blender version from blender.org. Extract the tar archive and double click!

As an aside, I’ve found Blender rending and UI performance to be much improved on Ubuntu versus Windows.

Sync files with owncloudcmd

I use owncloud to store all my stuff in a central place, to sync with Ubuntu, use owncloudcmd

sudo apt update
sudo apt install owncloud-client-cmd
owncloudcmd -u beyondwatts -p beyondwatts_password --exclude /dev/null ~/BlenderMapping https://owncloud.beyondwatts.com/remote.php/webdav/DirectoryToSync

Try RDC

Ubuntu Desktop supports the RDC Remote Desktop Protocol directly which means you can remotely access the Ubuntu desktop environment from Windows using the Remote Desktop Connection app. I followed the tutorial @ https://linuxhint.com/enable-remote-desktop-ubuntu-access-windows/ to get this up and running and successfully connected to remote Ubuntu desktop. Note - the Ubuntu machine isn’t fully headless, I have a screen and keyboard that I used to set up the RDP login.

Once connected through RDP, I noticed one challenge. The UI lag was awful and made this route unusable for Blender…

Install Tiger VNC

Many moons ago, VNC used to be the goto app for remote desktop. It seems it might still be for my use case. Initially I tried TightVNC but while I got a desktop, it wasn’t fully featured.

Eventually, I got a set-up working with TigerVNC.

On Ubuntu, install VNC:

sudo apt install tigervnc-standalone-server

On Windows, install the VNC Viewer client from RealVnc

We need to make some changes to the VNC server config on the Ubuntu box so kill the server:

vncserver -kill :1

Create a file at ~/.vnc/xstartup with the following contents:

##!/bin/sh
#
## Start up the standard system desktop
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

/usr/bin/gnome-session

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

vncconfig -iconic &
export DESKTOP_SESSION=/usr/share/xsessions/ubuntu.desktop
env GNOME_SHELL_SESSION_MODE=ubuntu dbus-launch --exit-with-session /usr/bin/gnome-session --systemd --session=ubuntu &

Restart the VNC server

vncserver -localhost no :1

Log in from windows connecting to port 5901.

Custom resolutions

The default max screen resolution with VNC seems to be 1980x1200 but thanks to this post, we can define some custom resolutions matching larger monitor sizes:

In a TigerVNC session, use cvt to set up a new resolution of 3440x1440 ( apparently, you can always specify 60 Hz with VNC ):

$ cvt 3440 1440 60
# 3440x1440 59.94 Hz (CVT) hsync: 89.48 kHz; pclk: 419.50 MHz
Modeline "3440x1440_60.00"  419.50  3440 3696 4064 4688  1440 1443 1453 1493 -hsync +vsync

Create a new mode with that modeline:

$ xrandr --newmode "3440x1440" 419.50  3440 3696 4064 4688  1440 1443 1453 1493 -hsync +vsync

Add the new mode:

$ xrandr --addmode VNC-0 3440x1440

Verify that the new mode was added:

$ xrandr
Screen 0: minimum 32 x 32, current 3440 x 1440, maximum 32768 x 32768
VNC-0 connected primary 3440x1440+0+0 0mm x 0mm
   3440x1440     60.00*+
   1920x1200     60.00  
   1920x1080     60.00  
   1600x1200     60.00  
   1680x1050     60.00  
   1400x1050     60.00  
   1360x768      60.00  
   1280x1024     60.00  
   1280x960      60.00  
   1280x800      60.00  
   1280x720      60.00  
   1024x768      60.00  
   800x600       60.00  
   640x480       60.00

Select the new mode:

$ xrandr -s 3440x1440

May need to change the desktop resolution in Ubuntu settings Also - will need to disable screen locking otherwise you wont be able to get back in without rebooting! Settings->Privacy->Screen

Running Firefox on VNC

From here, there looks to be an issue with snaps and registering XAuthority when forwarding X11 on my VNC. The issue was fixed by simply running the following commands in a Terminal window:

XAUTHORITY=$HOME/.Xauthority
export XAUTHORITY

Then, running Firefox via the Terminal would open it properly. It would not open via its icon in Applications/the Dash, however; using a desktop

Update grub

When I installed Ubuntu I did briefly lose my ability to boot into Windows. Getting it back required this command:

echo GRUB_DISABLE_OS_PROBER=false|sudo tee -a /etc/default/grub && sudo update-grub

Thanks https://adamtheautomator.com/ubuntu-grub/ !

Booting back to windows

Finally, I can remotely choose which OS I boot into… The default is set to be Ubuntu, if I want to boot into windows, I can use:

sudo grub-reboot 2 && sudo reboot