How to disable Cloud-Init in a RHEL Cloud Image

happy_cloud1600

So this one is pretty simple. However, I found a lot of misinformation along the way, so I figured that I would jot the proper (and most simple) process here.

Symptoms: a RHEL (or variant) VM that takes a very long time to boot. On the VM console, you can see the following output while the VM boot process is stalled and waiting for a timeout. Note that the message below has nothing to do with cloud init, but its the output that I have most often seen on the console while waiting for a VM to boot.

[106.325574} random: crng init done

Note that I have run into this issue in both OpenStack (when booting from external provider networks) and in KVM.

Upon initial boot of the VM, run the command below.

touch /etc/cloud/cloud-init.disabled

Seriously, that’s it. No need to disable or remove cloud-init services. See reference.

 

 

2 thoughts on “How to disable Cloud-Init in a RHEL Cloud Image

  1. This was “the best” solution for me! Thank you!!!

    Learned a lot on the way about trying to trouble shoot a slow virtualbox vm boot along the way.

    Had done the resize a fixed ssd (to include the important reset/reassignment of the UUID in /etc/fstab after having removed and relocated the swap).

    Had learned of apt-get ncdu ( prompt:[username]% ncdu / ), i.e. a awesome upgrade to the use of du -h, to find and remove large files.

    Clear apt cache and other stuff (not the solution, but hmm probably ought to do this automatically with the other stuff we often do):
    du -sh /var/cache/apt/archives/ (this one, to check current cache usage, size)
    apt-get update && apt-get upgrade
    apt-get clean && apt-get autoclean
    apt-get autoremove –purge (and this one, to clear cache)
    source:
    https://www.omgubuntu.co.uk/2016/08/5-ways-free-up-space-on-ubuntu (see gabdub’s post)

    Check boot log files (eh, kinda helpful to know about and look at):
    /var/log/boot.log
    /var/log/bootstrap.log

    Check long startup times:
    systemd-analyze blame (this is gold; “aha cloud.init.server takes ~ 4min, wth”)

    dmesg | less (this is also gold; a finer grain to go with above in trouble-shooting)

    also journalctl -b

    Looking into cloud-init

    Me: “oh, it comes in some of the vm iso copies, useful for ‘cloud’ services (multiple EC2) , snapshots, etc.”

    Me: “Well I don’t know if I really want remove this completely; done EC2s on AWS; might need this later with own raspberry-pi cluster, plus the use of the vm “snapshot – merge – snapshot” cycle stuff”

    fatmin: “No worries mate! touch /etc/cloud/cloud-init.disabled”

    Me: Ok cool. Shutdown -> Restart VM -> 30 seconds later -> “tah-dah!”
    “drum beat sound” -> Ubuntu 16.04 -> Login [Username: |”blink-blink-blink” ]

    Me: Oh my god, Thank you!!!!

    And just like that … weeks of like 5-8 min morning bootup times gone!!! VMs are still awesome.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s