Accessing The pcDuino Desktop Without An HDMI Monitor (Part 2)
In my last post I began describing how to access the pcDuino desktop without the need for an HDMI monitor. The first step was to install an SSH server via the debug serial port, which gives you access to the pcDuino command line. For access to the desktop display you will also have to:
- Configure a Virtual Network Computing (VNC) server
- Install and connect via a VNC client
Configuring The VNC Server
As it turns out, the pcDuino comes with the x11vnc server already installed and all that’s necessary is to configure SSH on the pcDuino and local machine to support it. (Note: while working on putting together a bootable SD card I found out this is not necessarily the case. If you find the x11vnc server is not installed, you can do so by executing the command
sudo apt-get install x11vnc
from the pcDuino command line.)
On the local machine and change to the /etc/ssh directory as root:
Open the file ssh_config file in your editor of choice and find the ForwardX11 option. Uncomment it if necessary, change its value to YES, and save the file.
Now log into the pcDuino via the SSH link and gain root access in the same manner:
Open the file sshd_config file in your editor of choice, find the X11Forwarding option, change its value to YES, and save the file.
Install and Connect Via a VNC Client
The final step is to install a VNC client on your local computer. There are a number of them to choose from. Of these, I chose xtightvncviewer for no other reason than it was there, installing it as:
sudo apt-get install xtightvncviewer
Putting It All Together
At this point if you SSH into the pcDuino and try to start the VNC server, you’ll get an error indicating you cannot connect to the display (XOpenDisplay failed) along with hints on how to fix it. The cause of this error is that the account used for SSH does not have sufficient permissions to connect to the X display.
To fix this, execute the command ps -fe | grep /usr/bin/X | grep -v grep from the pcDuino command line. The returned process will have have an -auth flag. Take note of the associated file. On my machine, it was /var/run/lightdm/root/:0.
Exit from the SSH session and reconnect to the pcDuino using the command
ssh -L 5900:localhost:5900 <user>@<pcDuino_ip_address> ‘sudo x11vnc -auth <path_to_authority_file>’ -display :0
where <path_to_authority_file> is the file associated with the -auth flag noted above. This will log you into the pcDuino via SSH and start an instance of the X server. You can then start the VNC viewer from the local machine command line with the command:
vncviewer localhost:5900 &
Below is a picture of the pcDuino desktop seen on my local machine.
The update speed will naturally be limited by the speed of your network but if you are looking for access to the pcDuino desktop and don’t have an HDMI monitor, you can’t beat the price.