Create a powerful, secure IoT hub running Debian on the BBB in under an hour.

As it's a Xively-fest in the lab these days, I figured I'd share our quick-clone Xively image for the BBB and the configuration steps.  Briefly, we are going to:

  • Install the latest official version of Debian
  • Initial configuration (passwords, Wifi, etc.)
  • Install the Xively client
  • Connect to Xively's MQTT broker


Create a Debian microSD

Pop your microSD card into a card reader on your laptop or desktop.  Locate it using mount or fdisk as you see fit.  If you're unfamiliar with these commands, this is worth a read, as is this.

$ mount

Make darn sure you know which device is actually the microSD.  Flashing the wrong device with dd (below) has a high probability of irreversibly mangling a hard drive.

Download the latest stock Recommended Debian image from

The image comes as an .xz.  To decompress: 

$ xz -d bone-debian-*.xz

Once you've extracted the .img image file you can write it to the microSD card.  Again, make sure you know which device is the microSD before proceeding.  If you have downloaded multiple bone-debian-*.img files, replace bone-debian-*.img with the complete filename. There are three variations on this depending on what OS you're running on the host:

Method 1:
Stock dd if you don't yet have GNU Coreutils 8.24 (Earlier than Ubuntu 16.04)

$ sudo dd if=./bone-debian-*.img of=/dev/sdX-be-sure-this-is-correct

Method 2:
If you have GNU Coreutils 8.24+ (Ubuntu 16.04 or newer)

$ sudo dd if=./bone-debian-*.img of=/dev/sdX-be-sure-this-is-correct status=progress

Method 3:
If you have an older version of Coreutils, but you don't want to wait in the blind, you can install pv and pipe it through that:

$ sudo dd if=./bone-debian-*.img | pv | dd of=/dev/sdX-be-sure-this-is-correct

(More detailed, and frankly, better, instructions on how to do this from a Windows rel="noopener noreferrer" host over on Derek Molloy's Blog.  If you're doing anything with a BeagleBone you might as well bookmark his blog now anyway.)

Assuming you're connected to your BeagleBone via USB, you can now SSH to it at

Debian GNU/Linux 8 Debian Image 2016-05-13


default username:password is [debian:temppwd]

Last login: Fri May 13 18:11:11 2016 from

Change the password for the debian user:

root@beaglebone:~# passwd debian
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Remove the "default username:password is [debian:temppwd]" from the default SSH greeting by removing that line from /etc/  To remove it for local logins you'll want to remove it from /etc/issue as well.

Configuring rel="noopener noreferrer" WiFi

We're using the Edimax EW-7811Un Wi-Fi USB Adapter, but with no- or minor-adjustment this should work for pretty much any wireless adapter.  

If we want our nameservers in /etc/network/interfaces to populate /etc/resolv.conf, we need to install the optional package resolvconf.  (I never got connman to work with our setup.  If you know how, please post a comment.)

First, we need to bootstrap the stock /etc/resolv.conf so that we can run apt-get this one time.  I'm using Google's:


Next, install resolvconf:

root@beaglebone:~# apt-get install resolvconf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  cmst connman rcnee-access-point
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 3 to remove and 48 not upgraded.

Here's our stock /etc/network/interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# Adjust as appropriate 
allow-hotplug wlan0
iface wlan0 inet static
    wpa-ssid "<your-network-ssid>"
    wpa-psk  "<your-network-password>"
address netmask gateway

# This is a handy place to do an initial script launch for IoT stuff.
# Just make sure you're not launching multiple processes on a reconnect.
# post-up /home/debian/yourscript/start &
# Ethernet/RNDIS gadget (g_ether) # ... or on host side, usbnet and random hwaddr # Note on some boards, usb0 is automaticly setup with an init script iface usb0 inet static address netmask network gateway

 Save /etc/network/interfaces and reboot, and you should be able to SSH in over the network.  Obviously sub in your device IP:

$ ssh debian@
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is 03:1e:9b:1e:c1:a6:64:1c:ae:ae:ad:a6:66:a9:51:51.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (ECDSA) to the list of known hosts.
Debian GNU/Linux 8 Debian Image 2016-05-13

debian@'s password: 

w00t, we're in.

Verify that resolv.conf was generated correctly:

# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# ping PING ( 56(84) bytes of data. 64 bytes from ( icmp_seq=1 ttl=61 time=12.2 ms 64 bytes from ( icmp_seq=2 ttl=61 time=16.8 ms ^C --- ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 12.226/14.550/16.875/2.327 ms

Connect to Xively

From here, all you need to do is complete the steps outlined in Part 1: Install xiPy of the Up and Running on Xively with Python series, and your image is ready to clone.  You now have a solid base on which to prototype your next IoT project.

Hit me up with any questions.