failed run of stage init-local .. nameservers .. KeyError: 'eth0'

Bug #1979678 reported by Danny Howard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
New
Undecided
Unassigned

Bug Description

We are using the nocloud datasource to bootstrap VMs into ganeti via https://github.com/neicnordic/ganeti-os-nocloud but in the past few weeks, network on new VMs has been broken.

In /var/lib/cloud/seed/nocloud/network-config I have, for example:

version: 2
ethernets:
  eth0:
    match: {macaddress: 'aa:00:00:45:6a:15'}
    addresses:
      - '10.20.12.9/16'
    gateway4: '10.20.0.1'
    nameservers:
        addresses:
          - '10.22.1.1'

When the instance bootstraps, I see this error in /var/log/cloud-init-output.log:

Cloud-init v. 22.2-0ubuntu1~20.04.2 running 'init-local' at Thu, 23 Jun 2022 17:29:24 +0000. Up 9.69 seconds.
2022-06-23 17:29:25,617 - 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 738, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 410, in main_init
    init.apply_network_config(bring_up=bring_up_interfaces)
  File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 937, in apply_network_config
    return self.distro.apply_network_config(
  File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 231, in apply_network_config
    network_state = parse_net_config_data(netconfig)
  File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 1056, in parse_net_config_data
    nsi.parse_config(skip_broken=skip_broken)
  File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 278, in parse_config
    self.parse_config_v2(skip_broken=skip_broken)
  File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 328, in parse_config_v2
    self._v2_common(command)
  File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 782, in _v2_common
    self._handle_individual_nameserver(name_cmd, iface)
  File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 110, in decorator
    return func(self, command, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 570, in _handle_individual_nameserver
    _iface[iface]["dns"] = {"nameservers": nameservers, "search": search}
KeyError: 'eth0'
------------------------------------------------------------

Some searching brought me to a similar circumstance at https://bugs.launchpad.net/cloud-init/+bug/1946493

Danny Howard (dannyman)
description: updated
Revision history for this message
Danny Howard (dannyman) wrote :
Revision history for this message
Danny Howard (dannyman) wrote :

This behavior is reproduced if I use the image from June 8.

This behavior is not reproduced if I use an image I found from August, 2021.

Revision history for this message
Brett Holman (holmanb) wrote (last edit ):

Hi Danny,

Thanks for reporting the issue. I am looking into this. What version of cloud-init was on the image from August?

Additionally, there was another bug recently[1] posted that this is a duplicate of. It contains a workaround if you care to try that.

Regards,
Brett Holman

[1] https://bugs.launchpad.net/cloud-init/+bug/1979877

Revision history for this message
Danny Howard (dannyman) wrote :

Brett,

This may take a couple of weeks. I need to test a fork of https://github.com/neicnordic/ganeti-os-nocloud the os/create script, lines 132 and 136, to correctly set the interface name based on the NIC_%N_NAME environment variable.

-danny

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.