PDA

View Full Version : retaining hostname after new infrastructure



monoclesys
08-Oct-2014, 16:31
Greetings,

After updating some of our SLES 11 sp3 AWS instances to use the new infrastructure (per instructions in this blog post: https://www.suse.com/communities/conversations/suse-linux-enterprise-server-aws-updates-shellshock/) our instances no longer retain their hostname. After rebooting, our systems hostnames are reset. For example, our test box was called "susetest" but after a reboot:

jfriesen@ip-10-16-31-137:~> hostname
ip-10-16-31-137

Even though in "yast network" --> Network Card --> Hostname/DNS we ensure that the "Change Hostname via DHCP" checkbox is de-selected. Every time we reboot now, we lose our hostnames, and it seems like no settings in yast can fix the problem. This was not an issue before the infrastructure change. Anyone have any ideas?

ab
08-Oct-2014, 17:43
On 10/08/2014 09:34 AM, monoclesys wrote:
>
> Greetings,
>
> After updating some of our SLES 11 sp3 AWS instances to use the new
> infrastructure (per instructions in this blog post:
> https://www.suse.com/communities/conversations/suse-linux-enterprise-server-aws-updates-shellshock/)
> our instances no longer retain their hostname. After rebooting, our
> systems hostnames are reset. For example, our test box was called
> "susetest" but after a reboot:
>
> jfriesen@ip-10-16-31-137:~> hostname
> ip-10-16-31-137

Besides unchecking that checkbox, did you set a new hostname value on the NIC?

Do you need the hostname for anything other than the prompt of your shell?
If not, you could hack that pretty easily. Similarly, you could have
your old hostname work with new IPs via an /etc/hosts hack. Still, I do
not know of any reason why setting the hostname would be something lost
during a reboot unless the new infrastructure had some odd tentacles that
forced a change back, which doesn't make sense to me.

--
Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below...

ab
08-Oct-2014, 18:06
I'm guessing you're on AWS since your hostname looks similar to mind; I
have not tried this out yet, just FYI:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html

--
Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below...

monoclesys
12-Oct-2014, 16:45
Thanks for your thoughts ab. Yes, this issue only affects our AWS-based SuSE instances, which used to work just fine, until a couple weeks ago when SuSE upgraded their infrastructure. That upgrade replaced a lot of the startup scripts and seem to have broken the part that allowed us to preserve hostnames across reboots. (hostname is import to us as the software running on them expects the "hostname" command to return the configured hostname and not ip-a.b.c.d). I'm hoping someone from SuSE reads these forums. In the meantime I'm looking for the part of the script that is overwriting /etc/HOSTNAME so that I can fix it myself.

monoclesys
12-Oct-2014, 17:57
I think I found it. The new SuSE AWS infrastructure uses the cloud-init package and there is a new config file associated with it, /etc/cloud/cloud.cfg, with a parameter that must be set:

preserve_hostname: true

I'm not sure if the setting in YaST is completely ignored or if it must be set in conjunction with /etc/cloud/cloud.cfg.

wallwood
18-Sep-2015, 13:13
I'm guessing you're on AWS since your hostname looks similar to mind; I
have not tried this Jasa Seo (http://mastahh.com) out yet, just FYI:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html

--
Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below...

thanks for usefull information