Raspberry Pi 3 Model B/B+ Raspbian images

Board description

The Raspberry Pi 3 Model B/B+ is a popular single board computer based on Broadcom SoCs. It is the most powerful board within the Raspberry Pi family and probably the most popular with “makers”.

770A5842-462x322

URL: https://www.raspberrypi.org/products/raspberry-pi-3-model-b-plus
URL: https://www.raspberrypi.org/products/raspberry-pi-3-model-b
Wiki: https://elinux.org/RPi_Hub

Image downloads

The Raspbian images in the table below come with Mender integrated.

Release Size (uncompressed) Size (compressed) SHA-256
Raspbian Stretch Lite 2019-04-08 7.9 GB 367 MB d310b701eecded461ba6ac8f0ea7a649ded9750c2df0aceba05ba43528b097e4

These images are created by using an official Raspbian release and integrating them by following the Raspberry Pi 3 Model B/B+ Raspbian topic.

Getting started

The following steps will take you through setting up your Raspberry Pi with support for over-the-air updates using the Mender client and server.

Prerequisites

Download your desired image

Note that you might need to adjust the commands below to your desired image file name.

From the table above, download your desired Raspbian image with Mender integrated:

wget https://d1b0l86ne08fsf.cloudfront.net/raspbian-images/2019-04-08-raspbian-stretch-lite-mender.zip

Next, extract it:

unzip 2019-04-08-raspbian-stretch-lite-mender.zip

Configure your Mender server

First download mender-artifact to your laptop/workstation and make it executable.

If you are using Linux:

wget https://d1b0l86ne08fsf.cloudfront.net/mender-artifact/3.2.0/linux/mender-artifact
chmod +x mender-artifact
sudo cp mender-artifact /usr/local/bin/mender-artifact

If you are using Mac:

wget https://d1b0l86ne08fsf.cloudfront.net/mender-artifact/3.2.0/darwin/mender-artifact
chmod +x mender-artifact
sudo cp mender-artifact /usr/local/bin/mender-artifact

To save time, it is recommended to use Hosted Mender as your Mender server. If you want to use a self-hosted Mender server, use the --server-uri option to mender-artifact below instead of --tenant-token.

Log in to Hosted Mender, go to the My organization page, under Token, click COPY TO CLIPBOARD.

Next, paste the tenant token into a shell variable with this command

TENANT_TOKEN= # PASTE HERE (SHIFT + INSERT)

Run the following command to set your tenant token in the Raspbian image:

mender-artifact modify --tenant-token $TENANT_TOKEN 2019-04-08-raspbian-stretch-lite-mender.img

Note that this may take about 10 minutes to complete as we are modifying a large image.

Boot from the SD card and connect to your Mender server

Ensure your device has Internet connectivity (e.g. through Ethernet cable with DHCP support).

After provisioning a SD card with the configured disk image above, boot your device from it.

Now go to the Pending devices in Hosted Mender. After a minute or two your device should show up. Simply Accept your device.

After another minute your device information should populate and your device is now ready to receive software updates!

Create update Artifacts

In Mender the software updates are packaged as Mender Artifact files.

The disk images used here support both full system (OS) updates, as well as application updates.

It is easier to generate application updates, and for this purpose you can use any of the existing Update Modules with Mender.

Deploy a new directory

We will use the Directory Update Module as an example. This Update Module is already installed in the images. The steps below are an excerpt from the Directory Update Module tutorial, refer there for more information.

On your workstation/laptop, download directory-artifact-gen into the same directory as mender-artifact above, by running the following command:

wget https://raw.githubusercontent.com/mendersoftware/mender/master/support/modules-artifact-gen/directory-artifact-gen

Make it executable:

chmod +x directory-artifact-gen

Create a two simple applications to deploy:

mkdir dir-to-deploy
echo 'print("Hello from app1!")' > dir-to-deploy/app1.py
echo 'print("Hello from app2!")' > dir-to-deploy/app2.py

Now generate a Mender Artifact using the following command:

ARTIFACT_NAME="my-update-1.0"
DEVICE_TYPE="raspberrypi3"
OUTPUT_PATH="my-update-1.0.mender"
SRC_DIR="dir-to-deploy"
DEST_DIR="/opt/installed-by-mender/"

./directory-artifact-gen -n ${ARTIFACT_NAME} -t ${DEVICE_TYPE} -d ${DEST_DIR} -o ${OUTPUT_PATH} ${SRC_DIR}

You should now have the Mender Artifact my-update-1.0.mender! For testing it contains two files (app1.py and app2.py) that will be deployed to /opt/installed-by-mender/ on the device, but this can easily be changed by adjusting SRC_DIR and DEST_DIR above.

Deploy the Artifact

Now that the device is connected and the Artifact is created, the remaining steps are to upload and deploy it.

Go to Releases in Hosted Mender and click browse on the top right. Navigate to the file my-update-1.0.mender you created above and upload it.

Next, go to Deployments and click Create a deployment. Select your Release, and All devices, as shown below.

create-deployment

It will start as pending and after a minute or two, the deployment should be successful. You can then see it under the finished deployments tab.

To verify your device has been updated, go to log in to your device and run the following commands:

ls -l /opt/installed-by-mender/
python3 /opt/installed-by-mender/app1.py
python3 /opt/installed-by-mender/app2.py

Congratulations, you have now completed your first OTA update with Mender!

You can now deploy your own application and files by executing the ./directory-artifact-gen command again above to build another Mender Artifact, and read more about this Update Module at the Directory Update Module topic. Also take a look at the other Update Modules available if you want to deploy applications packaged in other formats like Docker images or .deb packages.

Deploy system updates

On the other hand, if you want to create a full system (OS) update Artifact, follow the steps in Raspberry Pi 3 Model B/B+ Raspbian topic.

4 posts were split to a new topic: Issue with generating artifact when using Raspbian Images