In which we try to get the 802.11n wifi module (RTl8192cu Chipset) from Ada Fruit running on a Beagle Board Black under Arch Linux Arm
Please note: This guide assumes you already have Arch Linux Arm running on your Beagle Bone Black.
First things first, let’s get your installation up to date and install a few needed packages.
You will need the following:
- iw – command line interface to manage wireless devices (replaced iwconfig)
- wpa_actiond – needed to automatically connect to wifi networks on boot
- netctl – used to control the state of the system services for the network profile manager (replaced netcfg)
- ifplugd – needed to automatically connect to wired networks on boot
Getting started, install iw and wpa_action
pacman -S iw wpa_actiond
Next, you need to remove netcfg as it conflicts with netctl. If you fail to remove netcfg first, you will likely receive errors when you attempt to install netctl.
pacman -Rs netcfg
You need to update the system before installing netctl and ifplugd. If you try to install them first, you will receive a message that the packages cannot be found.
Update you system with
With the system up to date, install netctl and ifplugd with
pacman -S netctl ifplugd
All required packages are now installed and up to date, and you are ready to configure the networks.
The first thing you want to do is ensure the system will bring up the wired network. Otherwise, if there is no wifi connection, you will need a keyboard, mouse, and monitor plugged into the Beagle Bone Black in order to issue commands1.
Copy the default dhcp ethernet connection from the examples2 directory to /etc/netctl/
cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/
Now set it to start when the system starts
systemctl enable email@example.com
If you were to reboot now, you should at least be able to establish an ethernet connection.
On to wifi!
My network is configured to use WPA to secure the wireless connection, and for security sake, I hope yours is too. WPA is handled by wpa_supplicant. The Arch Linux Wiki indicates nl80211 is the preferred driver for use with wpa_supplicant instead of the older wext. Unfortunately, I could not get the wifi module to connect if wpa_supplicant was using the nl80211 driver.
To ensure wpa_wupplicant uses wext edit fi.epitest.hostap.WPASupplicant.service and add -D wext
Another issue I encountered was the need to have the system clock set so wpa_supplicant can validate timestamps. If the system clock is too far off, validation will fail, and it will not connect (more on this later). By default, Arch Linux Arm runs OpenNTP to correct the system time. Depending on how long your board has been running, your system time may or may not be correct.
Issue the command date to check the system time.
If your system time is off, you have a couple options for setting the system clock
Setting is manually with something like
timedatectl set-time "2012-10-30 18:17:16"
Setting it automatically with NTP
I prefer the second choice.
Arch Linux Arm comes with OpenNTP by default. This package is not maintained for Linux, so let’s switch it out for regular old NTP.
pacman -S ntp
When asked, allow pacman to remove OpenNTP.
Now you can set the time from the internet with
Leave out the d if you do not want to see diagnostic output.
Finally, set the hardware clock to the updated time with
You can set ntp to run at boot with
systemctl enable ntpd
Now make a config file for wifi in /etc/netctl/ by copying the wireless_wpa_configsection configuration from the examples directory
cp /etc/netctl/examples/wireless-wpa-configsection /etc/netctl/wireless_wpa_configsection
There are other wpa config files in the examples directories, but the configsection configuration is the only format that can be loaded automatically at boot.
Also, please notice the hyphens in the copy to name have been replaced with underscores. If you do not change the hyphens, you may get cryptic errors and your wifi configuration will not work. Apparently this has to do with how hyphens are (mis)handled.
You can use wpa_passphrase to generate the required wpa_supplicant config data like so
wpa_passphrase SSID PASSWORD
This will output the required configuration. I hope your password is better than the one in the screenshot.
Copy this data and place it in wireless_wpa_configsection
Note the single quotes around the configuration keys in the screenshot.
To test your configuration, issue the following commands
netctl start wireless_wpa_configsection
If you receive an error, check the status as instructed in the message. The first time I tried to connect, it timed out; however, attempting to start netctl again worked.
If all goes well, you should see an entry for wlan0 with an ip address. If not, double check the configuration file and ensure your SSID and password are correct. If you have a router that broadcasts on both 2.4 Ghz and 5 Ghz, be sure and use the SSID in use on the 2.4 Ghz spectrum as the Ada Fruit adapter is 2.4 Ghz.
With everything working, you can set wifi to start at boot with
systemctl enable firstname.lastname@example.org
As long as you do not fully power off the board (ie by holding the power button for greater than 8 seconds, by issuing the poweroff command, or by losing power) wifi will automatically reconnect. In other words, if you reboot the board everything will be fine. If the power is interrupted, wifi most likely will not automatically reconnect.
This is because the real time clock (RTC) on the Beagle Bone Black does not have a battery backup. When you power off the board, the RTC is reset. This causes wpa_supplicant to fail timestamp checks. I am currently looking at two solutions to this problem.
- Using fake hardware clock to periodically save the time to a file and reload it at boot
- Using a battery backed RTC over SPI or I2C to maintain the time when the board is powered off
Depending on your needs, solution 1 may not be an option. I will update these instructions after I have tested both.
1Unless you have installed and configured USB Gadet, but that is a topic for another post.
2In this post, I assume you are using DHCP. If not, use the static IP address config files.