4

I have setup an Ubuntu 8.10 server instance on Amazon EC2. I install ejabberd on server, but I face some problems on ejabberd node can't start because hostname on cloud changes each time we relaunch the instance. After I follow this link http://blog.kenweiner.com/2008/05/ejabberd-on-amazon-ec2-ubuntu-ami.html to edit and add hostname in /etc/hosts file, it works. Unfortunately, every time I reboot the server, the /etc/hosts file get reset to default.

How could I solve this problem?

Samnang
  • 141
  • 1
  • 3
  • I'm running Ubuntu (desktop) 10.10 on my laptop and the problem with the /etc/hosts files persists. It's reseted any time I reboot. Googling for a solution I just found this thread. No luck at this moment. :( –  Jan 28 '11 at 14:37

3 Answers3

4

This is a known problem with the current Ubuntu images for EC2 built by Canonical:

https:// bugs.launchpad.net/ubuntu-on-ec2/+bug/371936

You can wait for the next release from Canonical or run the Ubuntu images for EC2 which I publish on http:// alestic.com (and which do not have the same problem).

I have successfully run ejabberd on the Alestic.com images.

Eric Hammond
  • 11,163
  • 1
  • 36
  • 56
2

I know this a super old thread but one the pops up on ggl, yes it is cloud-init, on my debian ami I added my custom entries in:

/etc/cloud/templates/hosts.debian.tmpl

lets see if that works on next auto-reboot by

aws ec2 create-ami ...
Eduard3000
  • 21
  • 1
1

You could try CloudInit to perform your hosts file cleanup during instance boot. It is included in all the current official Ubuntu EC2 images and allows you to run initialization scripts passed by the --user-data switch of ec2-run-instances (or the respective input field(s) in the AWS Console wizard) which will be run at boot. Kind of like rc.local.

Edit: I did not realize it was Eric himself who wrote the other comment, at first. He's got lots of useful entries in his blog at Alestic, including one regarding the mentioned UserData.

Axel Knauf
  • 1,600
  • 1
  • 10
  • 12