Tutorial: Wifi On The Beaglebone Black With Systemd

Hi All

Back in September I posted about some problems I had getting wifi going on the BBB. I’ve taken another shot at it and I (think I) have something working now. This post also rolls in a few other assorted tidbits scattered around in other posts. Hope somebody finds this useful.

Read it here on my blog: Wifi On The Beaglebone Black With Systemd

This is on the Jessie snapshot. I first tried it on my TP-Link TL-WN722N dongle but was getting kernel crashes again like I was in September. Bad hardware or ??? Things seem to work OK with a ZD1211 based dongle (any chance of getting zd1211-firmware in the image snapshot?), though I do see a few DUP! pings sometimes when the network has been idle for a while e.g.

PING www.google.com (216.58.216.228) 56(84) bytes of data.
64 bytes from ord31s22-in-f4.1e100.net (216.58.216.228): icmp_seq=1 ttl=50 time=74.8 ms
64 bytes from ord31s22-in-f4.1e100.net (216.58.216.228): icmp_seq=2 ttl=50 time=68.3 ms
64 bytes from ord31s22-in-f4.1e100.net (216.58.216.228): icmp_seq=3 ttl=50 time=71.4 ms
64 bytes from ord31s22-in-f4.1e100.net (216.58.216.228): icmp_seq=4 ttl=50 time=70.5 ms
64 bytes from ord31s22-in-f4.1e100.net (216.58.216.228): icmp_seq=4 ttl=50 time=75.6 ms (DUP!)
64 bytes from ord31s22-in-f4.1e100.net (216.58.216.228): icmp_seq=4 ttl=50 time=76.2 ms (DUP!)
64 bytes from ord31s22-in-f4.1e100.net (216.58.216.228): icmp_seq=4 ttl=50 time=76.2 ms (DUP!)
64 bytes from ord31s22-in-f4.1e100.net (216.58.216.228): icmp_seq=4 ttl=50 time=76.5 ms (DUP!)
64 bytes from ord31s22-in-f4.1e100.net (216.58.216.228): icmp_seq=4 ttl=50 time=82.6 ms (DUP!)

Thoughts? Comments? Questions?

Looks like I may have spoken too soon. I wasn’t even in the room when the connection died this time, after having run OK for hours. This with my ZD1211 dongle. I think I’m going to give up on this thing unless anyone has any ideas.

root@beaglebone:~# ping www.google.com
ping: unknown host www.google.com

root@beaglebone:~# iw wlan1 link
Not connected.

root@beaglebone:~# systemctl status NetworkManager -l
● NetworkManager.service - Network Manager
Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled)
Active: active (running) since Mon 2014-12-29 16:35:58 UTC; 9h ago
Main PID: 269 (NetworkManager)
CGroup: /system.slice/NetworkManager.service
├─ 269 /usr/sbin/NetworkManager --no-daemon
└─14165 /sbin/dhclient -d -q -sf /usr/lib/NetworkManager/nm-dhcp-helper -pf /var/run/dhclient-wlan1.pid -lf /var/lib/NetworkManager/dhclient-5db23428-d56d-4342-95e4-41a1380e4424-wlan1.lease -cf /var/lib/NetworkManager/dhclient-wlan1.conf wlan1

Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1) Stage 5 of 5 (IPv4 Commit) started…
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): device state change: ip-config → ip-check (reason ‘none’) [70 80 0]
Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1) Stage 5 of 5 (IPv4 Commit) complete.
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): device state change: ip-check → secondaries (reason ‘none’) [80 90 0]
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): device state change: secondaries → activated (reason ‘none’) [90 100 0]
Dec 30 01:34:42 beaglebone NetworkManager[269]: NetworkManager state is now CONNECTED_LOCAL
Dec 30 01:34:42 beaglebone NetworkManager[269]: NetworkManager state is now CONNECTED_GLOBAL
Dec 30 01:34:42 beaglebone NetworkManager[269]: Policy set ‘Wi-Fi connection Abby’ (wlan1) as default for IPv4 routing and DNS.
Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1) successful, device activated.
Dec 30 01:35:16 beaglebone NetworkManager[269]: (wlan1): roamed from BSSID 10:C3:7B:DF:9C:68 (Abby_Slow) to (none) ((none))

root@beaglebone:~# journalctl -u NetworkManager --no-pager | less

Dec 29 20:46:29 beaglebone NetworkManager[269]: Activation (wlan1) successful, device activated.
Dec 30 01:33:22 beaglebone NetworkManager[269]: Connection disconnected (reason -4)
Dec 30 01:33:22 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: completed → disconnected
Dec 30 01:33:22 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: disconnected → scanning
Dec 30 01:33:23 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: scanning → authenticating
Dec 30 01:33:23 beaglebone NetworkManager[269]: (wlan1): roamed from BSSID 10:C3:7B:DF:9C:68 (Abby_Slow) to (none) ((none))
Dec 30 01:33:23 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: authenticating → disconnected
Dec 30 01:33:25 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: disconnected → scanning
Dec 30 01:33:37 beaglebone NetworkManager[269]: (wlan1): link timed out.
Dec 30 01:33:37 beaglebone NetworkManager[269]: (wlan1): device state change: activated → failed (reason ‘ssid-not-found’) [100 120 53]
Dec 30 01:33:37 beaglebone NetworkManager[269]: NetworkManager state is now CONNECTED_LOCAL
Dec 30 01:33:37 beaglebone NetworkManager[269]: NetworkManager state is now DISCONNECTED
Dec 30 01:33:37 beaglebone NetworkManager[269]: Activation (wlan1) failed for connection ‘Wi-Fi connection Abby’
Dec 30 01:33:37 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: scanning → authenticating
Dec 30 01:33:37 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: authenticating → associating
Dec 30 01:33:37 beaglebone NetworkManager[269]: (wlan1): device state change: failed → disconnected (reason ‘none’) [120 30 0]
Dec 30 01:33:37 beaglebone NetworkManager[269]: (wlan1): deactivating device (reason ‘none’) [0]
Dec 30 01:33:37 beaglebone NetworkManager[269]: (wlan1): canceled DHCP transaction, DHCP client pid 14272
Dec 30 01:33:38 beaglebone NetworkManager[269]: Connection disconnected (reason -3)
Dec 30 01:33:38 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: associating → disconnected
Dec 30 01:33:38 beaglebone NetworkManager[269]: Auto-activating connection ‘Wi-Fi connection Abby’.
Dec 30 01:33:38 beaglebone NetworkManager[269]: Activation (wlan1) starting connection ‘Wi-Fi connection Abby’
Dec 30 01:33:38 beaglebone NetworkManager[269]: Activation (wlan1) Stage 1 of 5 (Device Prepare) scheduled…
Dec 30 01:33:38 beaglebone NetworkManager[269]: Activation (wlan1) Stage 1 of 5 (Device Prepare) started…
Dec 30 01:33:38 beaglebone NetworkManager[269]: (wlan1): device state change: disconnected → prepare (reason ‘none’) [30 40 0]
Dec 30 01:33:38 beaglebone NetworkManager[269]: NetworkManager state is now CONNECTING
Dec 30 01:33:38 beaglebone NetworkManager[269]: Activation (wlan1) Stage 2 of 5 (Device Configure) scheduled…
Dec 30 01:33:38 beaglebone NetworkManager[269]: Activation (wlan1) Stage :2 of 5 (Device Configure) scheduled…
1 of 5 (Device Prepare) complete.
Dec 30 01:33:38 beaglebone NetworkManager[269]: Activation (wlan1) Stage 2 of 5 (Device Configure) starting…
Dec 30 01:33:38 beaglebone NetworkManager[269]: (wlan1): device state change: prepare → config (reason ‘none’) [40 50 0]
Dec 30 01:33:38 beaglebone NetworkManager[269]: Activation (wlan1/wireless): connection ‘Wi-Fi connection Abby’ requires no security. No secrets needed.
Dec 30 01:33:38 beaglebone NetworkManager[269]: Config: added ‘ssid’ value ‘Abby_Slow’
Dec 30 01:33:38 beaglebone NetworkManager[269]: Config: added ‘scan_ssid’ value ‘1’
Dec 30 01:33:38 beaglebone NetworkManager[269]: Config: added ‘key_mgmt’ value ‘NONE’
Dec 30 01:33:38 beaglebone NetworkManager[269]: Activation (wlan1) Stage 2 of 5 (Device Configure) complete.
Dec 30 01:33:38 beaglebone NetworkManager[269]: Config: set interface ap_scan to 1
Dec 30 01:33:39 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: disconnected → scanning
Dec 30 01:33:52 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: scanning → authenticating
Dec 30 01:33:53 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: authenticating → disconnected
Dec 30 01:33:58 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: disconnected → scanning
Dec 30 01:34:03 beaglebone NetworkManager[269]: Activation (wlan1/wireless): association took too long, failing activation.
Dec 30 01:34:03 beaglebone NetworkManager[269]: (wlan1): device state change: config → failed (reason ‘ssid-not-found’) [50 120 53]
Dec 30 01:34:03 beaglebone NetworkManager[269]: NetworkManager state is now DISCONNECTED
Dec 30 01:34:03 beaglebone NetworkManager[269]: Activation (wlan1) failed for connection ‘Wi-Fi connection Abby’
Dec 30 01:34:03 beaglebone NetworkManager[269]: (wlan1): device state change: failed → disconnected (reason ‘none’) [120 30 0]
Dec 30 01:34:03 beaglebone NetworkManager[269]: (wlan1): deactivating device (reason ‘none’) [0]
Dec 30 01:34:03 beaglebone NetworkManager[269]: Couldn’t disconnect supplicant interface: This interface is not connected.
Dec 30 01:34:03 beaglebone NetworkManager[269]: Couldn’t disconnect supplicant interface: This interface is not connected.
Dec 30 01:34:03 beaglebone NetworkManager[269]: Auto-activating connection ‘Wi-Fi connection Abby’.
Dec 30 01:34:03 beaglebone NetworkManager[269]: Activation (wlan1) starting connection ‘Wi-Fi connection Abby’
Dec 30 01:34:03 beaglebone NetworkManager[269]: Activation (wlan1) Stage :of 5 (Device Prepare) started…
Dec 30 01:34:03 beaglebone NetworkManager[269]: (wlan1): device state change: disconnected → prepare (reason ‘none’) [30 40 0]
Dec 30 01:34:03 beaglebone NetworkManager[269]: NetworkManager state is now CONNECTING
Dec 30 01:34:03 beaglebone NetworkManager[269]: Activation (wlan1) Stage 2 of 5 (Device Configure) scheduled…
Dec 30 01:34:03 beaglebone NetworkManager[269]: Activation (wlan1) Stage 1 of 5 (Device Prepare) complete.
Dec 30 01:34:03 beaglebone NetworkManager[269]: Activation (wlan1) Stage 2 of 5 (Device Configure) starting…
Dec 30 01:34:03 beaglebone NetworkManager[269]: (wlan1): device state change: prepare → config (reason ‘none’) [40 50 0]
Dec 30 01:34:03 beaglebone NetworkManager[269]: Activation (wlan1/wireless): connection ‘Wi-Fi connection Abby’ requires no security. No secrets needed.
Dec 30 01:34:03 beaglebone NetworkManager[269]: Config: added ‘ssid’ value ‘Abby_Slow’
Dec 30 01:34:03 beaglebone NetworkManager[269]: Config: added ‘scan_ssid’ value ‘1’
Dec 30 01:34:03 beaglebone NetworkManager[269]: Config: added ‘key_mgmt’ value ‘NONE’
Dec 30 01:34:03 beaglebone NetworkManager[269]: Activation (wlan1) Stage 2 of 5 (Device Configure) complete.
Dec 30 01:34:03 beaglebone NetworkManager[269]: Couldn’t disconnect supplicant interface: This interface is not connected.
Dec 30 01:34:03 beaglebone NetworkManager[269]: Config: set interface ap_scan to 1
Dec 30 01:34:28 beaglebone NetworkManager[269]: Activation (wlan1/wireless): association took too long, failing activation.
Dec 30 01:34:28 beaglebone NetworkManager[269]: (wlan1): device state change: config → failed (reason ‘ssid-not-found’) [50 120 53]
Dec 30 01:34:28 beaglebone NetworkManager[269]: NetworkManager state is now DISCONNECTED
Dec 30 01:34:28 beaglebone NetworkManager[269]: Activation (wlan1) failed for connection ‘Wi-Fi connection Abby’
Dec 30 01:34:28 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: scanning → disconnected
Dec 30 01:34:28 beaglebone NetworkManager[269]: (wlan1): device state change: failed → disconnected (reason ‘none’) [120 30 0]
Dec 30 01:34:28 beaglebone NetworkManager[269]: (wlan1): deactivating device (reason ‘none’) [0]
Dec 30 01:34:28 beaglebone NetworkManager[269]: Could not get scan request result: Scan request rejected
Dec 30 01:34:28 beaglebone NetworkManager[269]: Auto-activating connectio:
Dec 30 01:34:28 beaglebone NetworkManager[269]: Activation (wlan1) starting connection ‘Wi-Fi connection Abby’
Dec 30 01:34:28 beaglebone NetworkManager[269]: Activation (wlan1) Stage 1 of 5 (Device Prepare) scheduled…
Dec 30 01:34:28 beaglebone NetworkManager[269]: Activation (wlan1) Stage 1 of 5 (Device Prepare) started…
Dec 30 01:34:28 beaglebone NetworkManager[269]: (wlan1): device state change: disconnected → prepare (reason ‘none’) [30 40 0]
Dec 30 01:34:28 beaglebone NetworkManager[269]: NetworkManager state is now CONNECTING
Dec 30 01:34:28 beaglebone NetworkManager[269]: Activation (wlan1) Stage 2 of 5 (Device Configure) scheduled…
Dec 30 01:34:28 beaglebone NetworkManager[269]: Activation (wlan1) Stage 1 of 5 (Device Prepare) complete.
Dec 30 01:34:28 beaglebone NetworkManager[269]: Activation (wlan1) Stage 2 of 5 (Device Configure) starting…
Dec 30 01:34:28 beaglebone NetworkManager[269]: (wlan1): device state change: prepare → config (reason ‘none’) [40 50 0]
Dec 30 01:34:28 beaglebone NetworkManager[269]: Activation (wlan1/wireless): connection ‘Wi-Fi connection Abby’ requires no security. No secrets needed.
Dec 30 01:34:28 beaglebone NetworkManager[269]: Config: added ‘ssid’ value ‘Abby_Slow’
Dec 30 01:34:28 beaglebone NetworkManager[269]: Config: added ‘scan_ssid’ value ‘1’
Dec 30 01:34:28 beaglebone NetworkManager[269]: Config: added ‘key_mgmt’ value ‘NONE’
Dec 30 01:34:28 beaglebone NetworkManager[269]: Activation (wlan1) Stage 2 of 5 (Device Configure) complete.
Dec 30 01:34:28 beaglebone NetworkManager[269]: Config: set interface ap_scan to 1
Dec 30 01:34:29 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: disconnected → scanning
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: scanning → authenticating
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: authenticating → associating
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): supplicant interface state: associating → completed
Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1/wireless) Stage 2 of 5 (Device Configure) successful. Connected to wireless network ‘Abby_Slow’.
Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1) Stage 3 of 5 (IP Configure Start) scheduled.
Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1) Stage 3 of 5 (IP Configure Start) started…
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): device state change: config → ip-config (reason ‘none’) [50 70 0]
Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1) Beginning DHCPv4 transaction (timeout in 45 seconds)
Dec 30 01:34:42 beaglebone NetworkManager[269]: dhclient started with pid 14165
Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1) Stage 3 of 5 (IP Configure Start) complete.
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): DHCPv4 state changed nbi → preinit
Dec 30 01:34:42 beaglebone dhclient[14165]: DHCPREQUEST on wlan1 to 255.255.255.255 port 67
Dec 30 01:34:42 beaglebone dhclient[14165]: DHCPACK from 192.168.1.1
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): DHCPv4 state changed preinit → reboot
Dec 30 01:34:42 beaglebone NetworkManager[269]: address 192.168.1.244
Dec 30 01:34:42 beaglebone NetworkManager[269]: plen 24 (255.255.255.0)
Dec 30 01:34:42 beaglebone NetworkManager[269]: gateway 192.168.1.1
Dec 30 01:34:42 beaglebone NetworkManager[269]: server identifier 192.168.1.1
Dec 30 01:34:42 beaglebone NetworkManager[269]: lease time 86400
Dec 30 01:34:42 beaglebone NetworkManager[269]: hostname ‘beaglebone’
Dec 30 01:34:42 beaglebone NetworkManager[269]: nameserver '192.168.1.1:
Dec 30 01:34:42 beaglebone NetworkManager[269]: lease time 86400
Dec 30 01:34:42 beaglebone NetworkManager[269]: hostname ‘beaglebone’
Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1) Stage 5 of 5 (IPv4 Configure Commit) scheduled…
Dec 30 01:34:42 beaglebone dhclient[14165]: bound to 192.168.1.244 – renewal in 35908 seconds.
Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1) Stage 5 of 5 (IPv4 Commit) started…
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): device state change: ip-config → ip-check (reason ‘none’) [70 80 0]
Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1) Stage 5 of 5 (IPv4 Commit) complete.
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): device state change: ip-check → secondaries (reason ‘none’) [80 90 0]
Dec 30 01:34:42 beaglebone NetworkManager[269]: (wlan1): device state change: secondaries → activated (reason ‘none’) [90 100 0]
Dec 30 01:34:42 beaglebone NetworkManager[269]: NetworkManager state is now CONNECTED_LOCAL
Dec 30 01:34:42 beaglebone NetworkManager[269]: NetworkManager state is now CONNECTED_GLOBAL
Dec 30 01:34:42 beaglebone NetworkManager[269]: Policy set ‘Wi-Fi connection Abby’ (wlan1) as default for IPv4 routing and DNS.
Dec 30 01:34:42 beaglebone NetworkManager[269]: Activation (wlan1) successful, device activated.
Dec 30 01:35:16 beaglebone NetworkManager[269]: (wlan1): roamed from BSSID 10:C3:7B:DF:9C:68 (Abby_Slow) to (none) ((none))

Just added back for Jessie.

Regards,

Thanks Robert.

I think I have some good news with respect to the problem I was having with the TP-Link TL-WN722N locking up. Yesterday morning I set the cpu governor to “performance” and the connection has been solid ever since (unless you count the five power outages we had at our house yesterday). Unfortunately this didn’t fix the problem with the ZD1211 based stick - it would still report DUP packets and it then lost its connection after less than an hour. I’m sticking with the TP-Link going forward.

So, for future reference, here is a cut and paste from another post on this board.

Edit /etc/default/cpufrequtils (you might need to create it if it doesn’t exist). Specify the governor with the GOVERNOR variable:

nano /etc/default/cpufrequtils to contain the line
GOVERNOR=“performance”

I’m going to update my blog post with this info. I would also suggest that this be made the default in your future images: I’m not the only person that has seen weird behavior with the default of “ondemand”.

I forget what the actual power draw numbers are, but we set default so
to "ondemand" such that powering by usb works.. If you have 5volt
power, feel free to force performance mode.

I haven't looked into it fully, but the pmic knows what mode we are in
(usb or 5volt), thus we should be able to determine that and use it to
set the default on bootup.

Regards,

Humm... maybe i need another cup of coffee...

CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y

https://github.com/RobertCNelson/bb-kernel/blob/am33x-v3.8/patches/defconfig#L532

So on bootup it's using the performance governor till the usespace
"cpufreq" utilty loads, then it drops down to ondemand..

Regards,

Robert,

Did the detection of the voltage in the PMIC and therefore the forcing of performance mode go any further at all?

We are powering via the header pins with 5V and see it drop to "ondemand" after boot.

Lee