Skip to content

Instantly share code, notes, and snippets.

@zoilomora
Last active April 24, 2024 12:42
Show Gist options
  • Save zoilomora/f862f76335f5f53644a1b8e55fe98320 to your computer and use it in GitHub Desktop.
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

@Ethan-Geyer
Copy link

This worked perfectly thank you!

@Balzabu
Copy link

Balzabu commented Dec 29, 2023

Hello everyone!
I just wanted to inform you that I've created a bash script designed to automate the process of disabling cloud-init on Ubuntu servers. It's a quick and simple solution you can even call through a oneliner.

GitHub Repo: disable-cloud-init

Give it a try and let me know your thoughts! Your feedback is highly appreciated.

@xd1gital
Copy link

After purged cloud-init (on 22.04), the netplan package is also removed.
I followed this section 3.3. Temporary Static IP via ip
to temporary get an IP address, then reinstall netplan using: sudo apt install netplan.io

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