Headless Hard-float BeagleBone Black - Part 2: Installing LXDE Desktop and Autostart VNC Server

Welcome to Part 2 of my guide on "Headless Hard-float BeagleBone Black". Make sure you did not miss Part 1: Installing Hard-float Ubuntu.

Let's get started. Why do we need to install LXDE Desktop? Well, armhf ubuntu only comes with terminal interface, and for some applications, you need a Desktop GUI. Ubuntu have its default Desktop (Unity), but it's too heavy. You can't fit ubuntu with its desktop on BBB's eMMC. And even on spacious uSD card, the GUI is too slow to provide acceptable user experience. If I remember it right, clean armhf ubuntu takes about 300 MBs, and LXDE takes another 300 MBs, so you will still have more than 1 GB for other stuff (most likely dependencies for development).

Make sure your BBB is updated and upgraded before proceeding:

1
2
sudo apt-get update
sudo apt-get upgrade

Those 2 commands will do the job. Now, to install LXDE, type:

1
sudo apt-get -y install lxde lxde-core lxde-icon-theme

You can skip the "-y" if you want to confirm the installation yourself. After it's done, reboot. If you have a monitor, you can connect it to BBB and you're greeted by LXDE log in screen.

With LXDE install, we will go on and install an autostart VNC server. First, you need x11vnc server:

1
sudo apt-get install x11vnc

Use this command to start VNC server:

1
x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -auth /var/run/lxdm/lxdm-\:0.auth -display :0 -forever

Then use a VNC viewer to connect to your BBB. If you haven't got one, you can try this.

Now, we want to setup your BBB to run that command every time it boots. Luckily, LXDE makes this very easy. Use your favorite text editor to edit /etc/lxdm/LoginReady with root privilege. The easiest way is to use WinSCP, connect to your BBB as root, navigate to that file and open it. You are now editing it on your friendly Windows environment. Just copy and paste the command:

1
x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -auth /var/run/lxdm/lxdm-\:0.auth -display :0 -forever

at the end of LoginReady and save it.

Some explanations:
  • LXDM's LoginReady is a shell script file, and it will be executed with root privilege when LXDM is ready to show the login window.
  • The flag "-forever" in the VNC server command is to tell the server to not go down. Without that flag, your VNC server will accept the first connection. And when that first client disconnect, the server is shutdown too (just the VNC server, not your whole BBB). 

1 comment:

Quicksilver said...

Hey man this is good stuff, I will be linking to your blog from mine, thanks for making all the basic information so easily available.