One day while traveling I ended up at a hotel with shitty wifi service that kept dropping my VPN connection. I cannot abide bad internet, and for various reasons phone tethering was not an option. The wired network connection in the room worked great, but I didn’t want to be tied to a wire. I happened to have a BeagleBone Black and an Alfa AWUS036NHA wifi adapter with me, so why not try to make that work?

To my surprise, once I loaded the latest version of Debian and connected the wifi adapter and ethernet, it just worked out of the box as a wireless access point. No, seriously: before configuring anything I noticed there was an Access Point called “BeagleBone-839A”. I couldn’t find this documented anywhere, but after a little bit of research I found that the default password would be “BeagleBone”.  Mission Accomplished (mostly).

So, let’s break down the steps here:

First, download the latest OS image for BeagleBone, which can be found here: https://beagleboard.org/latest-images. In this case I downloaded Debian 8.6 (Jessie) 2016-05-13. Unzip the file so that you have a .img file.

Copy the image to your SD card. I use a mac, so I followed the instructions here (they are the same as for the Raspberry Pi). The gist of it is:

Find out the SD drive designation:

diskutil list

For me, it was disk2 (you want the disk, not the partition). Unmount the disk:

diskutil unmountDisk /dev/disk<disk# from diskutil>
example: diskutil unmountDisk /dev/disk2

Copy the .img block-for-block to the SD card. Note that the out file disk designation should start with a “r”:

sudo dd bs=1m if=Downloads/bone-debian-8.4-lxqt-4gb-armhf-2016-05-13-4gb.img of=/dev/rdisk2

You won’t see anything happen, and your command line will stop responding for a little while. Once it’s done, eject the SD card and plug it into the BeagleBone.  Plug in the wifi adapter to the BeagleBone. Plug in the ethernet cable which leads to the internet. Hold down the boot button and apply power to the BeagleBone (not sure if you have to hold down the boot button, but i guess it doesn’t hurt to do it the first time).

Check out what wifi SSIDs are available. You should see one named something along the lines of BeagleBone-XXXX (mine was BeagleBone-839A). Connect to it using the password BeagleBone. It should provide you with an IP address.

Now, you should be able to surf the web. Also, you can SSH to the BeagleBone. For me, the IP of the BeagleBone was 192.168.0.1; I figured this out because that was the gateway address provided to my computer.  The default SSH credentials are debian/temppwd. “Conveniently,” they are printed to the terminal when you connect to SSH. We’ll fix that in a moment.

First thing I did was resize the boot partition to use the entire SD card, otherwise the filesystem will fill up quickly and you won’t be able to do anything.

To begin, verify that you booted from the SD card rather than the eMMC:

debian@beaglebone:~$ ls -al /dev/mmc*
brw-rw---- 1 root disk 179, 0 May 13 18:08 /dev/mmcblk0
brw-rw---- 1 root disk 179, 1 May 13 18:08 /dev/mmcblk0p1
brw-rw---- 1 root disk 179, 8 May 13 18:08 /dev/mmcblk1
brw-rw---- 1 root disk 179, 16 May 13 18:08 /dev/mmcblk1boot0
brw-rw---- 1 root disk 179, 24 May 13 18:08 /dev/mmcblk1boot1
brw-rw---- 1 root disk 179, 9 May 13 18:08 /dev/mmcblk1p1
brw-rw---- 1 root disk 179, 10 May 13 18:08 /dev/mmcblk1p2

The listing above shows an external SD card is currently booted as indicated by the/dev/mmcblk0 entries and the lack of /dev/mmcblk0boot entries (source: ARMhf.com)

Once that is verified, we must resize the partion using fdisk.  Use “p” to view the current partition table; there should only be one partition. Use “d” to delete the partition (I know this is scary! To be safe, make sure you have a good backup of your SD card). Create a new partition with “n”. Accept all the defaults for partition type (primary), partition number (1), the first sector and last sector (depends on your SD card). Set the partition to bootable with “a”. Write the partition table with “w”. Quit fdisk with “q”. Finally, reboot your BeagleBone.

debian@beaglebone:~$ sudo fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/mmcblk0: 29.8 GiB, 32026656768 bytes, 62552064 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6c6218b4

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 6963199 6961152 3.3G 83 Linux


Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): n
Partition type
 p primary (0 primary, 0 extended, 4 free)
 e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-62552063, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-62552063, default 62552063):

Created a new partition 1 of type 'Linux' and of size 29.8 GiB.

Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

debian@beaglebone:~$ sudo reboot

Basically, this creates a larger partition with the same starting position as the original. However, the now-larger partition isn’t fully used by the operating system, so we need to resize it  using resize2fs:

debian@beaglebone:~$ sudo resize2fs /dev/mmcblk0p1
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/mmcblk0p1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/mmcblk0p1 is now 7818752 (4k) blocks long.

At this point, we could call it a day. However, there are some security issues we need to take care of. First, let’s get rid of the username/password reminder that pops up when you connect via ssh. This is located in both /etc/issue and /etc/issue.net, so let’s overwrite with nothing:

debian@beaglebone:~$ sudo cp /dev/null /etc/issue
debian@beaglebone:~$ sudo cp /dev/null /etc/issue.net

Also, we should probably change the password for the user debian:

debian@beaglebone:~$ passwd
Changing password for debian.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Finally, we can modify the SSID and password used to access the wifi access point. The BeagleBone black uses connman to create the access point. connman calls it “tethering,” but whatever. It suits my purposes. The SSID/password are configured in /var/lib/connman/settings as Tethering.Identifier and Tethering.Passphrase; use your favorite text editor to modify as desired.

debian@beaglebone:~$ sudo cat /var/lib/connman/settings
[global]
OfflineMode=false

[Wired]
Enable=true
Tethering=false

[WiFi]
Enable=true
Tethering=true
Tethering.Identifier=BeagleBone-839A
Tethering.Passphrase=BeagleBone

[Gadget]
Enable=false
Tethering=false

[P2P]
Enable=false
Tethering=false

[Bluetooth]
Enable=true
Tethering=false

So, that’s it for now. There are a few other issues to address, but I’ll handle those later. Namely, setting up iptables to firewall the internet side (ethernet). Also, it seems that the default configuration described here doesn’t actually provide internet to the BeagleBone itself. So, I need to figure that one out.

Additional reading:

One thought on “BeagleBone Wifi Access Point”

leave it: