← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1785275] [NEW] cloud-init pre-networking fails if grub defines static ip

 

Public bug reported:

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)

** Affects: cloud-init
     Importance: Undecided
         Status: New

** Attachment added: "cloud-init.tar.gz"
   https://bugs.launchpad.net/bugs/1785275/+attachment/5171214/+files/cloud-init.tar.gz

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1785275

Title:
  cloud-init pre-networking fails if grub defines static ip

Status in cloud-init:
  New

Bug description:
  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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1785275/+subscriptions


Follow ups