LXD and cloud-init network only works with centos 7 and ubuntu 18.04 images, the rest fails

Hi,

i try to get the (network) configuration run with cloud-init.

I am using the x/x/cloud images from the official images server like:

centos/6/cloud
centos/7/cloud
gentoo/cloud
ubuntu/16.04/cloud
ubuntu/18.04/cloud
[…]

I am setting the cloud-init configs like this:

lxc config set CONTAINER user.network-config - < CONTAINER.network-config.yaml
lxc config set CONTAINER user.user-data - <  CONTAINER.config.yaml

All user-data cloud-init config directives are processed on all images.

So far, so fine.

Now comes the problem:

Only with the images of

centos 7 and Ubuntu 18.04

the network directives are processed correctly and work as expected.

On all other images, the files are put in place at /var/lib/cloud/seed/… but cloud init does not like the config:

Error message:

Unable to render networking. Network config is likely broken: No available network renderers found. Searched through list: ['eni', 'sysconfig', 'netplan']

So the identical cloud-init network configuration works with centos 7 and ubuntu 18.04, but with the rest its not working.

I have to assume that the cloud-init configuration is fine and correct.

But i wonder if it can be true, that all cloud images on the official lxd server are simply not working correctly, except centos 7 and ubuntu 18.04.

Could someone please tell me how to fix this ?

The user.network-config looks like this:

user.network-config: |
#cloud-config
version: 2
ethernets:
eth0:
addresses: [1.2.3.4/24]
gateway4: 1.2.3.1
nameservers:
addresses: [1.2.3.10]

Of course the formatting is correct, i just dont know how to reproduce this correctly here in this forum.
The config is definitly working fine with centos 7 and ubuntu 18.04 image from the official images server.

Thank you very much for your help and attention.

Greetings
Oliver

Update1: After some (hours) of debugging:

The debian/ubuntu based images have a network config ( /etc/network/interfaces ) file with

auto eth0
iface eth0 inet dhcp

and without any

source /etc/network/interfaces.d/*.cfg

So there is a cloud-init network configfile in /etc/network/interfaces.d/50-cloud-init.cfg but its simply not imported.

After adding source /etc/network/interfaces.d/*.cfg things start to work ( even the DNS config is not correctly taken over ).

The intresting thing is:

Already in 2014 there was a Bugreport about this:

https://bugs.launchpad.net/cloud-images/+bug/1262951

So eighter has never been fixed, or reintroduced.

This flaw seems to go for the debian9+10 and ubuntu 16.04 cloud images. I guess similar will go for the other’s too.

Who has to be informed about this ? This cloud images have been introduced recently. It seems there is some additional work needed to make them work when people try to use the network config with cloud-init :slight_smile:

Update2: Ok ok, i am giving up on this. I was trying now to fix the 16.04 cloud image but there the dns resolution does not work too. Resolvconf does not work, just like systemd-resolved does not do its job properly. I guess its more time saving to build up own images from scratch instead of fixing this images.

Update3: Ok, seems i am not ready to give up :slight_smile:

Fedora30 does not even create something similar to
/etc/network/interfaces.d/50-cloud-init.cfg but an ens3 dhcp config file.

Its writing into the cloud-init.log:

2019-09-07 23:32:48,185 - stages.py[DEBUG]: applying net config names for {‘version’: 2, ‘ethernets’: {‘eth0’: {‘addresses’: [‘1.2.3.4/24’], ‘gateway4’: ‘1.2.3.1’,‘nameservers’: {‘addresses’: [‘1.2.3.10’]}}}}

2019-09-07 23:32:48,186 - stages.py[DEBUG]: Using distro class <class ‘cloudinit.distros.fedora.Distro’>

2019-09-07 23:32:48,187 - init.py[DEBUG]: no interfaces to rename

2019-09-07 23:32:48,187 - stages.py[INFO]: Applying network configuration from ds bringup=True: {‘version’: 2, ‘ethernets’: {‘eth0’: {‘addresses’: [‘1.2.3.4/24’], ‘gateway4’: ‘1.2.3.1’,‘nameservers’: {‘addresses’: [‘1.2.3.10’]}}}}

2019-09-07 23:32:48,187 - stages.py[ERROR]: Unable to render networking. Network config is likely broken: No available network renderers found. Searched through list: [‘eni’, ‘sysconfig’, ‘netplan’]

/var/lib/cloud/seed/nocloud-net/ is present and correctly populated.

What/where/how ever i search for this unable to render networking problem, its mostly connected to malfuncture cloud-init implementations of the distributions.

By the way: It does not matter if i use network v1 or v2.

So clear warning, dont use the cloud images from the offical image server!

Greetings
Oliver

@monstermunchkin can you look into this?

For Fedora, it turns out that the packages NetworkManager and network-scripts are missing in order for the network config to work.

On Ubuntu and Debian we need to source /etc/network/interfaces.d/*.cfg as you pointed out.

Currently, I’m going through all cloud images and making sure they work properly.

Note that your provided network config is v2 and e.g. doesn’t work on Fedora. You should instead use v1. Also, when using older versions of cloud-init (< 17.1 according to the docs), it seems that network-config is not implemented.

Hi Thomas,

thank you very much for taking care of this, its greatly appreciated !

And yes, i tested with v1 and v2 aswell. So as soon as the images are fixed, i will be happy to test it immediately with both and give a feedback.

By the way, i also saw that gentoo and suse/tumbleweed seems not to work properly.

In general this whole cloud-init topic seems to be quiet evil and the integration into the different distributions are of very different quality.

Anyway, please let me know as soon as we are good to go, so i will be very happy to test it immediately.

Again, thank you very much !

The cloud images for Debian, Fedora, openSUSE, and Ubuntu should be working now. It might take day or so for them to be available.

For openSUSE, we needed to modify the cloud-init code so that it detects the distro correctly.

Gentoo still doesn’t work properly because cloud-init doesn’t handle the network config properly. This needs to be fixed in cloud-init itself.

Hi,

alright, thank you very much ! I will wait now for the next cycle of compose for the images and let you know once i tested them.

Hi,

the images have been refreshed on Sep 11, 2019 at 12:00am (UTC) so i tried my luck, and it changed a bit.

The current situation is:

Centos7 works
Ubuntu18.04 works

so far we have been.

Now:

Debian10:

static IP config: YES
DNS config: NO ( and after this fails a lot else )
was solved by installing network-manager in debian10

Fedora 30:

static IP config: YES
DNS config: YES
packages: NO
chpasswd: NO
runcmd: NO

OpenSuSE 13.1: NOK ( nothing works )

Tumbleweed:

static IP config: YES
DNS config: NO ( and after this fails a lot else )

Ubuntu16: NOK ( nothing works )

CentOS 6: NOK ( cloud-init is not installed ):

rpm -qa | grep cloud-init

Ubuntu16: NOK ( nothing works )

I cannot confirm this. Cloud-init works fine in images:ubuntu/xenial/cloud.

OpenSuSE 13.1: NOK ( nothing works )

I presume you mean 15.1 since we don’t have an openSUSE 13.1 image. Again, I cannot confirm this using images:opensuse/15.1/cloud.

CentOS 6: NOK ( cloud-init is not installed )

[root@centos-6-cloud ~]# rpm -qa | grep cloud-init
cloud-init-0.7.5-10.el6.centos.2.x86_64

Could you possibly paste the config(s) you are trying to use and are failing?