I have fully-configured instance and create image from them for autoscaling group. When autoscaling setup new instance from this image, it calls cloud-init. And cloud-init changes hostname and breakes fstab.

I want to prevent cloud-init from start on instance launch.

share|improve this question
up vote 6 down vote accepted

You can disable cloud-init's modification of /etc/fstab in one of 2 ways.

a.) by providing cloud-config that overrides the default 'mounts' entries and disables them.

mounts:
 - [ephemeral0, null]
 - [swap, null]

b.) by disabling the mounts module from running. This is done by removing it from the 'cloud_config_modules' list that you'll see in /etc/cloud/cloud.cfg.

With regard to hostname, you can also control that also. If you just want to stop cloud-init from modifying /etc/hostname, then:

preserve_hostname: true

Also interesting to you might be manage_etc_hosts.

Both of these are documented in doc/examples/cloud-config.txt (and installed in /usr/share/doc/cloud-init/examples)

I'm interested in knowing how cloud-init is breaking /etc/fstab, though. Please file a bug using ubuntu-bug cloud-init from inside your instance, and describe what it is doing that you think is wrong.

share|improve this answer
    
I do not think this is actually a bug. cloud-init adds swap and ephemeral to /etc/fstab already there. As a result ephemeral mounts to 2 points: /cache and /mnt. Is it safe? – homm Jan 15 '14 at 5:59
    
@homm depends on what you mean by "safe." I don't see anything /dangerous/ about it. – xofer Jun 18 '15 at 20:17
    
@smoser By default, it's mounting just a single volume. I'm provisioning with Chef and don't want to automate umount, so for me cloud-init is "breaking" fstab. – xofer Jun 18 '15 at 20:20
    
Note that you need to run sudo dpkg-reconfigure cloud-init after making changes. – xofer Jun 18 '15 at 20:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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