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.
Seriously, that’s it. No need to disable or remove cloud-init services. See reference.
6 thoughts on “How to disable Cloud-Init in a RHEL Cloud Image”
hello, I meet the same problem when I use vsphere to start up vm.
the vm is hang, and displays random: crng init done
did you resolve it? how to resolve it ?
check the discussion here: https://communities.vmware.com/thread/583932
thanks for help.
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)
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):
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.
This only works with Cloud-Init > 0.7.7. Debian 8 Jessie (I know, oldstable now, migration to 9 Stretch in process …) is still providing cloud-init 0.7.6 …
doesn’t work, sorry
What RHEL version are you using?
Worked for me on RHEL 7.7 KVM image.
Also stops resolv.conf and ifcfg-eth0 being overwritten.