Changing the hostname

I made a mistake. I didn’t define the hostname in the cloud-config. Now I have this system just how I want it except the hostname.

I didn’t see a ‘ros config set’ variable for hostname, and setting ‘hostname’ to a value doesn’t seem to do anything. Changing the /etc/hostname and /etc/hosts file also doesn’t survive a reboot. Reinstalling rancheros from my thumbdrive doesn’t seem possible/easy because the thumbdrive mounts the persistent disk (rancheros-install fails because the device is busy, so I can’t reapply the cloud-config with a hostname attribute).

Thoughts on how to hack this host up to give it a hostname?

Unfortunately, I don’t have any great ideas on how to hack it up on v0.3.3 but in v0.4.0 the ros config will allow you to set the hostname as you’ll be editing an entire cloud config versus just hte rancher portion of the cloud config.

Thanks. The best idea I could come up with was a startup script that ran hostname and then replaced 127.0.1.1 in /etc/hosts with the preferred name. As you said, though – not a great idea :slight_smile:

I’ll be looking to upgrade to 0.4.0 when it’s released!

-Eric

The following worked for me on RancherOS v0.4.5 - ros config set hostname <hostname>

1 Like