# Inconsistent hostname when set via host-config supervisor API endpoint

**URL:** <https://forums.balena.io/t/inconsistent-hostname-when-set-via-host-config-supervisor-api-endpoint/3891>\
**Category:** Product support\
**Created:** [September 4, 2018, 9:04am UTC](https://forums.balena.io/t/inconsistent-hostname-when-set-via-host-config-supervisor-api-endpoint/3891 "2018-09-04T09:04:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aliasbits](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@aliasbits](https://forums.balena.io/u/aliasbits)\
**Post date:** [September 4, 2018, 9:04am UTC](https://forums.balena.io/t/inconsistent-hostname-when-set-via-host-config-supervisor-api-endpoint/3891/1 "2018-09-04T09:04:18Z")

</div>

**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 - #2 by exposedwiring](https://forums.balena.io/t/read-only-file-system-when-calling-setstatichostname-via-dbus/1578/2) 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 [resinOS 2.0 released in production](https://resin.io/blog/resinos-2-0-released-in-production/#otherfeaturesandfixes). A section states:

> If you use [resin.io](http://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.

---

<div class="post-metadata">

**Author:** ![aliasbits](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@aliasbits](https://forums.balena.io/u/aliasbits)\
**Post date:** [September 10, 2018, 7:09am UTC](https://forums.balena.io/t/inconsistent-hostname-when-set-via-host-config-supervisor-api-endpoint/3891/4 "2018-09-10T07:09:02Z")

</div>

Tried the same on a production resin device.

Result is as follows:

> Device hostname: whee  
> Container hostname: 86d162d

Is this as expected?

---

<div class="post-metadata">

**Author:** ![aliasbits](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@aliasbits](https://forums.balena.io/u/aliasbits)\
**Post date:** [September 10, 2018, 8:22am UTC](https://forums.balena.io/t/inconsistent-hostname-when-set-via-host-config-supervisor-api-endpoint/3891/5 "2018-09-10T08:22:49Z")

</div>

After a resin service update the hostname changed to:

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

The hostname is inconsistent
