cannot disable cloud-init networking despite trying hard

Bug #1862702 reported by Dimitri John Ledkov
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Fix Released
Chad Smith

Bug Description

$ cat /proc/cmdline
network-config={config:disabled} ip= vlan=encc000.2653:encc000 url= --- quiet

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/", line 653, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/", line 362, in main_init
    init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
  File "/usr/lib/python3/dist-packages/cloudinit/", line 678, in apply_network_config
    netcfg, src = self._find_networking_config()
  File "/usr/lib/python3/dist-packages/cloudinit/", line 637, in _find_networking_config
    NetworkConfigSource.cmdline: cmdline.read_kernel_cmdline_config(),
  File "/usr/lib/python3/dist-packages/cloudinit/net/", line 276, in read_kernel_cmdline_config
    return util.load_yaml(_b64dgz(data64))
  File "/usr/lib/python3/dist-packages/cloudinit/net/", line 256, in _b64dgz
    blob = base64.b64decode(b64str)
  File "/usr/lib/python3.7/", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

$ dpkg -l | grep cloud-init
ii cloud-init 19.4-56-g06e324ff-0ubuntu1 all initialization and customization tool for cloud instances


$ cat /proc/cmdline
network-config=e2NvbmZpZzogZGlzYWJsZWR9 ip= vlan=encc000.2653:encc000 url= --- quiet

works fine (i.e. b64encoded)

This is on s390x

Tags: s390x
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I also have

  config: disabled

in /etc/cloud/cloud.cfg but it is ignored.

Revision history for this message
Dan Watkins (oddbloke) wrote :

Hey Dimitri, can you run `cloud-init collect-logs` on an affected instance, attach the tarball here, and then move this back to New, please? Thanks!

Changed in cloud-init (Ubuntu):
status: New → Incomplete
Revision history for this message
Ryan Harper (raharper) wrote :

The kernel cmdline reader for network-config= expects base64 input, however documentation suggests that network-config is *optionally* base64 encoded.

Disabling Network Configuration

Users may disable `Cloud-init`_ 's network configuration capability and rely
on other methods, such as embedded configuration or other customizations.

`Cloud-init`_ supports the following methods for disabling cloud-init.

**Kernel Command Line**

`Cloud-init`_ will check for a parameter ``network-config`` and the
value is expected to be YAML string in the :ref:`network_config_v1` format.
The YAML string may optionally be ``Base64`` encoded, and optionally
compressed with ``gzip``.

Example disabling kernel command line entry: ::

  network-config={config: disabled}

This is incorrect; encoding to base64 is *required* and *gzipping* base64 is optional.

We could make the change to accept the disable config unencoded; I do think that would be
the nice thing to do; alternatively, we can update the documentation to have the example
already b64 encoded:

@Dimitri, the /etc/cloud config file is not reached; cloud-init reads the kernel cmdline first and fails.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :


I'd like to have a non-base64/non-gzipped way to disable the networking

and I first tried just the /etc/cloud snippet of network disabled, but that didn't work because I also had ip= on the kernel command line, and cloud-init still did automatic built-in network discover.

Are the /etc/cloud files ignored, if there is ip= vlan= specification on the kernel command line? (which cloud-init fails to parse and maintain correctly)

I'm stuck between this bug and

Chad Smith (chad.smith)
Changed in cloud-init (Ubuntu):
status: Incomplete → Triaged
assignee: nobody → Chad Smith (chad.smith)
importance: Undecided → Medium
Revision history for this message
Chad Smith (chad.smith) wrote :

Upstream branch put up that will allow network-config=disabled as kernel cmdline

Changed in cloud-init (Ubuntu):
status: Triaged → Won't Fix
status: Won't Fix → In Progress
Revision history for this message
Chad Smith (chad.smith) wrote :

An upstream commit just landed with this changeset

It will make it into Ubuntu Focal images this week.

Changed in cloud-init (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Chad Smith (chad.smith) wrote :

A version of cloud-init containing this fix was published to Ubuntu Focal (20.04) cloud-init 20.1-9-g1f860e5a-0ubuntu1.

If this is still a problem for you, please re-open this bug or submit a new bug with related context.

Changed in cloud-init (Ubuntu):
status: Fix Committed → Fix Released
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.