How to Rendering Blender EEVEE on a headless system

The simple answer is that you can’t. But why not give it a head. This guide aims to add a remote desktop to the vastai instance that does not have a GUI.

We start from where the How to render blender with vast left off. We will install Chrome Remote Desktop and get going.

bash -c 'apt -y update;apt -y upgrade;apt install -y --no-install-recommends;apt install -y gdebi;apt install -y gnupg2;apt install -y fonts-noto-cjk;apt install -y pulseaudio;apt install -y;apt install -y x11vnc;apt install -y fluxbox;apt install -y eterm;apt install -y wget;wget;dpkg --install chrome-remote-desktop_current_amd64.deb;wget;apt-key add;wget;dpkg --install google-chrome-stable_current_amd64.deb;apt install --assume-yes --fix-broken;apt clean;rm -rf /var/cache/*;/var/log/apt/* /var/lib/apt/lists/*;useradd -m -G chrome-remote-desktop,pulse-access chrome;usermod -s /bin/bash chrome;ln -s /crdonly /usr/local/sbin/crdonly;ln -s /update /usr/local/sbin/update;mkdir -p /home/chrome/.config/chrome-remote-desktop;mkdir -p /home/chrome/.fluxbox'
echo ' \n\
		session.screen0.toolbar.visible:        false\n\
		session.screen0.fullMaximization:       true\n\
		session.screen0.maxDisableResize:       true\n\
		session.screen0.maxDisableMove: true\n\
		session.screen0.defaultDeco:    NONE\n\
	' >> /home/chrome/.fluxbox/init
chown -R chrome:chrome /home/chrome/.config /home/chrome/.fluxbox

Next we install the Xfce desktop environment.

apt update
apt upgrade
apt install --assume-yes xfce4 desktop-base
bash -c 'echo "exec /etc/X11/Xsession /usr/bin/xfce4-session" > /etc/chrome-remote-desktop-session'
apt install --assume-yes xscreensaver

Just to be sure we want to stop lightdm.serves from running. There is no display connected to your instance, so the display manager service won’t start

$systemctl disable lightdm.service

Configuring and starting the Chrome Remote Desktop service

To start the remote desktop server, you need to have an authorization key for the Google account that you want to use to connect to it.

  1. On your local computer, using the Chrome browser, go to the Chrome Remote Desktop command line setup page:
  2. If you’re not already signed in, sign in with a Google Account. This is the account that will be used for authorizing remote access.
  3. On the Set up another computer page, click Begin.
  4. On the Download and install Chrome Remote Desktop page, click Next.
  5. Click Authorize. You need to allow Chrome Remote Desktop to access your account. If you approve, the page displays a command line for Debian Linux that looks like the following:
runuser -l chrome -c 'DISPLAY= /opt/google/chrome-remote-desktop/start-host --code="4/yourcode" --redirect-url="" --name=VastInstance'

Enter the pin as requested You should see an output “Host ready to receive connections.”

Connecting to the Vastai instance

You can connect to the instance using the Chrome Remote Desktop web application.

  1. On your local computer, go to the Chrome Remote Desktop web site.
  2. Click Remote Access
  3. If you’re not already signed in to Google, sign in with the same Google Account that you used to set up the Chrome Remote Desktop service. You see your new instance in the Remote Devices list.

You should be able to connect to the desktop

To run blender we should move it to where you can access it and give permission to the user chrome. In the SSH terminal

$mv blender-2.82a-linux64 /home/chrome/
$chmod -R a+rwx /home/chrome/

Open a xvfb terminal emulator on the chrome remote desktop

We will be using Blender 2.82 Splash Screen ensure the files blender2.blend is in the media folder. You should download it.

./blender -b media/Blender2.blend  -P -o output/ -a

The output on the chrome desktop should look like this