-
Create an empty file to prevent the service from starting
sudo touch /etc/cloud/cloud-init.disabled
-
Disable all services (uncheck everything except "None"):
sudo dpkg-reconfigure cloud-init -
Uninstall the package and delete the folders
sudo dpkg-reconfigure cloud-init sudo apt-get purge cloud-init sudo rm -rf /etc/cloud/ && sudo rm -rf /var/lib/cloud/ -
Restart the computer
sudo reboot
Heads-up for anyone on a recent release (Debian 13, Ubuntu 24.10+ including 26.04 LTS): two things have changed since the original instructions.
cloud-initis just a thin metapackage that depends oncloud-init-base, which now holds the actual implementation. This meanssudo apt-get purge cloud-initremoves only the metapackage and leavescloud-initinstalled and running. On these releases you have to purgecloud-init-basetoo (or detect whichever is present). Debian 13 and Ubuntu 24.04 still ship a singlecloud-initpackage.netplan.ioissue is better fixed by marking it manual. On Ubuntu,cloud-init(viacloud-init-base) depends onnetplan.io. A temporaryapt-mark holdonly protects it during the purge; once you unhold it,netplan.iois left orphaned and the nextapt autoremoveremoves it and breaks networking. Runningsudo apt-mark manual netplan.iobefore purging fixes this for good.I have updated my script (disable-cloud-init) to handle both cases: it detects and purges
cloud-init/cloud-init-base, marksnetplan.ioas manual, and runs fully non-interactively.And as others already noted, if you only want to disable
cloud-initwithout removing it, the officially recommended method is still justsudo touch /etc/cloud/cloud-init.disabled.