cloud-init init fails on 18.04 in the networking part

Bug #1747382 reported by Roman Plessl
30
This bug affects 7 people
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

I use the following cloud-init configuration works perfectly for Ubuntu 14.04, Ubuntu 16.04, Debian 8, Debian 9 and Centos 7 but not with the new Ubuntu 18.04

--- 8< 8< 8< ---
#cloud-config

datasource:
  Ec2:
    strict_id: false

hostname: my_cloudserver_name
phone_home:
  url: http://169.254.169.254/2009-04-04/done
  post: [ instance_id ]
  tries: 10

users:
  - default

ssh_authorized_keys:
  - "ssh-rsa AAA ....=="
--- 8< 8< 8< ---

The installation process hangs here and will fail:

2018-02-01 13:37:47,126 - DataSourceEc2.py[WARNING]: Did not find a fallback interface on EC2.
2018-02-01 13:37:47,126 - util.py[WARNING]: failed stage init
failed run of stage init
------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 650, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 357, in main_init
    init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
  File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 635, in apply_network_config
    netcfg, src = self._find_networking_config()
  File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 622, in _find_networking_config
    if self.datasource and hasattr(self.datasource, 'network_config'):
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceEc2.py", line 338, in network_config
    macs_to_nics = {net.get_interface_mac(iface): iface}
  File "/usr/lib/python3/dist-packages/cloudinit/net/__init__.py", line 506, in get_interface_mac
    if os.path.isdir(sys_dev_path(ifname, "bonding_slave")):
  File "/usr/lib/python3/dist-packages/cloudinit/net/__init__.py", line 38, in sys_dev_path
    return get_sys_class_path() + devname + "/" + path
TypeError: must be str, not NoneType
------------------------------------------------------------

after adding:

--- 8< 8< 8< ---
packages:
  - ifupdown
--- 8< 8< 8< ---

the cloud-init works as wished.

---
...
ci-info: +-------+---------------+---------------+-----------------+-----------+-------+
2018-02-01 14:19:41,576 - DataSourceEc2.py[WARNING]: Metadata 'network' key not valid: None.
2018-02-01 14:19:41,777 - cc_resizefs.py[WARNING]: Device '/dev/vda1' did not exist. cannot resize: dev=/dev/vda1 mnt_point=/ path=/
Generating public/private rsa key pair.
...
---

It seems there is a dependency in cloud-init to the pre-netplan networking system in 18.04.

Revision history for this message
Roman Plessl (roman-plessl) wrote :

root@cloud-nine-141:/var/lib/cloud# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu Bionic Beaver (development branch)
Release: 18.04
Codename: bionic

Revision history for this message
Roman Plessl (roman-plessl) wrote :

root@cloud-nine-141:/var/lib/cloud# apt-cache policy cloud-init
cloud-init:
  Installed: 17.2-13-g6299e8d0-0ubuntu1
  Candidate: 17.2-13-g6299e8d0-0ubuntu1
  Version table:
 *** 17.2-13-g6299e8d0-0ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in cloud-init (Ubuntu):
status: New → Confirmed
Revision history for this message
James Falcon (falcojr) wrote :

If this is still reproduceable on supported versions of Ubuntu, please re-open a new issue and attach logs.

Changed in cloud-init (Ubuntu):
status: Confirmed → Won't Fix
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.