Cloud-init Ubuntu 18.04 - netplan v2

Hello
I found that problem is with cloud-init configuration which is generated by Ubuntu 18.04 installer. I spent many hours and I finally resolve the issue, doing this:

apt remove cloud-init
apt purge cloud-init
rm -rf /var/lib/cloud/
rm -rf /etc/cloud/
apt install cloud-init
 
  • Like
Reactions: avladulescu
Hello
I found that problem is with cloud-init configuration which is generated by Ubuntu 18.04 installer. I spent many hours and I finally resolve the issue, doing this:

apt remove cloud-init
apt purge cloud-init
rm -rf /var/lib/cloud/
rm -rf /etc/cloud/
apt install cloud-init

Nice one. Worked for me!

I was having similar problems. Not only was the cloud-init networking not working but a clone of a template with cloud-init wouldn't change ANY of the settings until I removed the cloud-init instance + configs that ship with the iso now.

For what it's worth, the image I was having problems with is the latest 18.04.3 LTS Ubuntu Server amd64 from Canonical as of this writing.
 
I had the issue that my Ubuntu 18.04 VMs (based on the Ubuntu cloud image) were not applying cloud-init network config. I'm not entirely sure if this is related to the problem discussed in this thread, but I just wanted to post my solution:

By looking at /var/log/cloud-init.log I figured out that cloud-init was using the "ENI" renderer by default, but my Ubuntu is using netplan. So I had to edit the /etc/cloud/cloud.cfg file in the VM to change the priority of network config renderers by appending the following snippet to the system_info: section
Code:
system_info:
  network:
    renderers: ['netplan', 'eni', 'sysconfig']
Now my cloud-init network config gets applied correctly. Hope this helps!
 
  • Like
Reactions: avladulescu
seems like th
Hello
I found that problem is with cloud-init configuration which is generated by Ubuntu 18.04 installer. I spent many hours and I finally resolve the issue, doing this:

apt remove cloud-init
apt purge cloud-init
rm -rf /var/lib/cloud/
rm -rf /etc/cloud/
apt install cloud-init
seems like the problem persist in ubuntu 20.04.1 LTS. Need to perform the above steps for the IP Config assigned values to be applied.
 
  • Like
Reactions: avladulescu
I didnt have this issue on ubuntu 18.0.4 , using legacy installer.

However I can confirm this issue for ubuntu 20.0.4, using subiquity installer.
Had huge problems using an image that was generated by packer. Basically none of the cloud-init logic was applied after using the image, the cloud-init run was also very short. So no growpart, no ip settings, no hostname set.

During installation of the image cloud-init plays a major role and i think the leftover mess prevents it to run properly afterwards.

I fixed it by adding the following as final steps in my packer template, after this the new VMS based on this image use the cloud-init settings as they should.

Code:
{
      "type": "shell",
      "inline": [
        "echo 'sudopassword' | sudo -S apt remove cloud-init -y",
        "echo 'sudopassword' | sudo -S apt purge cloud-init -y",
        "echo 'sudopassword' | sudo -S rm -rf /var/lib/cloud",
        "echo 'sudopassword' | sudo -S rm -rf /etc/cloud",
        "echo 'sudopassword' | sudo -S apt install cloud-init -y"
      ]
    }