Skip to content

Instantly share code, notes, and snippets.

@zoilomora
Last active June 26, 2026 19:06
Show Gist options
  • Select an option

  • Save zoilomora/f862f76335f5f53644a1b8e55fe98320 to your computer and use it in GitHub Desktop.

Select an option

Save zoilomora/f862f76335f5f53644a1b8e55fe98320 to your computer and use it in GitHub Desktop.
How to disable cloud-init in Ubuntu

How to disable cloud-init in Ubuntu

Prevent start

  • Create an empty file to prevent the service from starting

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

Uninstall

  • 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
    

Sources

@Balzabu

Balzabu commented Jun 26, 2026

Copy link
Copy Markdown

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.

  1. Ubuntu split the package. Since 24.10, cloud-init is just a thin metapackage that depends on cloud-init-base, which now holds the actual implementation. This means sudo apt-get purge cloud-init removes only the metapackage and leaves cloud-init installed and running. On these releases you have to purge cloud-init-base too (or detect whichever is present). Debian 13 and Ubuntu 24.04 still ship a single cloud-init package.
  2. The netplan.io issue is better fixed by marking it manual. On Ubuntu, cloud-init (via cloud-init-base) depends on netplan.io. A temporary apt-mark hold only protects it during the purge; once you unhold it, netplan.io is left orphaned and the next apt autoremove removes it and breaks networking. Running sudo apt-mark manual netplan.io before 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, marks netplan.io as manual, and runs fully non-interactively.

And as others already noted, if you only want to disable cloud-init without removing it, the officially recommended method is still just sudo touch /etc/cloud/cloud-init.disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment