Read-only file-system when calling SetStaticHostname via dbus


Hello, was curious to try setting my host name via a DBUS call using this example.

However, it fails with error:
Error System.Error.EROFS: Failed to set static hostname: Read-only file system

Is this intended? If you’re interested, here is how I’ve always done it which works well for me:

hostnamectl set-hostname "$DEVICE_NAME"
if ! grep "${DEVICE_NAME}" /etc/hosts; then
  echo " ${DEVICE_NAME}" >> /etc/hosts
hostnamectl status

Edit: I still had the issue with hostnamectl when I had the DBUS system address variable set. If it’s unset, then my workaround works OK. Probably related to this thread:

export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket
hostnamectl set-hostname ...
Could not set property: Failed to set static hostname: Read-only file system


Looks to be a known issue:


Yes, it’s a known issue, unfortunately, sorry about that!

In the meantime we’d recommend customizing the host name through the config.json at setup time, see the release notes:

Will update here if we have a replacement for the dynamic solution.


Before I spin my wheels on this I’m curious if there are any advancements in setting the hostname? I saw in a related thread it may be possible to use DBUS but this thread is giving me a bit of FUD. In my case I want to change the hostname and maybe spoof the MAC address of my device.

The device is running resinOS and is not connected to I have physical access to the device.


Take a look at this endpoint, we’ve put in functionality that allows you to set the hostname via an API on the device


Thanks for the info. I’ve updated my post to clarify my setup, namely:

I think what I’m looking for is the following. But I saw a bug in GH which lead me to believe it might not work:

I’ll give it a whirl. Thanks again!


@balibebas using dbus will work but I think it will not persist over reboots so you’ll have to do it every time your app starts.

Alternatively since you have physical access you can modify config.json in the resin-boot partition and add a “hostname” field.

If you’re sshing into the host this’d be at /mnt/boot. If you do this at runtime, you’ll have to reboot or restart the resin-hostname systemd service (which you can do using dbus if you want).

(I think sometime in the future you should be able to do this using the supervisor API even on a standalone resinOS device, but it’s still not quite there)