# Remote OS upgrade of custom host image possible?

**URL:** <https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636>\
**Category:** Product support\
**Created:** [March 15, 2019, 10:33am UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636 "2019-03-15T10:33:06Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeterKAlvin](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@PeterKAlvin](https://forums.balena.io/u/PeterKAlvin)\
**Post date:** [March 15, 2019, 10:33am UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/1 "2019-03-15T10:33:06Z")

</div>

Hey Guys!

If we create a custom host OS image using Yocto for Rapsberry, is there any possibility to update to OS remotely just like any stock BalenaOS available on the dashboard?

We welcome any solution or idea. Even if we have to run some kind of service on our cloud servers.

Thanks  
Peter

---

<div class="post-metadata">

**Author:** ![pdcastro](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pdcastro/32/1264_2.png) [@pdcastro](https://forums.balena.io/u/pdcastro)\
**Post date:** [March 16, 2019, 10:42am UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/5 "2019-03-16T10:42:57Z")

</div>

Hi there. I will rely on colleagues to fully answer your question, but I wanted to clarify a couple of things:

- When you say _“just like any stock BalenaOS available on the dashboard,”_ is it a requirement for your custom host OS image to appear as an entry in the dashboard dropdown box that lists the available OS versions to upgrade to?

- Are you using, or aware of the [openBalena](https://www.balena.io/open/) project? I am not clear if using openBalena would make it any easier (or harder) to achieve what you intend, but it’s certainly good to be aware of the project. I’ve found this openBalena forum thread that indicates how to perform a host OS upgrade: [Roadmap for BalenaOS Updates in OpenBalena](https://forums.balena.io/t/roadmap-for-balenaos-updates-in-openbalena/4537)  
The [hostapp-update](https://github.com/balena-os/meta-balena/blob/master/meta-resin-common/recipes-containers/hostapp-update/files/hostapp-update) script runs `balena pull "$HOSTAPP_IMAGE"` and I reckon that if it came to it, you could update that script to pull your custom OS image from a different docker repository.

---

<div class="post-metadata">

**Author:** ![PeterKAlvin](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@PeterKAlvin](https://forums.balena.io/u/PeterKAlvin)\
**Post date:** [March 20, 2019, 7:19am UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/10 "2019-03-20T07:19:55Z")

</div>

Hello @pdcastro

Thanks for you reply. Basically we want to use your cloud service entirely, but the images we use for flashing the NUC device must be customised. So basically we will build this repo ourselves: [https://github.com/balena-os/balena-intel](https://github.com/balena-os/balena-intel)

Flashing our custom image on a NUC device is okay, we can do that, but how can we do remote OS upgrades using your cloud service?

Thanks  
Peter

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [March 22, 2019, 4:03pm UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/17 "2019-03-22T16:03:07Z")

</div>

Hey @PeterKAlvin it is not currently set up to have easy updates for custom OS images. It’s possible, but require manual work on your side, and more care if you are doing things differently.

Please also note, that this is not a supported way, and can change in the future without much if any advance notice. We are working on multiple angles on the host OS updates, and thus lot can be different further down the line! Having said that, here’s some usage notes:

### Custom OS updates

The main repository is [https://github.com/balena-os/resinhup](https://github.com/balena-os/resinhup)

The updater script run on the device is `upgrade-2.x.sh`, and the remote update  
is done by `upgrade-ssh-2.x.sh` that invokes the above script on the device, and  
supports providing the right parameters for these devices.

It is using regular ssh setup to connect to the device and run the script (we are  
investigating, but not done with transitioning this to balena CLI as well).

For the ssh configuration, you likely need to add a setting in your `.ssh/config`  
for the right domain to reach the Balena devices. For balenaCloud, the setting is  
this below, where you need to add your username, and the identityfile (for which  
you’ve set the ssh public key in the balenaCloud dashboard):

```auto
Host balenadevice
  User <USERNAME>
  Hostname ssh.balena-devices.com
  LogLevel ERROR
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  ControlMaster no
  IdentityFile <PATH TO YOUR IDENTITYFILE>

```

You can test whether your setup is correct by running a connection to a specific  
device / UUID with:

```auto
ssh -t balenadevice host <UUID>

```

where you replace `<UUID>` with the device’s UUID, naturally. This requires the  
VPN connectivity enabled on the device, as it goes through the balenaCloud backend.

If that works, the OS update can be done with a command line like this:

```auto
./upgrade-ssh-2.x.sh \
   -s balenadevice \
   --hostos-version 2.31.2+rev1 \
   --resinos-repo resin/resinos \
   --resinos-tag 2.31.2_rev1-intel-nuc \
-u <UUID1> \
-u <UUID2> \
...

```

Here above:

- `-s balenadevice` sets which host to connect to, should be the same as you set in `.ssh/config` in the earlier set (can use any name you like, as long as you use the same here and there)
- `--hostos-version` is required, and have to follow this format as above, `2.31.2+rev1` for example
- `-u <UUID>` are the list of UUIDs to update, can add as many as you like

Just these parameters are necessary above, and then it would update from [resin/resinos](https://hub.docker.com/r/resin/resinos/tags) Docker Hub repository, and would find the relevant tag by the host OS version and device slug automatically.

The other parameters are possibly required because it’s a “custom” update and depend on your way of doing things.

If you use your own image, have to use:

- `--resinos-repo resin/resinos` is the Docker repository to pull the update image from, (more info below), and can modify it to your own. Needs to be a public repository.
- `--resinos-tag 2.31.2_rev1-intel-nuc` sets the tag of the image to pull for the update. The tag can be anything in this case, we usually follow a convention of the same tag structure as the regular updates, that is `VERSION-SLUG`, where in `VERSION` the `+` is replaced by `_` due to Docker registry limitations. For the NUC the device slug is `intel-nuc`.

If your device’s slug (the `SLUG` value in `/etc/os-release` in the final image) is a custom one, not `intel-nuc`, then have to customize this.

- as mentioned above, can use any tag for `--resinos-tag`, as it is meaningful for you
- `--force-slug intel-nuc` internally forces the slug to be the same as the device is currently  
masquerading itself. Required to make proper decisions on e.g. supervisor updates internally. Use the slug the device type that your device’s are using in the dashboard.
- `--assume-supported` and `--ignore-sanity-checks` also relaxes the checks that are done by  
the updater, and by default safeguards regular updates.

You can see more of the options, and maybe more info by running `./upgrade-ssh-2.x.sh --help` and `./upgrade-2.x.sh --help` for the list of parameters.

To add your own image from a build that you do:

- You can create your own Docker repository on [DockerHub](https://hub.docker.com/),  
let’s call it `my/balenaos` here.
- From the yocto compilation you will get a docker image (not sure what the filename would be, but I think somethign `.docker`. Load it into docker: `docker load -i <FILENAME>`, which will give a hash value, something like `SHA256:111111...`
- Retag it in docker, using the repository name, the version, and slug you have, for example:  
`docker tag <HASH> my/balenaos:X.Y.Z_revW-slug` Naturally as mentioned above, you  
can use anything else instead of `X.Y.Z_revW-slug`, as long as you are clear what it is.
- Push the image to Docker Hub: `docker push my/balenaos:X.Y.Z_revW-slug`, and thus  
you are ready to use this image in an update with the script above.

Also have to make sure, that the `balena-supervisor` version is not modified in your image’s `meta-balena` layers, as the update will only go to supervisors that are released to our API, and the version set there are released.

This should give all the parts that you need for the update to work, I believe.

### The future and some questions

We are working on making it easier to add custom OS images / custom device types to the platform, but it’s a work in progress. When that’s done, our aim is that you can use the regular “self-serve” update method without any custom work like this.

Can you also tell us some more about how your images are customized? What changes you need to do? Just want to check whether that’s something that might be done in the regular device type, or have any relevant runtime customization option that we could add (or have already) in regular balenaOS. Any info is appreciated!

---

<div class="post-metadata">

**Author:** ![PeterKAlvin](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@PeterKAlvin](https://forums.balena.io/u/PeterKAlvin)\
**Post date:** [March 22, 2019, 6:37pm UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/19 "2019-03-22T18:37:44Z")

</div>

Hello @imrehg

I highly appreciate the details you provided. We are planning a project that needs securing software and data on the IoT devices. Currently if you remove the eMMC or SSD drive from a Balena device, pretty much all data and software can be easily read. We want to employ some kind of disk encryption thats able to use either TPM chip, or CPU’s internal keys and engine for encryption. We love how Balena works, and we already use it at multiple clients, so we are looking for ways to extend the Yocto generated images.

If you have any other suggestion for encryption, please tell us 🙂

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [March 25, 2019, 2:37pm UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/27 "2019-03-25T14:37:25Z")

</div>

The Zymbit solutions are interesting for example, but we have not tried them yet.

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [March 25, 2019, 2:37pm UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/28 "2019-03-25T14:37:33Z")

</div>

The Zymbit solutions are interesting for example, but we have not tried them yet.

---

<div class="post-metadata">

**Author:** ![PeterKAlvin](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@PeterKAlvin](https://forums.balena.io/u/PeterKAlvin)\
**Post date:** [April 2, 2019, 5:53am UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/30 "2019-04-02T05:53:58Z")

</div>

We did look at Zymbit, and it looks pretty interesting.

---

<div class="post-metadata">

**Author:** ![jasonanderson](https://avatars.discourse-cdn.com/v4/letter/j/c77e96/32.png) [@jasonanderson](https://forums.balena.io/u/jasonanderson)\
**Post date:** [November 23, 2021, 12:18am UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/31 "2021-11-23T00:18:19Z")

</div>

Hi there, I’m wondering if anything has changed w.r.t. remote upgrade of custom host images?

---

<div class="post-metadata">

**Author:** ![builder555](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@builder555](https://forums.balena.io/u/builder555)\
**Post date:** [December 22, 2021, 7:44pm UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/33 "2021-12-22T19:44:21Z")

</div>

Hello,

At the moment there are no viable way (that I’m aware) of running a custom OS through balenaCloud. However, if the issue is about security, we are currently working on a secure boot option, so stay tuned.

---

<div class="post-metadata">

**Author:** ![msallam](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/msallam/32/5790_2.png) [@msallam](https://forums.balena.io/u/msallam)\
**Post date:** [August 23, 2022, 4:06pm UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/35 "2022-08-23T16:06:44Z")

</div>

Has there been any progress in supporting the upgrade of custom OS images through balenaCloud?

---

<div class="post-metadata">

**Author:** ![SamsonHezekiah](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@SamsonHezekiah](https://forums.balena.io/u/SamsonHezekiah)\
**Post date:** [August 28, 2023, 1:33pm UTC](https://forums.balena.io/t/remote-os-upgrade-of-custom-host-image-possible/5636/37 "2023-08-28T13:33:46Z")

</div>

> [@jasonanderson](#):
>
> Hi there, I’m wondering if anything has changed w.r.t. remote upgr[a](https://thoptv-hd.com/download/)de of custom host images?

Participate in online developer and IT communities, forums, and news sources related to your technology stack. These platforms often share insights, best practices, and news about remote upgrades.
