RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1363633 - [cloud-init] - cloud-init should finish before NetworkManager starts or run ifdown ifup after cloud-init is finished
Summary: [cloud-init] - cloud-init should finish before NetworkManager starts or run i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cloud-init
Version: 7.2
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Lars Kellogg-Stedman
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1413151
TreeView+ depends on / blocked
 
Reported: 2016-08-03 09:07 UTC by Michael Burman
Modified: 2024-11-21 09:28 UTC (History)
8 users (show)

Fixed In Version: cloud-init-0.7.9-1.el7
Doc Type: Bug Fix
Doc Text:
Due to a race condition between the cloud-init application and the NetworkManager utility, systems with cloud-init set up in some cases booted with an incorrect network configuration. This update ensures that the cloud-init-local service runs before NetworkManager starts and that the cloud-init service runs afterwards. As a result, the described problem no longer occurs.
Clone Of:
: 1413151 (view as bug list)
Environment:
Last Closed: 2017-04-04 15:26:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
messages logs (25.67 KB, application/x-gzip)
2016-08-03 09:07 UTC, Michael Burman
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0871 0 normal SHIPPED_LIVE cloud-init and cloud-utils-growpart bug fix and enhancement update 2017-04-04 19:25:15 UTC

Description Michael Burman 2016-08-03 09:07:27 UTC
Created attachment 1186987 [details]
messages logs

Description of problem:
[clout-init] - cloud-init should finish before NetworkManager starts or run ifdown ifup after cloud-init is finished.

This bug a new and clear version of - BZ 1288819 that was very long and confusing.

The bug is that cloud-init comes up after the NetworkManager and that can cause to some problems like:
cloud-init with static ip configuration can end up that the guest OS is up with ip from dhcp, cause NetworkManager finished first. 

The solution should be-
- cloud-init should finish before NetworkManager starts
- run ifdown and ifup after cloud-init finished or run restart network when cloud-init ends

cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BOOTPROTOv6=dhcp
ONBOOT=yes
TYPE=Ethernet
USERCTL=yes
PEERDNS=yes
IPV6INIT=yes
PERSISTENT_DHCLIENT=1
NETMASK=255.255.255.0
IPADDR=8.8.8.8
GATEWAY=8.8.8.254

Version-Release number of selected component (if applicable):
cloud-init-0.7.6-6.el7.x86_64

How reproducible:
100

Steps to Reproduce:
1. Create VM with rhel7.2 image and configure the cloud-init with static ip configuration.
It means that the guest should be up with static ip and ifcfg-eth0 with static config.

Actual results:
But from the messages and dmesg logs it is seems like the NetworkManager configures the eth0 nic first(eth0 get ip from dhcp) and only then cloud-init touch the nic. 

cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BOOTPROTOv6=dhcp
ONBOOT=yes
TYPE=Ethernet
USERCTL=yes
PEERDNS=yes
IPV6INIT=yes
PERSISTENT_DHCLIENT=1
NETMASK=255.255.255.0
IPADDR=8.8.8.8
GATEWAY=8.8.8.254

Expected results:
cloud-init should finish before NetworkManager starts or run ifdown ifup after cloud-init is finished.

Additional info:
To work around it we need to restart network or reboot guest. 

See also BZ 1288819

Comment 2 Lars Kellogg-Stedman 2016-12-05 15:40:58 UTC
The systemd units in upstream cloud-init have gone through a number of changes recently to improve the ordering of things w/r/t networking.  These changes will be available in the next release of our cloud-init package, which I am working on right now.

Comment 3 Lars Kellogg-Stedman 2016-12-07 22:59:24 UTC
How are you providing a static ip configuration?  If you are doing that via a userdata script, would you please attach that to this bug report?  If you are doing that via some other mechanism, let me know.   Thanks!

Comment 4 Michael Burman 2016-12-08 12:28:29 UTC
Hello Lars

I'm using the rhv-m ui in order to configure the static ip in the clout-init.
And there is a custom-script in cloud-init via run once or edit vm.

I think that the custom-script should be similar to something like:

network-interfaces: |
  auto lo
  iface lo inet loopback

  iface eth0 inet static
    address xxx.xxx.xxx.xxx (static ip)
    netmask xxx.xxx.xxx.xxx
    gateway xxx.xxx.xxx.xxx (gateway ip, usually ip address of router)

Comment 9 Lars Kellogg-Stedman 2017-01-16 14:02:16 UTC
Awesome, thank you for verifying the fix!

Comment 14 errata-xmlrpc 2017-04-04 15:26:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:0871


Note You need to log in before you can comment on or make changes to this bug.