Disable & Remove Cloud-Init On Ubuntu 22.04 LTS
Table of Contents
Summary
Cloud Init is configured and installed on Ubuntu 22.04 LTS by default. In fact. It’s been available since 18.04. It can be used to configure things like authorized keys for SSH, generate private keys, etc. For my preferences. It’s annoying because I never use it. So I generally disable the service.
Added is an option for uninstalling it from the system completely. Should that be what’s desired.
Disable Service
Disabling the service is the easiest way. Especially if you’re considering its use in the future. I generally disable Cloud Init because it shaves off of the servers boot time a little. Not to mention I don’t use it at all.
I would recommend this method in case it’s needed on the server in the
future. Adding an empty file named cloud-init.disabled
into the
configuration directory for Cloud Init will do the trick.
Command for doing so can be found below.
sudo touch /etc/cloud/cloud-init.disabled
After this is completed. Reboot the server/device.
Uninstall
Uninstalling is simple also. There’s just a few more steps. I don’t use this method. But, if it has to be removed completely. This is how you do this on Ubuntu 22.04 LTS.
Use the dpkg-reconfigure to turn off all of the services for cloud-init.
sudo dpkg-reconfigure cloud-init
Uninstall and purge cloud-init from the server or workstation.
sudo apt purge cloud-init
Remove the /etc/cloud/
directory.
sudo rm -rf /etc/cloud/
Remove the /var/lib/cloud/
directory.
sudo rm -rf /var/lib/cloud/
When this is completed. Reboot the server/device.