VNC#

NVIDIA DriveOS™ LINUX filesystems support using VNC access to DRIVE platform using canonical open source x11vnc. The solution supports both cases where a physical display is connected to the DRIVE platform (such as non-headless) or without any physical display (i.e. headless). The steps to use VNC broadly has 3 phases. The first phase sets the VNC mode (between headless vs non-headless), the second starts the X11 server (depending on the filesystems), and finally starts the x11vnc server on the DRIVE platform.

Step One: Selecting VNC Mode Between Non-headless vs. Headless Mode#

What is the non-headless mode?

The non-headless mode runs X on the physical display connected to the DRIVE platform. It uses an accelerated nvidia driver stack and is the default mode.

The following shows xrandr output in non-headless mode:

Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
DP-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 477mm x 268mm
   1920x1080     60.00*+
   1680x1050     59.95
   1440x900      59.89
   1280x1024     75.02    60.02

Headless Mode

Headless mode is the mode where no physical display is connected to the target and VNC uses a virtual display over the network to connect/work with the target.

The following shows xrandr output in non-headless mode:

xrandr: Failed to get size of gamma for output default
Screen 0: minimum 320 x 240, current 1920 x 1080, maximum 1920 x 1080
default connected 1920x1080+0+0 0mm x 0mm
   1920x1080     60.00*
   1680x1050     70.00    60.00
   1400x1050     70.00    60.00
   1600x900      60.00
   1280x1024     75.00    60.00

Steps to set non-headless mode

The non-headless mode is the default mode in the filesystem and there are no actions required.

Steps to set headless mode

  1. Copy headless version of xorg.conf to /etc/X11/xorg.conf.

sudo cp /etc/X11/xorg.conf.headless /etc/X11/xorg.conf
  1. Restart the gdm3 service for the updated xorg.conf to take effect:

sudo systemctl restart gdm3
  1. Note that you can restore the xorg.conf by copying /etc/X11/xorg.conf.gpu to /etc/X11/xorg.conf.

    sudo cp /etc/X11/xorg.conf.headless /etc/X11/xorg.conf

Step Two: Running and Connecting to VNC Server on DriveOS Filesystem#

With Xserver running, follow the steps below to set up the x11vnc server and connect to it from the host VNC client.

Desktop FS

  1. The gdm3 service automatically starts on desktop FS loading.

  2. With x11vnc installed, please start x11vnc with cmdline args: (sudo is required because we are accessing another user’s Xauthority)

sudo DISPLAY=:0 x11vnc -auth /run/user/118/gdm/Xauthority -forever -noxdamage -repeat -shared -loop
  1. From the host side, the VNC client can connect to x11vnc (at port 5900) and see the greeter screen.

  2. Note that after providing username & password in greeter, you will reach a blank screen because the GUI desktop gets started in a different X server instance.

  3. To find the Xserver instance and Xauthority file, use the ps command as shown below and note the Xauthority file :

ps aux | grep Xorg | grep -v 118
1. Look for the argument of the -auth option of the running Xorg
2. ![](../../graphics/sys_components/sys_components_vnc.png)
3. In the previous example: the Xauthority file is the argument to `-auth /run/user/1000/gdm/Xauthority`. So the Xauthority file is `/run/user/1000/gdm/Xauthority`.
  1. Now connect x11vnc using Xauthority file from step-5 to see the desktop:

DISPLAY=:1 x11vnc -auth <Xauthority file> -forever -noxdamage -repeat -shared -loop
  • As per the example in step-5c, example cmdline is DISPLAY=:1 x11vnc -auth /run/user/1000/gdm/Xauthority -forever -noxdamage -repeat -shared -loop