Bug 276504 - net/cloud-init-devel: Fails to configure the network
Summary: net/cloud-init-devel: Fails to configure the network
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-21 18:44 UTC by Chuck Tuffli
Modified: 2024-03-13 07:48 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (freebsd)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chuck Tuffli freebsd_committer freebsd_triage 2024-01-21 18:44:35 UTC
I've created a FreeBSD 14.0 VM image using poudriere and added cloud-init. When the VM boots, cloud-init runs but generates a Python exception while trying to configure the network:

Cloud-init v. 23.4-68-g8937b5e5a running 'init-local' at Sun, 21 Jan 2024 16:56:14 +0000. Up 3.5224802494049072 seconds.
2024-01-21 16:56:15,020 - util.py[DEPRECATED]: The use of `gateway4` and `gateway6` is deprecated in 22.4 and scheduled to be removed in 27.4. For more info check out: https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html
2024-01-21 16:56:15,028 - util.py[WARNING]: failed stage init-local
failed run of stage init-local
------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/cloudinit/cmd/main.py", line 781, in status_wrapper
    ret = functor(name, args)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/cmd/main.py", line 442, in main_init
    init.apply_network_config(bring_up=bring_up_interfaces)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/stages.py", line 1037, in apply_network_config
    return self.distro.apply_network_config(
  File "/usr/local/lib/python3.9/site-packages/cloudinit/distros/__init__.py", line 412, in apply_network_config
    network_state = parse_net_config_data(netconfig, renderer=renderer)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/net/network_state.py", line 1107, in parse_net_config_data
    nsi.parse_config(skip_broken=skip_broken)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/net/network_state.py", line 305, in parse_config
    self.parse_config_v2(skip_broken=skip_broken)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/net/network_state.py", line 361, in parse_config_v2
    self._v2_common(command)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/net/network_state.py", line 825, in _v2_common
    self._handle_individual_nameserver(name_cmd, iface)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/net/network_state.py", line 119, in decorator
    return func(self, command, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/net/network_state.py", line 603, in _handle_individual_nameserver
    _iface[iface]["dns"] = {"nameservers": nameservers, "search": search}
KeyError: 'vtnet0'
------------------------------------------------------------
Cloud-init v. 23.4-68-g8937b5e5a running 'init' at Sun, 21 Jan 2024 16:56:15 +0000. Up 4.114490270614624 seconds.
ci-info: ++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++
ci-info: +--------+-------+----------------+------------+-------+-------------------+
ci-info: | Device |   Up  |    Address     |    Mask    | Scope |     Hw-Address    |
ci-info: +--------+-------+----------------+------------+-------+-------------------+
ci-info: |  lo0   |  True |   127.0.0.1    | 0xff000000 |   .   |         .         |
ci-info: |  lo0   |  True |    ::1/128     |     .      |   .   |         .         |
ci-info: |  lo0   |  True | fe80::1%lo0/64 |     .      |  0x2  |         .         |
ci-info: | vtnet0 | False |       .        |     .      |   .   | 58:9c:fc:01:ba:ff |
ci-info: +--------+-------+----------------+------------+-------+-------------------+
ci-info: 

# cat /run/cloud-init/tmp/network-config
version: 2
ethernets:
  id0:
    set-name: eth0
    match:
      macaddress: "58:9c:fc:01:ba:ff"
    addresses:
      - 10.105.238.45/21
    gateway4: 10.105.232.1
    nameservers:
      search: []
      addresses: [10.77.113.90,10.110.135.51,10.77.113.91,10.110.135.52]

Note I experimented with changing the network-config to a) use routes instead of gateway4 and b) add a non-empty value for the search domains, but neither of these changes effected the above error.

VM info:
# uname -mrsv
FreeBSD 14.0-RELEASE-p3 FreeBSD 14.0-RELEASE-p3 #0: Mon Dec 11 04:56:01 UTC 2023     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
# cloud-init --version                                                                                                                                                                      /usr/local/bin/cloud-init 23.4-68-g8937b5e5a
# ifconfig
vtnet0: flags=1008802<BROADCAST,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
        options=80028<VLAN_MTU,JUMBO_MTU,LINKSTATE>
        ether 58:9c:fc:01:ba:ff
        media: Ethernet autoselect (10Gbase-T <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 127.0.0.1 netmask 0xff000000
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>