The following relate to LXD and the LXD container images for 16.04 and 18.04. Both container images have cloud-init 18.2 (18.2-4-g05926e48).
SUMMARY cloud-init fails to set up networking if a container is launched with cloud-init networking instructions. WHAT WAS TESTED 16.04 container image with cloud-init v1 and v2 configurations. 18.04 container image with cloud-init v1 and v2 configurations. HOW TO REPRODUCE 1. Set up LXD 2. Create a new LXD profile. Create first this file (mycloudinit.profile) --- $ cat mycloudinit.profile config: user.network-config: | network: version: 1 config: - type: physical name: eth0 subnets: - type: dhcp description: LXD profile with some cloud-init network-config devices: eth0: nictype: bridged parent: lxdbr0 type: nic root: path: / pool: default type: disk name: mycloudinit used_by: [] -------------------- and then add it to a profile with: $ lxc profile create mycloudinit $ cat version1.profile | lxc profile edit mycloudinit 3. Launch a container while specifying this profile lxc launch ubuntu:18.04 mycontainer --profile mycloudinit 4. Enter the container and check the cloud-init logs lxc exec mycontainer -- sudo --user ubuntu --login cd /var/log/ WHAT ERROR DO YOU GET ON CONTAINER 18.04, THE ERROR IS: Cloud-init v. 18.2 running 'init-local' at Tue, 24 Jul 2018 16:31:39 +0000. Up 1.00 seconds. 2018-07-24 16:31:39,793 - stages.py[WARNING]: Failed to rename devices: Failed to apply network config names. Found bad network config version: None 2018-07-24 16:31:39,794 - util.py[WARNING]: failed stage init-local failed run of stage init-local ------------------------------------------------------------ Traceback (most recent call last): File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 655, in status_wrapper ret = functor(name, args) File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 361, in main_init init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL)) File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 653, in apply_network_config return self.distro.apply_network_config(netcfg, bring_up=bring_up) File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 175, in apply_network_config dev_names = self._write_network_config(netconfig) File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 119, in _write_network_config return self._supported_write_network_config(netconfig) File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 94, in _supported_write_network_config renderer.render_network_config(network_config=network_config) File "/usr/lib/python3/dist-packages/cloudinit/net/renderer.py", line 53, in render_network_config network_state=parse_net_config_data(network_config), target=target) File "/usr/lib/python3/dist-packages/cloudinit/net/netplan.py", line 193, in render_network_state content = self._render_content(network_state) File "/usr/lib/python3/dist-packages/cloudinit/net/netplan.py", line 227, in _render_content if network_state.version == 2: AttributeError: 'NoneType' object has no attribute 'version' ------------------------------------------------------------ ON CONTAINER 16.04, THE ERROR IS: Cloud-init v. 18.2 running 'init-local' at Tue, 24 Jul 2018 17:02:13 +0000. Up 1.00 seconds. 2018-07-24 17:02:13,701 - stages.py[WARNING]: Failed to rename devices: Failed to apply network config names. Found bad network config version: None 2018-07-24 17:02:13,702 - util.py[WARNING]: failed stage init-local failed run of stage init-local ------------------------------------------------------------ Traceback (most recent call last): File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 655, in status_wrapper ret = functor(name, args) File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 361, in main_init init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL)) File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 653, in apply_network_config return self.distro.apply_network_config(netcfg, bring_up=bring_up) File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 171, in apply_network_config dev_names = self._write_network_config(netconfig) File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 119, in _write_network_config return self._supported_write_network_config(netconfig) File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 90, in _supported_write_network_config renderer.render_network_config(network_config=network_config) File "/usr/lib/python3/dist-packages/cloudinit/net/renderer.py", line 53, in render_network_config network_state=parse_net_config_data(network_config), target=target) File "/usr/lib/python3/dist-packages/cloudinit/net/eni.py", line 466, in render_network_state util.write_file(fpeni, header + self._render_interfaces(network_state)) File "/usr/lib/python3/dist-packages/cloudinit/net/eni.py", line 423, in _render_interfaces for iface in network_state.iter_interfaces(): AttributeError: 'NoneType' object has no attribute 'iter_interfaces' ------------------------------------------------------------ ** Changed in: cloud-init (Ubuntu) Status: Incomplete => New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1686338 Title: cloud-init fails if no network config is set To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1686338/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs