Friday, April 26, 2024
 Popular · Latest · Hot · Upcoming
18
rated 0 times [  18] [ 0]  / answers: 1 / hits: 26623  / 2 Years ago, wed, august 24, 2022, 6:56:56

I have a fully-configured instance and an image from that for an autoscaling group. When autoscaling new instances from this image, it calls cloud-init. cloud-init changes the hostname and breaks fstab.



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


More From » cloud-init

 Answers
7

In systems that use systemd and have a current (17.0+) version of cloud-init, upstream documentation describes the process for disabling cloud-init with either of the following:




  • touch /etc/cloud/cloud-init.disabled

  • add cloud-init=disabled to the kernel command line.



For older versions of cloud-init (0.7.X) the following information might be useful.



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.


[#27481] Friday, August 26, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
afyess

Total Points: 437
Total Questions: 120
Total Answers: 107

Location: San Marino
Member since Fri, Jul 3, 2020
4 Years ago
afyess questions
;