# How to track BalenaOS update from the container

**URL:** <https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805>\
**Category:** balenaOS\
**Created:** [August 4, 2021, 6:03pm UTC](https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805 "2021-08-04T18:03:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jchoate2](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@jchoate2](https://forums.balena.io/u/jchoate2)\
**Post date:** [August 4, 2021, 6:03pm UTC](https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805/1 "2021-08-04T18:03:58Z")

</div>

I want to be able to inform our user that the device is updating the OS so they don’t power off the device or try to do work with it during the process. I am able to query for the OS update status by calling [https://actions.balena-devices.com/v1/${RESIN\_DEVICE\_UUID}/resinhup](https://actions.balena-devices.com/v1/%24%7BRESIN_DEVICE_UUID%7D/resinhup). But I want to be able to track the % downloaded of the update and also the install progress after the reboot. Are there API calls that can give me this info?

---

<div class="post-metadata">

**Author:** ![markcorbinuk](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/markcorbinuk/32/4771_2.png) [@markcorbinuk](https://forums.balena.io/u/markcorbinuk)\
**Post date:** [August 5, 2021, 3:28pm UTC](https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805/2 "2021-08-05T15:28:35Z")

</div>

Hello @jchoate2

You can use the supervisor API to track the progress of a download for a device from within a container. Please see the documentation [here](https://www.balena.io/docs/reference/supervisor/supervisor-api/#get-v1device)

---

<div class="post-metadata">

**Author:** ![jchoate2](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@jchoate2](https://forums.balena.io/u/jchoate2)\
**Post date:** [August 5, 2021, 3:42pm UTC](https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805/4 "2021-08-05T15:42:44Z")

</div>

Thanks! I had looked at that, but based on the documentation it looked like that was only for container updates. This will also report progress for OS updates?

---

<div class="post-metadata">

**Author:** ![markcorbinuk](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/markcorbinuk/32/4771_2.png) [@markcorbinuk](https://forums.balena.io/u/markcorbinuk)\
**Post date:** [August 5, 2021, 3:52pm UTC](https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805/5 "2021-08-05T15:52:55Z")

</div>

I’ll check that with our supervisor developers.

---

<div class="post-metadata">

**Author:** ![thgreasi](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/thgreasi/32/454_2.png) [@thgreasi](https://forums.balena.io/u/thgreasi)\
**Post date:** [August 5, 2021, 4:45pm UTC](https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805/9 "2021-08-05T16:45:14Z")

</div>

Hi,  
You can get the overall status and progress from the balenaCloud backend by doing the following curl request:

```auto
curl "https://api.balena-cloud.com/v6/device(uuid='$DEVICE_UUID')?\$select=overall_status,overall_progress" \
  -H 'authorization: Bearer <TOKEN>'

```

The overall\_status & overall\_progress fields hold the values that our balenaCloud dashboard presents in the device status column, which also includes application updates etc  
But while the device is updating its hostOS it will only hold related descriptions & related hostOS update progress.  
A side note if you have used our backend api before, is that those two fields are not included in the result, unless they are explicitly provided in the $select part of the request.

Let us know how it works for you.

Kind regards,  
Thodoris

---

<div class="post-metadata">

**Author:** ![jchoate2](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@jchoate2](https://forums.balena.io/u/jchoate2)\
**Post date:** [August 5, 2021, 5:18pm UTC](https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805/10 "2021-08-05T17:18:03Z")

</div>

This is perfect! One last question if I may - is there documentation on the possible values for status? I’ve seen ‘idle’ and ‘in\_progress’ but wonder what the other possibilities are.

---

<div class="post-metadata">

**Author:** ![mehalter](https://avatars.discourse-cdn.com/v4/letter/m/b5a626/32.png) [@mehalter](https://forums.balena.io/u/mehalter)\
**Post date:** [August 5, 2021, 5:48pm UTC](https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805/11 "2021-08-05T17:48:20Z")

</div>

Hi Jon, I have looked into this and there is not documentation currently on the possible values for Host OS update statuses. But I have found the relevant lines in the Balena SDK that defines there. The possible values are ‘idle’, ‘in\_progress’, ‘done’, ‘error’, and ‘configuring’. Here is also a link to the relevant lines in the source code:

> <https://github.com/balena-io/balena-sdk/blob/583de4f4105c5161c5e5f40a2f90e8d959a726ff/lib/util/device-actions/os-update/index.ts#L8>

---

<div class="post-metadata">

**Author:** ![g\_jon\_choate](https://avatars.discourse-cdn.com/v4/letter/g/7ba0ec/32.png) [@g\_jon\_choate](https://forums.balena.io/u/g_jon_choate)\
**Post date:** [August 6, 2021, 2:40pm UTC](https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805/12 "2021-08-06T14:40:22Z")

</div>

Hmm… I ran the following script and then ran an OS update since I wanted to compare checking with the API vs. checking with the supervisor. Unfortunately I got this output:

```auto
2021-08-06 10:25:57 server percent: null
2021-08-06 10:25:57 supervisor percent: null

```

Here is the script I ran. Can you see any issue with it?

```auto
#!/usr/bin/env bash

while true; do
  SERVER_STATUS=$(curl --silent "$BALENA_API_URL/v6/device(uuid='$BALENA_DEVICE_UUID')?\$select=overall_progress" -H "Authorization: Bearer ${BALENA_API_KEY}" | jq '.overall_progress')
  SUPERVISOR_STATUS=$(curl --silent -X GET --header "Content-Type:application/json" "$BALENA_SUPERVISOR_ADDRESS/v1/device?apikey=$BALENA_SUPERVISOR_API_KEY" | jq '.download_progress')
  echo "$(date "+%Y-%m-%d %H:%M:%S") server percent: $SERVER_STATUS" >> /data/progress.log
  echo "$(date "+%Y-%m-%d %H:%M:%S") supervisor percent: $SUPERVISOR_STATUS" >> /data/progress.log
  sleep 5
done

```

thanks again!

---

<div class="post-metadata">

**Author:** ![klutchell](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/klutchell/32/861_2.png) [@klutchell](https://forums.balena.io/u/klutchell)\
**Post date:** [August 23, 2021, 7:37pm UTC](https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805/13 "2021-08-23T19:37:15Z")

</div>

Hey @g-jon-choate, I don’t see any issues with your script upon first glance, but it might be worth adding `set -x` before your while loop to see if the expected vars are set correctly?

---

<div class="post-metadata">

**Author:** ![klutchell](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/klutchell/32/861_2.png) [@klutchell](https://forums.balena.io/u/klutchell)\
**Post date:** [August 31, 2021, 6:48pm UTC](https://forums.balena.io/t/how-to-track-balenaos-update-from-the-container/342805/15 "2021-08-31T18:48:37Z")

</div>

Did you make any progress with this script? Let us know how it went!
