/srv/irclogs.ubuntu.com/2020/06/14/#cloud-init.txt

bswinnertonHello, first time playing around with cloud init. Things are going great in Ubuntu, but having some problems configuring networking in Debian. I'm using a nocloud database with a v2 network configuration file to set a static ip address. The user-data and meta-data is applied successfully, but after the machine comes up, it's falling back to DHCP.12:21
bswinnertonUpon further inspection, this is because /etc/network/interfaces does a source-directory for both /etc/network/interfaces.d/ (which has the correctly configured file), and /run/network/interfaces.d/ which has a file that conflicts and falls back to DHCP. Is there a way to turn off the latter?12:21
bswinnertons/database/datastore12:25
bswinnertonhmm, there's also something weird going on similar to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=86792112:36
ubot5Debian bug 867921 in openstack-debian-images "cloud-init: Network configuration doesn't work" [Normal,Fixed]12:36
bswinnertonSo to recap, when using nocloud with a v2 network config that sets a static ip address, when the Debian host comes up, a few things need to happen in order for the machine to get networking: 1) `rm /run/network/interfaces.d/50-cloud-init.cfg` (which includes the DHCP setting), and 2) `mv /etc/network/interfaces.d/50-cloud-init.cfg12:38
bswinnerton/etc/network/interfaces.d/50-cloud-init`, once those have been completed, a `systemctl restart networking` can be run and everything works fine.12:38
bswinnertonThis is cloud-init 18.312:39
meenabswinnerton: have you tried a more recent version to see if this is fixed?13:46
bswinnertonI haven't, I'm using what's built into the debian cloud images13:47
bswinnertonIn what scenarios would cloud-init write to `/run/network/interfaces.d/`? Is that the fallback described in https://cloudinit.readthedocs.io/en/latest/topics/network-config.html#fallback-network-configuration?13:56
meenaI'm trying to remember if we have deb packages pre-built anyhere13:57
meenamy brain isn't working very well today, so you might be quicker looking yourself13:58
bswinnertonhttps://packages.debian.org/buster/cloud-init13:59
bswinnertonThey're quite old, which is why the debian images include them, I assume13:59
meenano backports?14:00
bswinnertonah yes: https://packages.debian.org/source/buster-backports/cloud-init14:00
meenathere's https://launchpad.net/ubuntu/+source/cloud-init but i don't know how well those will work on Debian14:00
meenabswinnerton: so let's try at version, and if that still fails, we'll file a bug report14:03
meenaand by we, i mean, can you please14:03
meenas/at /that /14:04
bswinnertonSounds good, installing 20.2 now14:05
bswinnertonIs there an effective way to test this with cloud-init on the guest without rebuilding the image?14:07
bswinnertonOr does the image need to be rebuilt?14:07
meenainstall, run cloud-init clean --logs --reboot14:07
bswinnertonNeat, wasn't aware of `clean`. Doing that now14:08
meenathat will regenerate everything on the server, including ssh server keys14:08
bswinnertonSigh, that fixed it14:10
bswinnertonOkay, off to pester the Debian folks. Thanks meena14:11
meena😽14:11
meenaif i really were useful, I'd help you pinpoint where that was fixed, exactly14:12
meenabut screw that, let them upgrade to the latest version :P14:12
bswinnertonA quick clarifying question, even after bumping to 20.2 I notice a very long delay when trying to bring up the interface, it appears that it's trying to get a DHCP lease with "Started ifup for ens3". It then eventually times out and continues along, and sets the static IP. Any idea how I could tell it not to try and DHCP? Is that the difference14:13
bswinnertonbetween a dsstore of local vs net?14:13
bswinnertonI have a feeling it was this: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=86792114:13
ubot5Debian bug 867921 in openstack-debian-images "cloud-init: Network configuration doesn't work" [Normal,Fixed]14:13
bswinnertonBut the dates don't quite align14:13
meenaI'd have to see your full config to figure that out14:14
meenamaybe there's a v1 config sent with dhcp?14:14
bswinnertonIt's using v2 and no shouldn't be DHCP, but let me throw it in a gist for a second set of eyes14:14
meenacloud-init query14:15
meenasomething or the other14:15
bswinnertonHere's the user-data, meta-data, network-config that's being thrown into the nocloud datastore, as well as `cloud-init query -a`: https://gist.github.com/bswinnerton/86e2e44d4dee4b5271be92580afd056c14:18
bswinnertonStarted a conversation with the debian cloud folks here: https://lists.debian.org/debian-cloud/2020/06/msg00073.html14:28
bswinnertonAnswered my own question: it's not related to the local vs net dsstore option of cloud-localds. It still tries to get a lease on boot even with the value set to local14:34
bswinnertonI bet it's because of the dhcp config that lives in /run/network/interfaces.d/14:34
bswinnertonmeena: any idea where files in that directory come from? Is that part of cloud-init?14:34
bswinnertonOh yeah, that's definitely it. Removing the file leads to super quick boot times14:35
bswinnertonGod what a mess14:36
meenathat a patch from Debian?14:50
bswinnertonhttps://github.com/canonical/cloud-init/commit/a6faf3acef02bd8cd4d46ac9efeebf24b3f21d81.patch14:51
bswinnertonThat's the first problem, the second is the fact that a file gets added to `/run/network/interfaces.d/` that defaults to DHCP14:53
bswinnertonAnd I'm not sure where that comes from, but am working on terrible hacks with user-data to get rid of it14:53
meenalogs should be helpful14:55
meenamaybe14:55
bswinnertonNot seeing any references to that directory in the log, so it must be coming from the Debian cloud image15:00
bswinnertonIs runcmd the best hook for modifying network configurations early in the boot process? It only needs to run once15:01
meenanetwork is usually the first thing to be run, so there's almost no chance of doing anything before that dhcp thing17:15
meenaunless17:15
meenahttps://cloudinit.readthedocs.io/en/latest/topics/modules.html#bootcmd17:17
meenabswinnerton: this could be worth a shot, if you Anna rm that file, so you don't have to modify the image :D17:17
meenawanna17:21
meenai am now second stage tired / exhausted.17:22
meenaGood evening.17:22

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