• +49 (0) 7154 1553915
  • contact@devomech.com

Raspberry Pi OS, formerly Raspbian, is a free operating system based on Debian, optimized for the Raspberry Pi hardware. It provides a robust, flexible platform for all development, from beginners to professional developers. Raspberry Pi OS comes with over 35,000 packages, pre-compiled software bundled in a nice format for easy installation on your Raspberry Pi.

IoT device management requires a regular update that is crucial for maintaining security, adding new features, and improving performance. Regular updates help to protect your devices from the latest security threats, fix bugs, and add new features that can improve the functionality and performance of your devices. Device management allows you to monitor, manage, and control your devices remotely, making it easier to manage large fleets of devices.

Mender is an open-source over-the-air (OTA) software updater for embedded Linux devices. It provides robust and secure software updates with a focus on ease of use, customization, and reliability. Mender supports both application and system updates, providing a comprehensive update solution. It also supports different update strategies, such as A/B updates and application updates, giving you the flexibility to choose the best strategy for your needs.

Hardware Requirements

  •   Raspberry Pi board (model 3 or newer recommended)
  •   SD card (16 GB Class 10 recommended)
  •   Power supply (5V/2.5A DC power input)

Software Requirements

Latest Raspberry Pi OS

Raspberry Pi OS is the official operating system for the Raspberry Pi. It’s based on Debian and comes pre-loaded with useful software and tools.

Mender software (client and server) 

The Mender client is a daemon that runs on your devices, communicating with the Mender server for updates and reporting the status of deployments. The Mender server is the central component of the Mender system, managing deployments, keeping track of devices and their update status, and storing update artifacts.

Development tools

These tools are used for interacting with your Raspberry Pi and Mender software. SSH (Secure Shell) is a protocol for securely accessing one computer from another, while a terminal emulator lets you access the command line interface from your desktop environment.

Setting Up Raspberry Pi OS

Downloading and Installing Raspberry Pi OS

You can download the latest version of Raspberry Pi OS from the official Raspberry Pi website. After downloading, use a tool like balenaEtcher to flash the image onto your SD card. BalenaEtcher is a free and open-source image burner with support for Windows, macOS, and Linux. It’s easy to use, just select the image file, select the drive, and start the flashing process.

Initial Configuration

After installing the OS, you’ll need to perform some initial configuration tasks:

Expanding the filesystem 

Use the raspi-config tool to expand the filesystem to use all the space on the SD card. This is important because, by default, the Raspberry Pi image only uses a small amount of the space on the SD card. Expanding the filesystem will allow you to use all the available space.

Setting up the Network 

Connect your Raspberry Pi to your network using either an Ethernet cable or by setting up Wi-Fi. You can set up Wi-Fi by clicking on the network icon in the taskbar and selecting your network.

Updating the OS 

Use the sudo apt update and sudo apt upgrade commands to update your OS to the latest version. This is important to ensure that you have the latest security patches and software updates.

Installing Mender Client on Raspberry Pi OS

Mender Client

The Mender Client is a user-space Linux that runs on your devices. It communicates with the Mender Server for updates and reports the status of deployments. The Mender Client is responsible for detecting available updates, downloading them, performing the update, and reporting the status of the update back to the Mender Server.

Downloading and Installing Mender Client

You can download the Mender Client from the Mender website. After downloading, install it using the dpkg command. The dpkg command is a package manager for Debian-based systems. It can install, remove, and provide information about .deb packages.

Configuring the Mender Client

After installation, you’ll need to configure the Mender Client:

Editing Configuration Files

Edit the mender.conf file to specify your Mender Server’s IP address and other settings. The mender.conf file is the main configuration file for the Mender Client. It defines the server URL, polling intervals, and other settings.

Setting Up Authentication Keys 

Generate and install a key pair for secure communication with the Mender Server. The Mender Client uses RSA keys to authenticate with the Mender Server. You can generate a key pair using the openssl command.

Testing Mender Client Installation

After configuration, test the Mender Client by running the Mender command. If everything is set up correctly, it should connect to the Mender Server and report its status. The mender command allows you to manually control the Mender Client for testing and debugging.

Configuring Mender Server for Raspberry Pi

The Mender Server is the central component of the Mender system. It manages deployments, keeps track of devices and their update status, and stores update artifacts. The Mender Server provides a web interface for managing devices and deployments, and a REST API for automating tasks and integrating with other systems.

Setting Up Mender Server

You can set up a Mender Server using the hosted Mender service or running your server. The hosted service is the easiest way to start, but running your server gives you more control.

Cloud-hosted Mender 

Cloud Hosted Mender is a secure server hosted by Mender, so you don’t have to spend time maintaining scalability, security, certificates, uptime, upgrades, and compatibility of the Mender Server.

Self-hosted Mender 

If you prefer to host your own Mender Server, you will run your networks and be responsible for the maintenance and uptime. You can download the Mender Server source code from the Mender GitHub repository and follow the instructions in the Mender documentation to set it up.

Connecting Raspberry Pi to Mender Server

After setting up the Mender Server, you’ll need to connect your Raspberry Pi to it:

  • When the Mender Client on the Raspberry Pi connects to the Mender Server for the first time, it will automatically register itself.
  • Check the Mender Server’s web interface to see if your device is listed.

Creating and Deploying Updates

Creating Update Artifacts

To create an update, you’ll need to prepare an updated image of your system and then use the mender-artifact tool to create a Mender Artifact:

Make the changes you want on a running system, then use the dd command to create an image of the system. Use the mender-artifact tool to sign the artifact with your private key.

Deploying Updates Using Mender

Use the Mender Server’s web interface to upload the artifact. In the Mender Server’s web interface, create a new deployment and select the devices to update.

Monitoring and Verifying Update Deployment

After starting a deployment, you can monitor its progress in the Mender Server’s web interface. When the deployment is finished, you can verify that the update was successful by checking the updated system. 

Advanced Configuration and Optimization

Customizing Mender Client

You can customize the Mender Client’s behavior by editing its configuration file. For example, you can configure how often the client checks for updates and how it handles rollbacks.

Enhancing Security

Mender provides several features to enhance security, such as secure communication channels and device authentication. Make sure to use these features to keep your devices secure.

Performance Tuning

You can optimize the performance of the Mender system by adjusting network settings and reducing the size and frequency of updates.

Troubleshooting and Support

Common Issues and Solutions

If you encounter problems, check the Mender documentation and community forums for solutions. Some Common Issues are listed below:

Connectivity Problems

If your device cannot connect to the Mender Server, check the network settings and the Mender Client configuration. Make sure that the device has a network connection and that the Mender Server’s IP address is correctly configured in the Mender Client.

Update Failures 

If an update fails, check the deployment logs in the Mender Server’s web interface. The logs can provide clues about what went wrong. Common causes of update failures include insufficient disk space, network errors, and incorrect update artifacts.

Accessing Support Resources

The Mender community is a great resource for getting help and learning more about Mender. Check out the Mender documentation, community forums, and help pages for more information.

Conclusion

We have covered how to set up Raspberry Pi OS for Mender integration, from initial setup to advanced configuration and troubleshooting. With the continued development of both Mender and Raspberry Pi, we can expect even better integration and more powerful features in the future. As more devices become connected, the importance of secure, reliable, and efficient software updates will only increase. We encourage you to share your experiences and participate in the Mender community. Your feedback and contributions can help make Mender even better.