Recently, I created a CoreOS droplet on DigitalOcean. Everything works well, except for the fact that I'm not able to change the hostname of my VPS. When I change the hostname to what it should be using sudo hostnamectl set-hostname myhostname.org (the documented way of doing so), it indeed changes the hostname system-wide (e.g. /etc/hostname reflects the new hostname). However, when I reboot the VPS, the hostname gets reverted to what it used to be.

It might not be a coincidence, but the hostname always reverts to the original name of the droplet. I've already changed that name about one week ago to the correct hostname. I have read stories about DHCP influencing the hostname on reboot, but I'm not able to find a solution to avoid that on CoreOS.

How to change the hostname of CoreOS in such a way that it will remain the same after a reboot?

Thanks in advance!

1 Answer 1


On DigitalOcean (and some other cloud providers; Openstack for example) they're providing metadata on each boot of the machine (either provided via cloud-config or via the options you provided in the DigitalOcean web interface). When you bestowed a name on the droplet/VM you signified to the metadata service that you wanted the hostname to be called that value. cloud-config is honoring the request put forth by the DigitalOcean metadata service. This is actually a design pattern and operating outside of it would me much like trying to avoid uing convention over configuration in Rails. You can do it, but you're only making things harder on yourself.

Inside the DigitalOcean web interface you can rename the droplet Select Droplet->"Settings"->"Rename"

As to why the option in previous answer does not exist, CoreOS does not ship Python cloud-init had to be re-written in a compiled language (hence it being written in Go. To view the metadata on DigitalOcean log into the host and run the command:

$ curl
  • The suggested curl request gives an empty result... However, when I replaced user-data with hostname, I got what I expected: the wrong hostname, even though I renamed it through the droplet settings (something I did prior to asking this question). I guess it's a DigitalOcean issue. Thanks!
    – Rick
    Feb 10, 2015 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.