Skip to content

Instantly share code, notes, and snippets.

@zoilomora
Last active March 28, 2023 09:27
Embed
What would you like to do?
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

@Fordp12
Copy link

Fordp12 commented May 14, 2021

This instruction no longer works, the errors you will get are: dpkg-reconfigure cloud-init (must be run from root)
If you type sudo in front of that command you will get into the cloud-init but you cannot select anything
Please update the instructions

@buzzdev
Copy link

buzzdev commented May 28, 2021

This instruction no longer works, the errors you will get are: dpkg-reconfigure cloud-init (must be run from root)
If you type sudo in front of that command you will get into the cloud-init but you cannot select anything
Please update the instructions

It works for me. Except that it has to be "sudo dpkg-reconfigure cloud-init".
Apart from that, it works. Just removed it from 4 servers.

@mayconmarchiori
Copy link

This instruction no longer works, the errors you will get are: dpkg-reconfigure cloud-init (must be run from root)
If you type sudo in front of that command you will get into the cloud-init but you cannot select anything
Please update the instructions

it worked here!
Ubuntu 20.04.2 LTS

@ukewea
Copy link

ukewea commented Aug 11, 2021

This instruction no longer works, the errors you will get are: dpkg-reconfigure cloud-init (must be run from root)
If you type sudo in front of that command you will get into the cloud-init but you cannot select anything
Please update the instructions

It works for me. Except that it has to be "sudo dpkg-reconfigure cloud-init".
Apart from that, it works. Just removed it from 4 servers.

Yes, add sudo and works for me

@e5faf2
Copy link

e5faf2 commented Sep 17, 2021

❤️

@NoneRain
Copy link

Thanks!

@giormatsis
Copy link

works here ubuntu with su (root) server 20.04 rasbian mate rasberry pi4 8g

@JuniperChris929
Copy link

works like a charm here (Ubuntu 20.04.6)

@zogness
Copy link

zogness commented Apr 27, 2022

Works on 21.10 Ubuntu server.

@hisakiyo
Copy link

hisakiyo commented May 8, 2022

Works on Debian 11, thanks

@juliyvchirkov
Copy link

works on 22.04 Ubuntu server, thanks a lot!

@nero-dv
Copy link

nero-dv commented May 30, 2022

Working on ubuntu server 22.04, thanks!

@qupfer
Copy link

qupfer commented Jun 17, 2022

"Stupid Question": Should sudo apt-get purge cloud-init not be enough?
If not, I would say its bad packaging of cloud-init and should be handled as a clound-init bug.

@o-ristow
Copy link

"Stupid Question": Should sudo apt-get purge cloud-init not be enough?
If not, I would say its bad packaging of cloud-init and should be handled as a clound-init bug.

the folders /etc/cloud/ and /var/lib/cloud/ are not empty after sudo apt-get purge cloud-init - they still contain a bunch of config files - otherwise it is sufficient.

@RokkuCode
Copy link

Uninstalling on Ubuntu 22.04 marks neccessary packages like netplan.io for autoremove. you should mark them firs as manual before removing cloud-init

@baalpeteor
Copy link

Fordp12

Fordp12 -> P.I.C.N.I.C.
(Problem in chair, not in computer)

@sean-m-foley
Copy link

Uninstalling on Ubuntu 22.04 marks neccessary packages like netplan.io for autoremove. you should mark them firs as manual before removing cloud-init

I second that. There is no actual reason to delete the cloud init from the server. Once you have the file touched and have the service disabled/stopped it isn't relevant as to whether it is installed or not. It will NEVER run.

@rdewald
Copy link

rdewald commented Jan 17, 2023

While I concur that installation is irrelevant after the service is disabled by the dpkg-reconfigure edits, netplan.io was left alone on my recent 22.04 install after apt purge cloud-init.

@zoilomora, muchas gracias.

@catwhocode
Copy link

works fine on ubuntu 22.04.2 LTS

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