← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~raharper/cloud-init:fix/lp-1766287-run-after-udev-settle-service into cloud-init:master

 

Ryan Harper has proposed merging ~raharper/cloud-init:fix/lp-1766287-run-after-udev-settle-service into cloud-init:master.

Commit message:
cloud-init-local: use systemd-udev-settle.service to ensure stable nic names
    
The cloud-init-local.service expects that any network device name changes have
already been completed by the kernel or udev daemon.  While at least in Ubuntu
the systemd-udev-settle.service is enabled, nothing in the Ubuntu cloud images
by default has a Wants for this service so it does not run.
    
In some situations we've found that the renaming of interfaces from kernel names
(eth0, eth1, etc) to their persistent names (eno1, ens3, enp0s1, etc) may happen
after cloud-init-local has started where it reads values from sysfs about what
network devices are present, and which device to use as a fallback nic.
    
Subsequently, cloud-init-local would write out network configuration for a
kernel device name which would no longer be present by the time that networking
services start to bring up the devices.  The result is that the instance does
not get networking configured.  Prior to use of systemd-networkd, the Ubuntu
'networking.service' unit included a call to udevadm settle which is why this
race is not seen on a Xenial system.
    
LP: #1766287


Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1766287 in cloud-init: "18.04 minimal images on GCE intermittently fail to set up networking "
  https://bugs.launchpad.net/cloud-init/+bug/1766287

For more details, see:
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/344198
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~raharper/cloud-init:fix/lp-1766287-run-after-udev-settle-service into cloud-init:master.
diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl
index ff9c644..2babf05 100644
--- a/systemd/cloud-init-local.service.tmpl
+++ b/systemd/cloud-init-local.service.tmpl
@@ -3,6 +3,8 @@
 Description=Initial cloud-init job (pre-networking)
 {% if variant in ["ubuntu", "unknown", "debian"] %}
 DefaultDependencies=no
+Wants=systemd-udev-settle.service
+After=systemd-udev-settle.service
 {% endif %}
 Wants=network-pre.target
 After=systemd-remount-fs.service

Follow ups