After upgrading to 20.04 LTS, network now takes 2 minutes to start because of cloud-init

I recently upgraded an Ubuntu droplet from 18.04 LTS to 20.04 LTS using sudo do-release-upgrade. The system seems fine after the upgrade except for 1 thing. It now takes 2 minutes for the network to start after a boot. The console shows:

[ OK ] Reached target Network.
[    ] A start job is running for Wait for Network to be Configured (47s / no limit)

/var/log/cloud-init-output.log contains:

2020-11-09 19:38:37,068 -[WARNING]: Getting data from <class 'cloudinit.sources.DataSourceDigitalOcean.DataSourceDigitalOcean'> failed

Further digging shows:

$ cloud-id none

/etc/cloud/cloud.cfg.d/ contains some files that are 4+ years old:

-rw-r–r-- 1 root root 1480 Nov 2 2016 93-digitalocean-cloud-config.cfg -rw-r–r-- 1 root root 95 Nov 2 2016 91-digitalocean-dpkg.cfg -rw-r–r-- 1 root root 200 Nov 2 2016 92-digitalocean-ds.cfg -rw-r–r-- 1 root root 167 Jan 14 2020 README -rw-r–r-- 1 root root 2070 Aug 26 16:58 05_logging.cfg -rw-r–r-- 1 root root 104 Nov 9 19:36 90_dpkg.cfg

Are the files in /etc/cloud/cloud.cfg.d supposed to be removed or updated at some point?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Disabling cloud-init worked for me but wasn’t a solution. It seems the issue was also related to a random nubmer generation. I could skip the process by pressing lots of random keys on the recovery console.

Following this post I was able to find an automated solution:

sudo apt install haveged
sudo systemctl enable haveged
sudo systemctl start haveged

The upgrade process seems to leave the original version of /usr/lib/python3/dist-packages/cloudinit/sources/ in place and then adds the new version as which doesn’t work with the new version of cloudinit putting the config into a fallback state.

What fixed it for me was to replace the file and restart.

sudo mv /usr/lib/python3/dist-packages/cloudinit/sources/ /usr/lib/python3/dist-packages/cloudinit/sources/
sudo mv /usr/lib/python3/dist-packages/cloudinit/sources/ /usr/lib/python3/dist-packages/cloudinit/sources/

Hi @plujon,

I usually remove them on all my droplets. Having said that, you should be able to create a disabled file for cloud-init which should resolve your issues without actually removing cloud-init. SSH to your droplet and run the following :

touch /etc/cloud/cloud-init.disabled

Then try to restart your network and see if it’s still taking some time to restart.

Restart, KDSys