Check balenaOS update status from within device

Is there a way to query the status of a balenaOS update from within a device? I’d like to wait until the update completes before starting up some sensitive processes. We already are using supervisor endpoints/update locking to handle container updates but was wondering if some sort of check exists for balenaOS updates. Looking at the SDK code, I didn’t see any obvious endpoints to send requests to within the device. I was trying to avoid sending requests back to the Balena API. Thanks!

Hello, apologies for the late response. Your application is not started until the OS update is completely done and the device booted – isn’t that what you observe?

Not a problem, thanks for responding. From what I understand there seems to be a few phases during an OS update.

  1. First the new version is downloaded
  2. Then the supervisor is upgraded
  3. Then the device reboots.

Between steps 1 and 2, our services are running as usual. I’d like to have one of my services check if there is an OS update in progress while it is running. With this knowledge, the service can decide whether to enable/disable certain functions that can’t finish in time before a reboot. We currently monitor service updates and use update locking to delay updates until these functions finish.

Apologies if my understanding of how the OS update process works is incorrect.

Thanks!

Not very long ago, the API / SDK added support for querying a host OS update status, or even to allow your app to trigger a host OS update at a convenient time:

Node.js SDK

Python SDK

Also have a look at the following docs that provided an overview of the OS update flow:

According to those docs, the supervisor is not actually upgraded before the OS, but rather stopped before Docker images of the new OS are downloaded. The fact that the supervisor is stopped before the download does not prevent your app from using the API / SDK to query the OS update status, as those do not involve the supervisor. Your app would not be able to use the supervisor API by querying the local supervisor endpoint, though.

Check if the pointers above are helpful, and feel free to ask further questions!

1 Like

Great, I think that this is something that we can do. I should have explained a little bit better, but I was thinking there might be something like GET /v1/device but with the OS update status is also included. Thanks for the help!

Hey @ejohnso49 unfortunately the OS update information is not available on the device endpoint directly, the SDK still talks to the API to fetch this info, only its a bit more involved. If you have the chance to use the SDK then thats definitely the best option for this, otherwise let us know and we can look into fetching this from the API directly. I also want to add that we plan to eventually unify the application and OS update info that we return from the API/supervisor, but first we have to transition the OS updates to be managed by the supervisor directly.

1 Like