How to Completely Disable ‘Cloud-init’ During Boot on Ubuntu Server

If you install Ubuntu Server from the official ISO, or provision a Virtual Private Server (VPS) through a major hosting provider (like AWS or DigitalOcean), the operating system comes pre-installed with a package called cloud-init. This daemon runs during the boot process to automatically configure network interfaces, inject SSH keys, and set hostnames based on metadata provided by the cloud hosting platform.

While this is essential for automated fleet deployment, it is a massive nuisance if you are setting up a local home server, a Raspberry Pi, or a static bare-metal machine. On a machine that does not receive cloud metadata, cloud-init will stall the boot process, desperately searching for a metadata server that does not exist. It will eventually time out, but it adds significant delay to your boot time and overwrites any manual network configurations you place in Netplan. If you are configuring your server manually, you must completely disable cloud-init.

Disabling Cloud-init via the Touch Command

The developers of cloud-init included a simple, built-in mechanism to completely bypass the service without needing to uninstall the software.

  1. Open a Terminal session (or connect to your server via SSH).
  2. You must create a specific, empty file in the /etc/cloud/ directory. During the boot sequence, if the system detects this exact file, it immediately aborts the cloud-init process.
  3. Run the following command using sudo:
    sudo touch /etc/cloud/cloud-init.disabled
  4. Restart your server to test the change:
    sudo reboot

The server will now boot significantly faster, as it no longer wastes time polling for non-existent cloud metadata servers.

Uninstalling the Package Completely (Optional)

If you want to ensure the software is completely removed from your hard drive and reclaim a small amount of disk space, you can purge the package using APT.

  1. In the terminal, run the following command to strip the package and its configuration files from the system:
    sudo apt-get purge cloud-init
  2. Press Y when prompted to confirm the removal.
  3. Clean up any unused dependencies left behind:
    sudo apt-get autoremove
  4. Finally, you must manually delete the leftover log and configuration directories to ensure your system is entirely clean:
    sudo rm -rf /etc/cloud/ && sudo rm -rf /var/lib/cloud/

Whether you choose to simply disable it using the touch command or purge the package entirely, your Ubuntu Server is now a standalone machine. It will boot rapidly and strictly respect the manual network and hostname configurations you provide.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.