Inconsistent hostname when set via host-config supervisor API endpoint


#1

Use case:

Set a persistent hostname of a resin device.

Issue:

Before change the hostname was as follows:

Device hostname: 05d447f
Container hostname: 05d447f

Using starter application.
Using Resin OS 2.13.6+rev1 development
Using 7.14.0

I read through Read-only file-system when calling SetStaticHostname via dbus and decided to go for the host-config supervisor API endpoint.

I used the following command called from the container:

curl -X PATCH --header “Content-Type:application/json”
–data ‘{“network”: {“hostname”: “whee”}}’
“$RESIN_SUPERVISOR_ADDRESS/v1/device/host-config?apikey=$RESIN_SUPERVISOR_API_KEY”

After reboot the hostname was as follows:

Device hostname: whee
Container hostname: intel-nuc-05d447f

Content of the /resin-boot/config.json:

{ “deviceType”: “intel-nuc”, “hostname”:“resin”, “persistentLogging”: “false” }

Note I did not change the config.json file manually.

I am unsure if this as expected?

I would assume the same hostname on both device and the running container. This is also supported by https://resin.io/blog/resinos-2-0-released-in-production/#otherfeaturesandfixes. A section states:

If you use resin.io base images, you will notice that the hostname has changed from <device_type>-<short_uuid> to just <short_uuid> , however, if you set a customised hostname in your config.json, that will also be reflected in the container hostname.

Based on the above I would expect the following:

Device hostname: resin
Container hostname: resin

But for some reason the config.json is ignored and i get:

Device hostname: whee
Container hostname: intel-nuc-05d447f

Seems that host-config API endpoint overrule what ever is stated in config.json, but is not consistently applied in the container hostname.


#4

Tried the same on a production resin device.

Result is as follows:

Device hostname: whee
Container hostname: 86d162d

Is this as expected?


#5

After a resin service update the hostname changed to:

Device hostname: whee
Container hostname: intel-nuc-86d162d

The hostname is inconsistent