Update Beaglebone Green To Latest Image

It is time to upgrade default image on BBGW – BeagleBone Green Wireless board. This guide details out steps on Update Beaglebone Green To Latest Image. My default image on BBGW is “BeagleBoard.org Debian Image 2016-06-14”. The command dog cat will tell you what image you are at in BBGW. $cat /etc/dogtag
The default Wi-Fi access point password for latest flasher images is “BeagleBone-A490”. This image comes as default when you buy BBGW in India. Few of the reason to upgrade to new image is, Difficulty in connecting to internet with old image. New uEnv.txt format will not work on this image, and you will have difficulty while communicating with UART, I2C and other peripherals. There are quite guides on Writing a new Image to the Beaglebone black but very few about beaglebone green wireless.

If you are looking for answers to the question like, How do I update my BeagleBone? or How do you flash a BeagleBone green? Upgrade to latest image is very simple.

BBGW Preparation For Upgrade

Make a backup of your custom stuff. If you are working on BBGW for some time, then your custom stuff will in home folder. It’s good to have a backup. Once you re-flash you can install the packages you need and put custom stuff. I suggest to create shell script for the packages you install.

Steps – Update Beaglebone Green To Latest Image

Beagle bone green wireless board upgrade to latest flasher image is simple three step process.

Step 1 –

Easiest way to re-flash to the latest system is by downloading the latest firmware flasher image. The latest flasher image “AM3358 Debian 10.3 2020-04-06 4GB eMMC IoT Flasher” from the “Flasher Debian images” section.

Step 2-

Write this image to sd card using Etcher (etcher.io)

BBGW upgrade to latest flasher image

Step 3 –

Now insert this SD card and boot BBGW from this new image. If you boot the beaglebone from SD card, it will automatically proceed to erase and reflash the eMMC.
But wait, since the current system is very old, to get it to boot from the sd card it is required to power on with the S2 button held down (the one closest to the sd card) during power-on, you can let go of the button once any LED’s turn on. Once booting process starts, user LED’s will start blinking to create sequence.
After 20-25 minutes LED’s will stop blinking. Once upgrade is completed, all the LED’s on the BBGW including power LED will be off.

Troubleshooting BBGW Connection –

Unplug BBGW power, take out SD card and plug in power to BBGW. Once BBGW powers up login to BBGW using following command.

$ ssh debian@beaglebone
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA host key for beaglebone has changed,
and the key for the corresponding IP address fe80::e615:f6ff:fefd:a492%59
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:TregYNPVgnma80ovgoaiICs0rjjpHm4FwYt+90chs/Y.
Please contact your system administrator.
Add correct host key in /c/Users/Admin/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /c/Users/Admin/.ssh/known_hosts:10
ECDSA host key for beaglebone has changed and you have requested strict checking.
Host key verification failed.

This was working with old image, since this is new image, login to begalebone using “beaglebone.local”

ssh debian@beaglebone.local

Once you are in check out dogtag and you should see the latest buster IoT image

debian@beaglebone:~$ cat /etc/dogtag
BeagleBoard.org Debian Buster IoT Image 2020-04-06

Now that you are connected to BBGW, lets try to update using – apt-get update.

debian@beaglebone:~$ ping google.com
ping: google.com: Temporary failure in name resolution
debian@beaglebone:~$ cat /etc/resolv.conf
Generated by Connection Manager

This implies that, BBGW is not connected to internet.

Setup WiFi on BBGW

We will be setting up WiFi using “connmanctl”, there are other ways, but since BBGW provides this utility lets use it.

debian@beaglebone:~$ connmanctl state
State = idle
OfflineMode = False
SessionMode = False

Above command output confirms that BBGW is not connected to internet.

BBGW connmanctl
debian@beaglebone:~$ connmanctl
Error getting VPN connections: The name net.connman.vpn was not provided by any .connmanctl> enable wifi
Error wifi: Already enabled
connmanctl> scan wifi
Scan completed for wifi
connmanctl> services
SARVESH wifi_64694e0e8e55_53415256455348_managed_psk
Gowda wifi_64694e0e8e55_476f776461_managed_psk
wifi_64694e0e8e55_hidden_managed_psk
connmanctl> agent on
Agent registered
connmanctl> connect wifi_64694e0e8e55_53415256455348_managed_psk
Agent RequestInput wifi_64694e0e8e55_53415256455348_managed_psk
Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]
WPS = [ Type=wpspin, Requirement=alternate ]
Passphrase? <your wifi password>
Connected wifi_64694e0e8e55_53415256455348_managed_psk
connmanctl> quit

Hope you have enjoyed reading on how to update Beaglebone Green To Latest Image.

BBGW And MQTT Broker Using Desktop

In the previous post we have seen different ways to connect BBGW – BeagleBone Green Wireless board with Wi-Fi and unboxing BBGW for the fist time. This post is about how to test BBGW and MQTT Broker using desktop or laptop.

When building IoT applications it is good practice to send test data using your desktop or laptop. This makes sure that your IoT application built using either flutter or android works fine. This will also help to reduce the waiting time for actual firmware and hardware getting ready. The mobile application developer can test and run his application without actual hardware. This technique can save you a lot of time and energy for the rest of your project development.

MQTT Setup On Desktop

To perform this test driven development of your IoT product using MQTT we need some MQTT broker. I have installed MQTTLense a chrome extension for testing MQTT applications.

MQTTLense is Google Chrome application, which connects to a MQTT broker and is able to subscribe and publish to MQTT topics. This will help for using the MQTT Monitor to view messages to the MQTT broker.

MQTTLense Installed

On your BBGW board install mosquitto service and confirm if its running. I assume you have already installed mosquitto broker on your BBGW.

t@beaglebone:~# sudo service mosquitto status
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto)
Active: active (running) since Sat 2021-07-03 02:20:34 UTC; 12h ago
CGroup: /system.slice/mosquitto.service
└─340 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Jul 03 02:20:33 beaglebone mosquitto[318]: Starting network daemon:: mosquitto.

After installing and launching the application, click on the “+” button to add a new connection. Fill in the connection name as BBGW. This name can be anything of your choice. Fill in the IP address of beaglebone green wireless board. Rest other details are not required to update, click on the “CREATE CONNECTION” button.

MQTT Lense Create connection for BBGW

This will create new connection with BBGW and if it is success MQTT Lense will show it as Connection established to 192.168.0.106. Here 192.168.0.106 is my BBGW IP address.

MQTT Lense Connection established to BBGW

Send And Receive Message

Now connection is successfully established to MQTT broker running on BBGW, I can send (publish) data to BBGW device. On BBGW side I have subscribed to “test” topic. From MQTT Lense send message on this topic. This will receive message to BBGW device side.

@beaglebone:~# mosquitto_sub -h localhost -t "test" -v
mosquitto received message on BBGW

To send data from BeagleBone Green Wireless device to MQTTLense, First MQTTLense should subscribe to topic from BBGW board. Here I have created new topic as “test_bbgw” on MQTTLense and click on subscribe. On BBGW side publish message on this topic.

beaglebone:~# mosquitto_pub -h localhost -t "test_bbgw" -m "testing from BBGW"
From BBGW to MqttLense

The message payload and topic can be complex, in this example I have used simple topic name and message payload. Now you are sure that your application modules setup works fine over mqtt. This method helps you to debug MQTT programs and test it. Hope you have enjoyed this post on BBGW And MQTT Broker Using Desktop.

How To Connect BBGW To Internet

This post covers getting started with Beaglebone Green Wireless and connecting to internet using BBGW Wi-Fi. Received BBGW (BeagleBone Green Wireless) a customized BeagleBone from SeeedStudio. If you have used BBB (BeagleBone Black) then you might notice few difference like there is no 5V DC Jack socket in BBGW. I had trouble connecting to internet from BBGW. Lets get started with How To Connect BBGW To Internet.

If you have LCD cape and USB keyboard, you can setup Wi-Fi easily on BBGW. Lets get started with setting up without LCD cape and using command line.

First Power Up BBGW

There are lot of guide on setting up BBGW via USB. It is pretty straightforward, connect the USB to your computer/laptop, It will boot Linux from onboard eMMC. Wait for some time to see Wi-Fi access point on Wi-Fi, it will appear as “BeagleBoneXXXXXX”. Connect to this Wi-Fi and you will get default page asking for SSID of your Wi-Fi and enter the password.

BeagleBone Green Wireless Setup

This will setup your BBGW. Note down the IP address from this page as you will require to ssh. The detailed steps are available at seedstudio wiki. So far it is good and all steps works as mentioned. Once you press “done” it will redirect to “support” page. On this page you can connect to your BBGW board and run LED blink program from the browser itself. Its pretty cool to use BoneScript provided by BBGW to try and test your LED blink program.

Connect To BBGW

Here will check different ways to connect to BBGW. I had connected using default steps. I had verified if BBGW is connected or not. It will show display at the top of the BeagleBoard page like this:

Connect using Cloud9 IDE – You can connect to BBGW using Cloud9 IDE as well, just type http://192.168.8.1:3000 and you are connected to BBGW.

Cloud9 connected to BBGW

Connect using SSH – From the previous section you can easily ssh to BBGW.

$ ssh root@192.168.0.106

Just hit enter, as there is no default password for root. If you are doing ssh using default. The default username:password is [debian:temppwd].

BeagleBone Green Wireless Connect To Internet

So far, everything went rather smoothly, but setting up networking was more of a challenge. Before we get into details, I have tried to upgrade flasher image to latest image.

My default image on BBGW is “BeagleBoard.org Debian Image 2016-06-14”. The command dog cat will tell you what image you are at in BBGW, “cat /etc/dogtag”. The default Wi-Fi access point password for latest flasher images is “BeagleBone”.

When I tried to run apt-get update

@beaglebone:~# sudo apt-get update
Ign http://security.debian.org jessie/updates InRelease
Ign https://deb.nodesource.com jessie InRelease
Ign http://repos.rcn-ee.com jessie InRelease
Ign http://httpredir.debian.org jessie InRelease
Ign http://httpredir.debian.org jessie-updates InRelease
Err http://security.debian.org jessie/updates Release.gpg
Unable to connect to security.debian.org:http:

It is saying “unable to connect to repos.rcn-ee.com. The next thing I tried is to ping “googl.com” but with no response.

@beaglebone:~# ping google.com
PING google.com (172.1.8.1) 56(84) bytes of data.
From 192.168.0.105 icmp_seq=1 Destination Host Unreachable
From 192.168.0.105 icmp_seq=2 Destination Host Unreachable
From 192.168.0.105 icmp_seq=3 Destination Host Unreachable

This start to google and verify network settings for BBGW. I had two options: change the routing table or route the traffic through my laptop. Wi-Fi settings can be verified using “connmanctl”.

connmanctl> enable wifi
Error wifi: Already enabled
connmanctl> scan wifi
Scan completed for wifi
connmanctl> services
*AO SARVESH              wifi_2cf7f106b7a1_53415256455348_managed_psk
Gowda                wifi_2cf7f106b7a1_476f776461_managed_psk
connmanctl> agent on
Agent registered
connmanctl> connect wifi_2cf7f106b7a1_53415256455348_managed_psk
Error /net/connman/service/wifi_2cf7f106b7a1_53415256455348_managed_psk: Already connected
connmanctl> quit

In order to route BBGW traffic via my laptop, I have updated Wi-Fi properties on my laptop to allow other network users to connect through my computer’s internet connection.

 cat /etc/resolv.conf
# Generated by Connection Manager
nameserver 0.0.0.0
nameserver 192.168.0.1
nameserver 8.8.8.8

This did not work well.

@beaglebone:~# ping google.com
PING google.com (172.1.8.1) 56(84) bytes of data.
From 192.168.0.105: icmp_seq=36 Redirect Network(New nexthop: 192.168.0.1)
From 192.168.0.105: icmp_seq=39 Redirect Network(New nexthop: 192.168.0.1)

Then next option is to change the routing table and add details in /etc/network/interfaces. I had edited interfaces file using vi.

auto wlan0
iface wlan0 inet static
address 192.168.0.222
netmask 255.255.255.0
gateway 192.168.0.1
wpa-ssid {ssid}
wpa-psk {password}

Here I had specified static IP to the BBGW so that, I can easily SSH to BBGW. With this change most of the things broken and now I am not able to ping to BBGW also. It is not showing IP address on the start page now.

It just says, board is ready and can’t display my Wi-Fi access point. This point I can’t ping to previous board IP. But there is workaround for this and you can do SSH using SoftAp0 IP. SSH to the BBGW using SoftAp0 and revert back the changes in /etc/network/interfaces file.

$ ssh root@192.168.8.1

Now both the methods have failed so we had contacted IRC channel (#beagle). The problem seems to be with nameserver.

root@beaglebone:~# connmanctl state
State = online
OfflineMode = False
SessionMode = False
root@beaglebone:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether e4:15:f6:fd:a4:91 brd ff:ff:ff:ff:ff:ff
inet 192.168.7.2/24 brd 192.168.7.255 scope global usb0
valid_lft forever preferred_lft forever
inet6 fe80::e615:f6ff:fefd:a491/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 2c:f7:f1:06:b7:a1 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.106/24 brd 192.168.0.255 scope global wlan0
valid_lft forever preferred_lft forever
inet6 fe80::2ef7:f1ff:fe06:b7a1/64 scope link
valid_lft forever preferred_lft forever
4: SoftAp0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e4:15:f6:fd:a4:90 brd ff:ff:ff:ff:ff:ff
inet 192.168.8.1/24 brd 192.168.8.255 scope global SoftAp0
valid_lft forever preferred_lft forever
inet6 fe80::e615:f6ff:fefd:a490/64 scope link
valid_lft forever preferred_lft forever
root@beaglebone:~# ip route
0.0.0.0 via 192.168.0.1 dev wlan0
default via 192.168.0.1 dev wlan0
192.168.0.0/24 dev wlan0  proto kernel  scope link  src 192.168.0.106
192.168.0.1 dev wlan0  scope link
192.168.7.0/24 dev usb0  proto kernel  scope link  src 192.168.7.2
192.168.8.0/24 dev SoftAp0  proto kernel  scope link  src 192.168.8.1
root@beaglebone:~# cat /etc/resolv.conf
# Generated by Connection Manager
nameserver 0.0.0.0
nameserver 192.168.0.1

The router (TP-Link) is telling the BeagleBone that the nameservers are “0.0.0.0” and “192.168.0.1”. The other devices in network connects to next nameserver when “0.0.0.0” is not reachable. This is not working in case of BBGW as somehow “0.0.0.0” isn’t reachable and BBGW is not trying to the next dns server.

The solution is to set the nameserver for BBGW. This will be done using “connmanctl config SERVICE nameservers 192.168.0.1. Here SERVICE is the name of your Wi-Fi connection, shown by “connmanctl services” (in the right column)

connmanctl> services
*AO SARVESH              wifi_2cf7f106b7a1_53415256455348_managed_psk
connmanctl> config wifi_2cf7f106b7a1_53415256455348_managed_psk nameservers 192.168.0.1
connmanctl> exit
root@beaglebone:~# ping google.com
PING google.com (142.250.67.238) 56(84) bytes of data.
64 bytes from bom07s24-in-f14.1e100.net (142.250.67.238): icmp_seq=1 ttl=116 tim

This shows updated nameserver entries in “/etc/resolv.conf” file.

@beaglebone:~#  cat /etc/resolv.conf
# Generated by Connection Manager
nameserver 192.168.0.1

With this I am able to finally run apt-get update on my BeagleBone Green Wireless board. Hope you have enjoyed this How To Connect BBGW To Internet short guide.

You can connect your BBGW using “ssh debian@beaglebone” and/or “ssh debian@beaglebone.local”, Enter password as “debian:temppwd”. if you use multiple beaglebones, be sure to give them individual hostnames with “ sudo hostnamectl set-hostname HOSTNAME ” (replace HOSTNAME by the desired name for the beaglebone).

systemctl status $(pidof gpsd)