Software updates for embedded Linux on a fleet of devices – here is How

This is something you may come across as a developer, as well as a project manager of a “smart” product that is running Linux inside. The ability to deploy software updates certainly making us confident about moving to the production stage even though the product software is still not 100% stable. Or even if you still thinking about other important features you would like to add to your software on the road map. In a utopian world, we would probably want to mirror our Linux devices that are running in the field, far away from home, to have a full hands access to change, debug, upgrade or check the product application software the same as when they are in our lab.

Well, this is what we did, here at JFrog Connect. Our vision was to ease on the product developers by providing them the best remote management and maintenance tools right out of the box, zero integrations, no special environments and it doesn’t matter who you are and what your application is doing. JFrog Connect is just a lightweight software agent that is running independently as a service on your product operating system, separately from your application. This is the real magic. As part of JFrog Connect vision, you, the developer, should be focused only on the application development, and definitely not wasting your time thinking about how you are going to maintain your products when they are shipped at the production stage.

Let’s talk about software updates

A software update has to be small, quick and with minimal downtime. In today’s agile era we are constantly making a lot of small changes – fixing bugs, changing several lines of code or just installing new packages. Those software components are small and have to remain small when they are deployed on the product over-the-air.

The micro update tool makes this possible. Providing a nice and elegant way to deploy small, yet important software changes and patches to the running software out there in the field.

How can I deploy a micro update?Let’s start by saying – there is no learning curve here at all, no “new kind” of language or something you will not understand immediately. The next few steps will show you how to update your device software remotely. You will be able to deploy files, directories, run bash commands and even install software packages, in less than 3 minutes.*Before we start, make sure to open a free account at JFrog Connect and connect your Linux based device to the dashboard (JFrog Connect agent support any type of hardware architecture so you should not worry about that).

Step 1 – Who is this micro update for?

Looking at the ‘Devices’ category we can choose on which devices we would like to deploy the micro update. It can be a group or a specific device.

Let’s go with the entire group called Version1.0. What will happen if the device named ‘Yocto’ which is now turned off will power up? well, when the JFrog Connect agent will start to communicate with JFrog Connect servers, the ‘Yocto’ device will immediately receive and deploy the new micro updates one by one as much as exists – simple as that.

Step 2 – Creating a new micro update, fill the general details

Clicking on the ‘Micro Updates’ category, and moving to the ‘Create New Micro Update’ tab will open a new recipe for creating a micro update. As we chose in the first step, the ‘Apply micro update on’ parameter needs to be set to the group ‘Version1.0’ on all of the group devices.

Next, choose a name for the micro update version and a comment that will help understand what was this specific micro update all about.

We can also apply micro updates on specific devices, or on all the devices from a group which their last micro update finished with a fail or success state.

Step 3 –  Before the update

This may be one of the most important parts for those who want to upgrade a running application.

Before replacing files, installing new packages or doing anything else, here is a great opportunity to prepare our devices for those changes that are about to come.

Using the ‘Execute before update’ parameter you are able to run any Linux bash command before the update begins. In this example, we will stop a running service called ‘MyApp’, in order to replace the code to a newer version of that service.

We can also run a Bash script in case there are multiple things we would like to execute before starting this update deployment.

Step 4 – Transfer new files, directories, and install new packages

My running software application is placed inside the directory ‘/home/MyApp’. By uploading the directory ‘MyApp’ with the new code to the same path of ‘/home’, JFrog Connect agent will automatically replace the old directory with the new one.

The same works for files. When we change the config file ‘MyApp_config_file.conf’, if the file already exists in the path ‘/lib/’, the agent will automatically replace the file with the new one.

Next, installing new packages can be done using the currently supported package managers: apt, pip, pip3, and npm. If a package version is not filled, JFrog Connect agent automatically takes the newest version available.

Step 5 – After the update

After making the relevant upgrades and patches to our application, it’s time to bring the application back to work and finish our micro update deployment. We will start our application service called ‘MyApp’ which we have stopped at stage 3.

Also, there is an option to reboot the device when the micro update deployment finishes.

Step 6 – What if something goes wrong?

The micro update may fail due to many kinds of reasons, such as running a bash command which returned an error, the installation of a package failed or something else has occurred that wasn’t planned.

Using the Rollback functionality our devices will restore to their previous state if something went wrong.

By setting ‘Revert Uploaded Files’ to True, we ensure that when the Rollback mechanism is triggered, the device will restore the changes that have been made and remove or replace the needed files to the previous files before the micro update began. Moreover, there is an option to choose a directory that we would like to restore even though nothing uploaded to it – just to make sure this directory will be the same as before the micro update deployment started. In addition, there are a few more options like Reverting Dependencies (packages that have been installed or updated), running a Bash command and rebooting the device.

Step 7 – Deploy the micro update and view the progress!

Let’s deploy our micro update by clicking on ‘Deploy update’. Immediately, the entire update will build and begin rolling out over the internet to the devices we have chosen at stage 2.

Click on ‘Deployment status’ to view the progress of the micro update on the devices. You will probably notice right away that it is deployed extremely fast.

Congrats! You have just deployed your first over-the-air (OTA) software micro update on your Linux based products.

This was just a taste from JFrog Connect remote management and maintenance tools. You are more than welcome to explore other great tools that JFrog Connect provides as part of its platform such as Remote Control, Data Monitor, Processes Monitor and more, all available through JFrog Connect dashboard.

JFrog Connect is a modern Linux-first IoT platform designed to efficiently update, control and monitor edge and IoT devices at scale.