Quickly setting up headless access on linux SBCs like the pine64

This is a quick guide to enabling headless VNC access on the pine64 using USB serial.

Things you’ll need:

  • Pine64
  • A USB to serial convertor
  • Ethernet cable

Connections

Connect pin 9 on the EXP connector on the pine64 to GND of your USB serial or arduino. Connect EXP 8 to TXD of the USB serial or digital pin 0 of the arduino. Connect EXP 7 to RXD of USB serial or digital pin 1 of the arduino. If you’re using an arduino, connect a jumper across the RESET and GND pins. Connect the USB serial or the arduino to a computer.

Using screen to get a shell

Open a terminal and run ls /dev/tty*. You should get something like:

/dev/tty    /dev/tty19  /dev/tty3   /dev/tty40  /dev/tty51  /dev/tty62
/dev/tty0   /dev/tty2   /dev/tty30  /dev/tty41  /dev/tty52  /dev/tty63
/dev/tty1   /dev/tty20  /dev/tty31  /dev/tty42  /dev/tty53  /dev/tty7
/dev/tty10  /dev/tty21  /dev/tty32  /dev/tty43  /dev/tty54  /dev/tty8
/dev/tty11  /dev/tty22  /dev/tty33  /dev/tty44  /dev/tty55  /dev/tty9
/dev/tty12  /dev/tty23  /dev/tty34  /dev/tty45  /dev/tty56  /dev/ttyS0
/dev/tty13  /dev/tty24  /dev/tty35  /dev/tty46  /dev/tty57  /dev/ttyS1
/dev/tty14  /dev/tty25  /dev/tty36  /dev/tty47  /dev/tty58  /dev/ttyS2
/dev/tty15  /dev/tty26  /dev/tty37  /dev/tty48  /dev/tty59  /dev/ttyS3
/dev/tty16  /dev/tty27  /dev/tty38  /dev/tty49  /dev/tty6   /dev/ttyUSB0
/dev/tty17  /dev/tty28  /dev/tty39  /dev/tty5   /dev/tty60  /dev/ttyACM0
/dev/tty18  /dev/tty29  /dev/tty4   /dev/tty50  /dev/tty61

In my case, the arduino is ttyACM0 and the USB serial is ttyUSB0. Your numbers might be different, so take note of it. Now run sudo screen /dev/(your serial device) 115200

Enabling autologin and installing x11vnc

Now power on your pine and wait for the username prompt to appear and log in. Once inside, run sudo nano /etc/lightdm/lightdm.conf. Add the following content :

[SeatDefaults]
autologin-user=(YOUR USER)
autologin-user-timeout=0
user-session=ubuntu
greeter-session=unity-greeter

where (YOUR USER) is the default username. Next, run sudo apt-get update;sudo apt-get install -y x11vnc

Connecting to the pine through VNC

Connect your Pine to the PC through ethernet. In the network settings of your PC, change your ethernet’s method under IPv4 to “Shared to other computers”. In the serial terminal, run sudo ifconfig eth0 10.42.0.2. Now use a VNC client to connect to 10.42.0.2:5900. On the pine, open the network config menu and set it to DHCP. Now reboot the pine and connect it to your LAN. You can now SSH to the pine and run x11vnc to start the VNC server at any time.