Skip to content

cloud-init pre-networking fails if kernel cmdline defines static ip #3219

@ubuntu-server-builder

Description

@ubuntu-server-builder

This bug was originally filed in Launchpad as LP: #1785275

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = 2023-03-23T20:10:35.581735+00:00
date_created = 2018-08-03T15:56:24.600284+00:00
date_fix_committed = 2020-02-03T19:49:14.301397+00:00
date_fix_released = 2023-03-23T20:10:35.581735+00:00
id = 1785275
importance = medium
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1785275
milestone = None
owner = tracy-meyers
owner_name = Tracy Meyers
private = False
status = fix_released
submitter = tracy-meyers
submitter_name = Tracy Meyers
tags = []
duplicates = []

Launchpad user Tracy Meyers(tracy-meyers) wrote on 2018-08-03T15:56:24.600284+00:00

cloud-init pre-networking fails when grub is configured to use a static IP with the 'autoconf' field set to 'none' (https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt).

Cloud provider: vsphere

Static IP is configured here (/etc/default/grub).

https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt

off or none: don't use autoconfiguration (do static IP assignment instead)

GRUB_CMDLINE_LINUX=ip=10.121.105.37::10.121.104.1:255.255.252.0::eth0:none

Error:
File "/usr/lib/python3/dist-packages/cloudinit/net/cmdline.py", line 58, in _klibc_to_config_entry
raise ValueError("Unexpected value for PROTO: %s" % proto)
ValueError: Unexpected value for PROTO: none

Workarounds:
Option 1. Change the grub config to use 'dhcp' even though it defines most of the fields statically
GRUB_CMDLINE_LINUX=ip=10.121.105.37::10.121.104.1:255.255.252.0::eth0:dhcp

Option 2. Patch to normalize 'none' to 'static' (I'd guess there's a more proper fix further up the call)
--- /usr/lib/python3/dist-packages/cloudinit/net/cmdline.py.orig 2018-08-03 15:44:11.204005997 +0000
+++ /usr/lib/python3/dist-packages/cloudinit/net/cmdline.py 2018-08-03 15:44:15.448006149 +0000
@@ -52,6 +52,8 @@
else:
proto = 'static'

  • if proto == 'none':
  •    proto = 'static'
    
    if proto not in ('static', 'dhcp', 'dhcp6'):
    raise ValueError("Unexpected value for PROTO: %s" % proto)

Metadata

Metadata

Assignees

No one assigned

    Labels

    launchpadMigrated from Launchpad

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions