VNC
DRIVE OS 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 (i.e. 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
- Backup current xorg.conf to xorg.conf.nvidia
- sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.nvidia
- Note: To restore to non-headless copy /etc/X11/xorg.conf.nvidia over
to /etc/X11/xorg.conf.
- sudo cp /etc/X11/xorg.conf.nvidia /etc/X11/xorg.conf
- Copy below xorg.conf content below to /etc/X11/xorg.conf.dummy. Copy
/etc/X11/xorg.conf.dummy to /etc/X11/xorg.conf.
- sudo cp /etc/X11/xorg.conf.dummy /etc/X11/xorg.conf
Section "Monitor"
Identifier "Monitor0"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
# https://arachnoid.com/modelines/
# 1920x1080 @ 60.00 Hz (GTF) hsync: 67.08 kHz; pclk: 172.80 MHz
Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
EndSection
Section "Device"
Identifier "Card0"
Driver "dummy"
VideoRam 256000
EndSection
Section "Screen"
DefaultDepth 24
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Depth 24
Modes "1920x1080_60.00"
EndSubSection
EndSection
Step Two: Starting X Server on the Filesystem
Desktop FS
For the oobe-desktop filesystem, the X server is automatically launched by default by the gdm3 display manager. No actions are required.
OOBE FS and CORE FS
For oobe/core filesystems, the X server is not launched on boot and requires manually starting it:
sudo X -ac -reset &
Step Three: Running VNC server on DRIVE OS Filesystem and connecting to it
With Xserver running, follow the steps below to set up the x11vnc server and connect to it from the host VNC client.
Desktop FS
- The gdm3 service automatically starts on desktop FS loading.
- 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/110/gdm/Xauthority -forever -noxdamage -repeat -shared -loop
- From the host side, the VNC client can connect to x11vnc (at port 5900) and see the greeter screen.
- 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.
- To find the Xserver instance and Xauthority file, please use the ps command
as shown below and note the Xauthority file <Xauth>:
- ps aux | grep Xorg | grep -v 110
- Look for the argument of the -auth option of the running Xorg
- In the above example: the Xauthority file is the argument to -auth /run/user/1000/gdm/Xauthority. So, the Xauthority file is /run/user/1000/gdm/Xauthority.
- 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 example in step-5c, example cmdline is DISPLAY=:1 x11vnc -auth /run/user/1000/gdm/Xauthority -forever -noxdamage -repeat -shared -loop
OOBE FS and CORE FS
-
With x11vnc installed, please start x11vnc with cmdline args:
- x11vnc -forever -noxdamage -repeat -shared -loop &
- Connect to x11vnc from the host via vncviewer, to see a black screen because no applications are running on the screen.
-
Open a new terminal (for example ssh connection) and execute the following commands to run sample graphics app bubble:
- cd /opt/nvidia/drive-linux/samples/opengles2/bubble
- DISPLAY=:0 ./x11/bubble