GATEWAY doesn't render VMWare

Bug #1821216 reported by John Jelinek
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Expired
Medium
Unassigned

Bug Description

cloud-init isn't rendered GATEWAY in /etc/sysconfig/network-scripts/ifcfg-eth0 with VMWare:
```
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEVICE=eth0
IPADDR=172.20.14.192
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
```

Here's the default amazon-linux2 cloud.cfg:
```
users:
 - default

disable_root: true
ssh_pwauth: false

mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
resize_rootfs: noblock
resize_rootfs_tmp: /dev
ssh_deletekeys: false
ssh_genkeytypes: ~
syslog_fix_perms: ~

datasource_list: [ NoCloud, AltCloud, ConfigDrive, OVF, None ]
repo_upgrade: security

cloud_init_modules:
 - migrator
 - bootcmd
 - write-files
 - growpart
 - resizefs
 - set-hostname
 - update-hostname
 - update-etc-hosts
 - rsyslog
 - users-groups
 - ssh

cloud_config_modules:
 - mounts
 - locale
 - set-passwords
 - yum-configure
 - yum-add-repo
 - package-update-upgrade-install
 - timezone
 - puppet
 - chef
 - salt-minion
 - mcollective
 - disable-ec2-metadata
 - runcmd

cloud_final_modules:
 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - scripts-user
 - ssh-authkey-fingerprints
 - keys-to-console
 - phone-home
 - final-message

system_info:
  default_user:
    name: ec2-user
    lock_passwd: false
    gecos: EC2 Default User
    groups: [wheel, adm, systemd-journal]
    sudo: ["ALL=(ALL) NOPASSWD:ALL"]
    shell: /bin/bash
  distro: amazon
  paths:
    cloud_dir: /var/lib/cloud
    templates_dir: /etc/cloud/templates
  ssh_svcname: sshd

chpasswd:
   expire: false

disable_vmware_customization: false
# vim:syntax=yaml
```

Revision history for this message
John Jelinek (john-z) wrote :
Revision history for this message
Ryan Harper (raharper) wrote :

Hi,

Thanks for filing a bug and attaching the logs.

Looking at the logs, it appears that the image has some modifications: namely, something created /etc/udev/rules.d/70-persistent-net.rules as a _directory_; which it is typically a file that cloud-init writes data. This is the traceback in the logs:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 655, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 361, in main_init
    init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
  File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 659, in apply_network_config
    return self.distro.apply_network_config(netcfg, bring_up=bring_up)
  File "/usr/lib/python2.7/site-packages/cloudinit/distros/__init__.py", line 179, in apply_network_config
    dev_names = self._write_network_config(netconfig)
  File "/usr/lib/python2.7/site-packages/cloudinit/distros/rhel.py", line 56, in _write_network_config
    return self._supported_write_network_config(netconfig)
  File "/usr/lib/python2.7/site-packages/cloudinit/distros/__init__.py", line 98, in _supported_write_network_config
    renderer.render_network_config(network_config=network_config)
  File "/usr/lib/python2.7/site-packages/cloudinit/net/renderer.py", line 53, in render_network_config
    network_state=parse_net_config_data(network_config), target=target)
  File "/usr/lib/python2.7/site-packages/cloudinit/net/sysconfig.py", line 607, in render_network_state
    util.write_file(netrules_path, netrules_content, file_mode)
  File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 1860, in write_file
    with open(filename, omode) as fh:
IOError: [Errno 21] Is a directory: '/etc/udev/rules.d/70-persistent-net.rules'

Can you see if your image before booting includes that path as a directory and remove that and try again?

Changed in cloud-init:
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
John Jelinek (john-z) wrote :

I rebuilt, removing the directory you mentioned and got new logs. I've printed the cloud-init-output.log and attached the cloud-init.log:

Cloud-init v. 18.2-72.amzn2.0.7 running 'init-local' at Thu, 02 May 2019 00:38:44 +0000. Up 9.00 seconds.
Cloud-init v. 18.2-72.amzn2.0.7 running 'init' at Thu, 02 May 2019 00:38:55 +0000. Up 19.97 seconds.
ci-info: +++++++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++++++
ci-info: +--------+------+---------------+---------------+--------+-------------------+
ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
ci-info: +--------+------+---------------+---------------+--------+-------------------+
ci-info: | eth0 | True | 172.20.14.192 | 255.255.255.0 | global | 00:50:56:84:4f:6c |
ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | host | . |
ci-info: +--------+------+---------------+---------------+--------+-------------------+
ci-info: +++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++
ci-info: +-------+-------------+---------+---------------+-----------+-------+
ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
ci-info: +-------+-------------+---------+---------------+-----------+-------+
ci-info: | 0 | 169.254.0.0 | 0.0.0.0 | 255.255.0.0 | eth0 | U |
ci-info: | 1 | 172.20.14.0 | 0.0.0.0 | 255.255.255.0 | eth0 | U |
ci-info: +-------+-------------+---------+---------------+-----------+-------+
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: | Route | Destination | Gateway | Interface | Flags |
ci-info: +-------+-------------+---------+-----------+-------+
ci-info: +-------+-------------+---------+-----------+-------+
Cloud-init v. 18.2-72.amzn2.0.7 running 'modules:config' at Thu, 02 May 2019 00:38:56 +0000. Up 20.80 seconds.
Loaded plugins: langpacks, priorities, update-motd
https://cdn.amazonlinux.com/2/core/2.0/x86_64/6b3b97044ef1b82f2b9d1a39eb94eb0a201e1e70311d576e25d9b66195edcc42/repodata/repomd.xml?instance_id=fail&region=URLError: [Errno 14] curl#6 - "Could not resolve host: cdn.amazonlinux.com"
Trying other mirror.
Could not retrieve mirrorlist http://amazonlinux.default.amazonaws.com/2/core/latest/x86_64/mirror.list error was
14: curl#6 - "Could not resolve host: amazonlinux.default.amazonaws.com"
No packages needed for security; 0 packages available
No packages marked for update
Cloud-init v. 18.2-72.amzn2.0.7 running 'modules:final' at Thu, 02 May 2019 00:39:00 +0000. Up 24.99 seconds.
ci-info: no authorized ssh keys fingerprints found for user ec2-user.
Cloud-init v. 18.2-72.amzn2.0.7 finished at Thu, 02 May 2019 00:39:05 +0000. Datasource DataSourceOVF [seed=vmware-tools]. Up 29.76 seconds

Revision history for this message
John Jelinek (john-z) wrote :

I wasn't entirely clear in the last post: the problem still persists after addressing your recommendation.

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

I think I see the problem, in your IMC config, you have one nic, but have not set it as primary:

config_file.py[INFO]: Parsing the config file /var/run/vmware-imc/cust.cfg.
config_file.py[DEBUG]: FOUND CATEGORY = 'NETWORK'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NETWORK|NETWORKING' = 'yes'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NETWORK|BOOTPROTO' = 'dhcp'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NETWORK|HOSTNAME' = 'dfw-prd-consv-1'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NETWORK|DOMAINNAME' = 'containerstore.com'
config_file.py[DEBUG]: FOUND CATEGORY = 'NIC-CONFIG'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NIC-CONFIG|NICS' = 'NIC1'
config_file.py[DEBUG]: FOUND CATEGORY = 'NIC1'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NIC1|MACADDR' = '00:50:56:84:4f:6c'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NIC1|ONBOOT' = 'yes'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NIC1|IPv4_MODE' = 'BACKWARDS_COMPATIBLE'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NIC1|BOOTPROTO' = 'static'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NIC1|IPADDR' = '172.20.14.192'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NIC1|NETMASK' = '255.255.255.0'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'NIC1|GATEWAY' = '172.20.14.254'
config_file.py[DEBUG]: FOUND CATEGORY = 'DNS'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'DNS|DNSFROMDHCP' = 'no'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'DNS|SUFFIX|1' = 'containerstore.com'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'DNS|NAMESERVER|1' = '172.20.10.120'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'DNS|NAMESERVER|2' = '172.20.10.150'
config_file.py[DEBUG]: FOUND CATEGORY = 'DATETIME'
config_file.py[DEBUG]: ADDED KEY-VAL :: 'DATETIME|UTC' = 'yes'

Can you add under the [NIC1] section

PRIMARY = true ?

Changed in cloud-init:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for cloud-init because there has been no activity for 60 days.]

Changed in cloud-init:
status: Incomplete → Expired
Revision history for this message
James Falcon (falcojr) wrote :
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.