Prevent updating on metered connections

Hi all,

I’m looking for a way to prevent my devices from downloading updates when on a metered connection. My fleet will be connected through 4G most of the time, but WiFi will be available at times, as the device is moved around by the end user.
I want to implement some way to make sure the data consumption through 4G is limited, because this can become really expensive very quickly at 10 cents per MB (in some countries). I thought implementing the application update lock would be enough but I just noticed the line

The presence of a lockfile will ensure that your application does not get killed, but updates will still be downloaded by the supervisor, ready to be applied once the lockfile no longer exists.

This is exactly what I don’t want. When on a metered connection (which is configured as such in NetworkManager so it can be read through dbus), the supervisor should not start downloading new images. Furthermore, it should stop active downloads whenever the primary connection changes to a metered connection and resume or restart when the the primary connection is not metered anymore. When a new image is downloaded, I don’t mind it being installed, even when on a metered connection, as this doesn’t consume any more data.

I know I can pin a device to a specific release through the API, and implement some logic to make sure this only jumps to the latest version whenever the device is connected through WiFi, but this doesn’t help in case the device is then moved back to the 4G connection just after, especially with large updates.

Does anyone have any experience with implementing something like this? Is it even possible?

Thanks,
Marten

Hey @martenjacobs,

thanks for reaching out to us.
unfortunately, restricting updates to not use an interface/connection is not possible right now.

You could try to implement an intermediate server that listens for events from the device, especially which connection is active/primary and then pin or unpin the device accordingly but this might be a more involved approach.

We have raised an internal issue regarding this feature and to make it more intuitive and we will reach out to you once we have more details to share.

Thanks for the feedback
Rahul

Hi Rahul,

Thank you for your response. Is there any (public) way to track this issue? I understand it isn’t high prio but it’d be nice to have some way to keep up to date with it.

Thanks,
Marten

1 Like