/srv/irclogs.ubuntu.com/2022/11/22/#cloud-init.txt

=== cpaelzer_ is now known as cpaelzer
=== janitha75 is now known as janitha7
=== jrm2 is now known as jrm
blackboxswmeena: sorry for the question out of left field. Do you know if kenv kernel env var names are synonymous across freebsd, openbsd, netbsd, dragonflybsd etc? I ask because I'm wondering if this check should actually be is_BSD() https://github.com/canonical/cloud-init/blob/main/cloudinit/dmi.py#L16121:27
dchI'm trying unsuccessfully to get userdata scripts to execute.22:36
dch- `cloud-init query --all | jq .userdata` returns "#cloud-config\nruncmd:\n ...' as expected22:37
dch- passing a shell script also produces the expected result `loud-init query --all | jq .userdata "#!/bin/sh\...`22:38
dchbut logs and filesystem don't show these as executing22:38
dchthere is no `allow_userdata: false` key, and AFAICT I'm following https://cloudinit.readthedocs.io/en/latest/topics/format.html#user-data-script22:45
=== SirScott6 is now known as SirScott
=== kenyon_ is now known as kenyon
falcojrdch: can you provide a pastebin of /var/log/cloud-init.log and/or your userdata?23:11
dchhmmm `cloud-init status` returns "running" but no processes remain23:11
blackboxswsystemctl list-units --type=service --state=active # probably will also show you someting is hung or incomplete etc.23:12
dchthis is FreeBSD 13.1-RELEASE amd64 with py39-cloud-init-22.3.4 btw23:13
dchI don't have a cloudinit.log for some reason, but here is the various userdata etc23:14
dchuserdata https://git.sr.ht/~dch/cloud-confused/tree/main/item/var/lib/cloud/instances/5f05e50c-79bc-4d26-841c-4176dd41566d/user-data.txt23:14
dchfalcojr: btw this repo is the snapshot of /var/lib/cloud and the config /usr/local/etc/cloud/ off the system post-cloudinit running23:15
blackboxswhrm, ok BSD. `sudo cloud-init schema --system` should check that user-data provided is right format and header23:15
dchstatus.json https://git.sr.ht/~dch/cloud-confused/tree/main/item/var/lib/cloud/data/status.json shows no errors AFAICT23:15
blackboxswahh sorry cloud-init schema --system is only for #cloud-config specifically :/23:16
blackboxswscript looks fine to me23:16
dch# cloud-init schema --system Error: Cloud config schema errors: format-l1.c1: File None needs to begin with "#cloud-config"23:16
dch"computer says No"23:16
blackboxswheh23:16
blackboxswtoo true now that I know your user-data isn't #cloud-config  different set of tools :/23:17
dchlet me restart one and get the console log, it has all the cloudinit logs that we expect to see23:17
blackboxswyour  https://git.sr.ht/~dch/cloud-confused/tree/main/item/var/lib/cloud/data/status.json also shows that none of the other boot stages ran 23:17
dchinteresting. I'm not yet familiar enough with all these files to know what I should expect23:18
dchI'll stick with a basic shell script atm, in case #cloud-config has bsd-related bugs23:19
blackboxswI'd expect to see both a start and finished time for modules-config, modules-final and init-local. So those separate rc.d services are not being started in your image for some reason23:19
blackboxswit looks like the only boot stage that ran was 'init' stage in this image in order to discover the Ec2 datasource. modules-(config|final) is where all the user-data is acted upon23:19
blackboxswper https://canonical-cloud-init.readthedocs-hosted.com/en/latest/topics/boot.html23:20
blackboxswtypically these stages are skipped in Linux if there is a system ordering dependency cycle that forces cloud-init's separate systemd init scripts from being run in the current boot target.23:21
dchok so once this next fresh boot finishes, I will re-run cloudinit locally without rebooting, this should be a bit easier to deal with23:22
dchblackboxsw: btw I can't read that rtd-hosted URL, it requires GH auth and then 40423:22
dchhttps://cloudinit.readthedocs.io/en/latest/topics/boot.html is presumably close enough?23:23
blackboxswoops. my bad, we just started setting up a paid offering without RTD adds and not up for public consumption yet. It is exactly the same, sorry about mis-link there23:25
blackboxswboth are a direct mirror of each other.23:25
blackboxswyes dch, there should be four rc.d scripts to get cloud-init functioning properly (and those init scripts should run the following in order23:27
blackboxswsudo cloud-init init --local23:27
blackboxswsudo cloud-init init23:27
dchthis is annoying, it was working a few months ago, and our new release broke something... hope to track bug down23:27
blackboxswsudo cloud-init modules --mode=config23:27
blackboxswsudo cloud-init modules --mode=final23:27
dchok, now with logs! https://git.sr.ht/~dch/cloud-confused/tree/main/item/console.log23:28
dchhttps://git.sr.ht/~dch/cloud-confused/tree/main/item/console.log#L63023:28
dchL764 we got metadata ok23:28
dchL816 we skip network deliberately23:29
blackboxswwhat I see in that boot log is https://git.sr.ht/~dch/cloud-confused/tree/main/item/console.log#L631  only the 'init' stage was run, no 'init-local'  'modules:config' or 'modules:final' stage log header when starting each boot stage23:30
blackboxsw+1 on proper meta-data detected for Ec2 datasource discovery in L 764, yeah just nothing seems to have called `sudo cloud-init modules --mode=config` or --mode-final for the final two boot stages23:31
blackboxsw+1 on proper meta-data detected for Ec2 datasource discovery in L 764, yeah just nothing seems to have called `sudo cloud-init modules --mode=config` or `--mode-final` `for the final two boot stages23:32
dchhmm23:33
dch"normally" on FreeBSD we just use `cloudinit_enable=YES` and that's all that's required to run the full gamut23:33
blackboxswHere are our systemd services templates for modules:config stage[1]  and modules:final (each is separate in Linux)23:34
blackboxsw1.  https://github.com/canonical/cloud-init/blob/main/systemd/cloud-config.service.tmpl23:34
blackboxsw2. https://github.com/canonical/cloud-init/blob/main/systemd/cloud-final.service.tmpl23:34
dchblackboxsw: thanks for your diag help here, is there a log of a working one you can point me towards?23:34
blackboxswI'd expect something in rc.d for each of those23:34
dchdoesn't have to be FreeBSD, I just need to see what line we're missing23:34
blackboxswsure. and cloud-init analyze show typically organizing this output based on boot stages. one sec23:34
dchon bsd here I have cloudinit, cloudinitlocal cloudfinal, cloudconfig23:34
dchfor example, this config is what we deploy in Oracle Cloud. Let me check if that still works...23:35
dchok, `cloud-init analyze blame|show|dump` all blow up23:39
dchhttps://www.irccloud.com/pastebin/Zy4Osq8R/cloudinit_analyze_dump23:39
dchpresumably this is because there's no log file to digest23:43
blackboxswsorry crashed my browser: https://paste.opendev.org/show/bQuuSdQMl12zyPz9DQtT/23:44
blackboxswon linux: absence of /var/log/cloud-init.log isn't a trace23:46
blackboxswroot@dd-j:~# cloud-init analyze show23:46
blackboxswCannot open file /var/log/cloud-init.log23:46
dchok!23:46
dchwe got it23:46
blackboxswbut that could be just a newer commit 23:46
dchyou are (all) right23:47
dchcloudfinal needs to be run23:47
dchthis also causes `cloudinit status` to be "done"23:47
blackboxswok so I'm curious when you find out what's off if you can give feedback on which rc.d script wasn't running or why23:47
blackboxswjust for our context23:47
dchyeah I think we can improve the port by adding a short message "enable these things or you will fail"23:48
blackboxswyeah good note: also `cloud-init status --format json`should give more information about the reasons we are in waiting state (it'll be in cloud-init version 22.4 )23:49
blackboxswdoesn't help today, but we could raise a bigger warning message if we are blocked on different stages not yet run23:50
blackboxswhttps://paste.opendev.org/show/biPxW0DUiq8xbx6lZkIl/23:50
dchok now we have this all figured out, I think there are 3 things:23:54
dch1. the FreeBSD port should be clear that you need to run all the commands now23:54
dch2. it shouldn't put stuff in /run/cloud-init/ but use /var/run/cloud-init/ like other BSD stuff23:55
dch3. it should (by default) produce logs. they are useful.23:55
dch4. the existence of the 4 boot rc.d scripts should be clarified.23:55
dchI think all of these can be addressed downstream23:56
dch5. I owe you all some sort of beverage. Perhaps I should come to FOSDEM for the first time.23:56
blackboxswsounds like a great plan, and anything that makes sense upstream we would like to incorporate23:56
blackboxswBoom FOSDEM'd be nice that'd make two of us for first timers.23:57
blackboxsw-> have to head out for dinner EndofDay. Take care thx for the help on BSD23:58
dchI checked, I copypasted my cloudinit stuff from the FreeBSD openstack deployment. 23:58
dchI guess none of these worked fully.23:58
dchalthough, reading my OCI patch, I definitely tested this and had it working. 23:59
dchhttps://reviews.freebsd.org/D3474623:59
dchthat was ~ a year ago maybe?23:59

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