/srv/irclogs.ubuntu.com/2016/10/27/#cloud-init.txt

rharpersmoser: when you get a change, https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1636912/ has some details re: networkd and cloud-init.service that pitti tracked down.  I'm going to see about testing out the change to cloud-init.service to include an After=systemd-networkd.service and see if that's resolves the ordering issue we're seeing13:44
rharpersmoser: playing with the networkd target and cloud-init.service;  I noticed that we say Before=network-online.target ; however, don't we want networking to be *up* when cloud-init.service runs (it may scan for network metadata services) ?15:06
smoserits weird.15:12
smosernetwork-online is an target15:12
smoserthat other things would wait for15:12
smoserto know that the network is up15:12
smoserand we want to block those things running until after cloud-init has run15:13
rharperhrm15:13
rharperok15:13
smoserwe want to force that bottleneck in boot15:13
rharperso, how do we handle the race between 'networking.service' being complete and the devices being UP15:13
rharperand when cloud-init running15:13
rharperand checking if networking is up (in the route output info)15:13
smoseryou're gonna make me think, eh15:13
smoserwe have walked through this, and the stuff is sane. but let me look15:14
rharperso, in my case, networkd runs, kicks of DHCP, takes 2 to 3 seconds; cloud-init.service runs almost the same time as networkd (just right after)15:14
rharperbut races the DHCP response15:14
rharperok15:14
smoseri'd not be completely sure, but pitti has helped me to be sure int he past15:14
rharperok, I updated the bug15:14
smoserbut obviously this is all really complex (and unforunatlye brittle)15:14
rharperso, if you recall any discussion about the ordering, add it there so we can clarify15:15
rharperI wonder if the serial execution of ifup  in networking.service naturally delays things15:15
rharpervs. networkd going daemon mode and async bringing up networking15:16
smoserso in ifupdown world, there is no race on 'networking.service'15:16
smoserif its done ('After') then stuff that is supposed to be up is up15:16
smoserwhich kind of makes sense.15:16
rharperright, but we have no daemon15:16
rharperrather there are two Exec=15:16
rharperstatements15:16
rharperboth have to run15:16
rharpersystemd-networkd can just spawn itself and report that it's done15:17
rharperit gets out of the way faster15:17
smoserwell it shouldnt do that15:17
rharperbut it takes roughly 3 seconds for the DHCP response to complete (according to the journal)15:17
rharperbut15:17
rharperthere's a sepatarate systemd-networkd-wait-online.service15:17
rharperwhich waits15:17
rharperbut again, that's a *start* of a unit15:17
rharpernot a completion15:17
rharperso things are "up" after -wait-online exits15:18
rharperwhich is roughly network-online.target15:18
smoserwell, it says (/lib/systemd/systemd-networkd-wait-online)15:18
smoserwhich *says* "Block until network is configured":15:18
rharperso maybe we can say Requires systemd-networkd-wait-online15:18
smoserso maybe we just want to be After systemd-networkd-wait-online15:18
smoseryeah15:18
rharperlemme try that15:18
smoserexcept... if htat is ogoing to cause issues when networkd is *not* used.15:19
rharpermaybe15:20
rharperI'll test both15:20
smoser /lib/systemd/systemd-networkd-wait-online15:24
smoseris blocking on my desktop right now15:24
smoser:-(15:24
rharperhrm15:29
rharpermay need to generate that15:29
rharperbased on if networkd is going to run15:29
rharperor something like that15:29
rharperah15:50
rharper[ INFO ] Network Service is not active.15:50
rharper[DEPEND] Dependency failed for Wait for Network to be Configured.15:50
rharper[DEPEND] Dependency failed for Initial cloud... job (metadata service crawler).15:50
rharperit's disabled by default if ifupdown is installed IIRC15:50
rharperbleh, I have it activated now, but it blocks continuously; and no idea why16:32
NerdyBikerAnyone know how I can reference an EC2 instance ID in a cloud config on CentOS6?17:02
NerdyBikerI've tried just using $INSTANCE_ID, want to use write_files to put it in a file17:03
NerdyBikerbeen suggested to set a variable in bootcmd section, but not a fan of how it looks, wasn't sure if that's the best/only way17:08
rharperNerdyBiker: you can readlink -f /var/lib/cloud/instance17:31
rharperthat's a symlink to the instances/$INSTANCE_ID of the current session17:32
rharperNerdyBiker: it also looks like /var/lib/cloud/data/instance-id includes the current instance id value17:42
rharpersmoser: well, after most of the day here; I'd say were in a wedge;  networkd really wants dbus.service; otherwise it just adds boot time;  in Xenial, we don't have resolved service; I suspect there we could drop the requirement; but it means divergent config and possible behavior19:26
smoser:-(19:30
smoserrharper, but well what about the After when networkd is not running19:32
smoserthat would block, right ?19:32
rharperI've not tested the non-networkd setup yet19:56
rharperjust trying to figure out how to get networkd and cloud-init to run in the right order (and without blocking excessively)19:56
=== Hazelesque_ is now known as Hazelesque
smoserok.20:18
rharperI wish there was an easy way to find out why a unit was skipped20:36
rharperok; I think have something;    if we drop the Requires , but use After=networking.service and After=systemd-networkd.service;  then there's no hang20:52
rharperin the case of networkd/nplan, the netplan generater will add systemd-networkd as a wanted target if /etc/netplan/*.yaml is present20:52
rharperthe one catch here is that, networking service still runs as well (ie, if you have both ifupdown and networkd/netplan installed)20:53
rharperI did have to update the cloud-config.target to Require cloud-init.service ;  it wasn't getting picked up after we dropped the networking requirement20:53
rharperthis stuff is just painful20:54
rharperin the bug, still discussing with pitti and slangasek as the UC16 image is "unique"20:54
smoserrharper, i dont know why you'd need 'Require' rather than just 'After' for cloud-config.target20:56
smoserthe difference (since they're clearly always installed together)  is that Require means only run if the other succeeds20:56
smoserwe want cloud-config.target to run anyway, as it may be needed.20:57
smoserits kind of failsafe.20:57
smoserbut that is my understanding of Require and After20:57
rharpersmoser: I agree21:01
rharperthere unfortunately isn't a systemctl --who-wants=cloud-init.service21:01
rharperso I can't tell *why* it isn't run21:01
rharperit just _isnt_21:01
rharperif I add just that line to the cloud-config.target21:01
rharperit works21:01
rharperthere's not much reason to run cloud-config if cloud-init.service fails though, right?21:02
rharpersmoser: note that cloud-init.service is *already* in the After= list  for cloud-config.target21:02
* rharper fiddles some more for the smallest set of changes21:03
smoserright.21:03
rharperso, I'm left wondering why it didn't run21:03
smoserlook at the journal21:03
rharperit says *nothing* about what didn't run21:03
smoserfor 'reaking'21:03
rharperthere wasn't a loop21:03
smoser(not freaking)21:03
smoserok21:03
rharperit's just not *wanted*21:03
rharperwhich is bizare21:03
smoserbreaking. that is what i was looking for.21:03
rharpercloud-init.target wants it21:03

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!