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

Smithx10Does cloud-init 19 not work with the latest netplan stuff?01:41
blackboxswSmithx10: it should. if a particular use-case isn't working, we'd love a bug. cloud-init should emit /etc/netplan/50-cloud-init.yaml on Ubuntu Bionic (18.04) or later04:33
Smithx10I got it to work04:33
Smithx10It took me a good 30 minutes to figure out what this thing was doing04:33
Smithx10i still kinda have no idea what its doing04:33
Smithx10but address !04:34
blackboxswyeah network-config for cloud-init could come from a variety of sources, kernel cmdline, datasource metadata or /etc/cloud/cloud.cfg.d files and cloud-init network renderers will spit out network configuration  files (sysconfig, /etc/network/interfaces/ or /etc/netplan) based on what distribution it detects it is running on.04:37
Smithx10yea, the logging is pretty errrr04:38
Smithx10Also figured otu that I had to reboot the machine in order for it to configure an interface04:38
blackboxswpretty noisy for sure04:38
Smithx10Or I was running the wrong commands04:38
Smithx10i was doing cloud-init clean and then unsetting the interface and downing it04:38
Smithx10then running cloud-init init and it wouldnt do anything with it04:39
Smithx10bouncing would configure it04:39
blackboxswSmithx10: it depends on the datasource(cloud platform)  you are running on what couldinit does. generally during reboot there are a number of stages where cloud-init wakes up and does some detection or configuration. All datasource and network config happens in either init-local stage (which is the command cloud-init init --local)    or init-networking stage (which is the cloud-init init  command you mentioned)04:42
Smithx10Best place to see that is in the Modules code?04:42
Smithx10What is donein local vs init?04:42
blackboxswSmithx10: trying to run those individual commands is not really a supported flow for cloud-init because  cloud-init does initial system configuration on boot (and actually runs the other configuration stages like modules and final which actually configure things like users and ssh keys etc.04:42
blackboxswso missing any of the stages will likely lead to a misconfigured or partially configured system04:43
Smithx10yea, I'm kind of blaming linux for this.04:43
blackboxswheh :) https://cloudinit.readthedocs.io/en/latest/topics/boot.html04:43
Smithx10The user is happy,  their Distro is gettin an addr now04:43
blackboxswSmithx10: to see what config modules are done in each stage: read /etc/cloud/cloud.cfg on your system04:44
blackboxswthe cloud_init_modules: list is what's run in init (network already up) stage04:44
blackboxswcloud_config_modules: list == https://cloudinit.readthedocs.io/en/latest/topics/boot.html#config  and cloud_config_final = https://cloudinit.readthedocs.io/en/latest/topics/boot.html#final04:46
blackboxswin local: some datasources that can be detected before network being up get checked for discovery so they can emit the right network config before the system brings up it's full network stack. the rest of the details should be in https://cloudinit.readthedocs.io/en/latest/topics/boot.html#local04:47
Smithx10hahaha04:55
Smithx10and this is all better than running a bash script04:55
Smithx10lol04:56
Smithx10Not the point of cloud-init, i get it :P04:56
Smithx10different problem04:56
Smithx10Thanks for the advice04:56
Smithx10I'll dive in tomorrow and with the docs in front of me find out more04:56
blackboxswhehe :)04:56
gfidentehi guys, can anyone point me to the code distinguishing when a node is at is firstboot vs not-first?09:52
gfidenteor maybe how is the instances id generated because I can clearly tell from the logs that it changed10:13
=== cpaelzer__ is now known as cpaelzer
MAbeeTThi,15:35
MAbeeTTI am trying to understand the cause of som errors logs in /var/lib/cloud-init.log I see this information https://pastebin.com/D4Fh4FmT15:36
MAbeeTTHow could I understand how to get more info? Thanks in advance.15:37
blackboxswMAbeeTT: looks like the hostname file  that was written what not written as proper json.. strange.  peeking one sec15:39
blackboxswMAbeeTT: check /var/lib/cloud/data/set-hostname on your system to see if it looks like json15:41
blackboxswyou can cat it and paste here if you like15:41
blackboxswor just ensure the following succeeds  python3 -c 'import json; print(json.load(open("/var/lib/cloud/data/set-hostname")))'15:42
MAbeeTTok, the idea is to understand how to proceed in next possible issues.15:45
* MAbeeTT n00b.15:45
blackboxswone thing to also check is egrep 'Trace|Failed' /var/log/cloud-init.log as any issues setting the hostname in the first place (and writing that original set-hostname file) would have been emitted there15:45
blackboxswso above that current failure I would have expected to see cloud writing to set-hostname too. so a grep set-hostname /var/log/cloud-init.log would show you the order of operations on hostname related activity15:47
MAbeeTTok, file says `/var/lib/cloud/data/set-hostname: empty15:48
MAbeeTT`15:49
blackboxswstrange as current cloud-init writes a dict always if it writes anything15:51
blackboxsw    write_json(prev_fn, {'hostname': hostname, 'fqdn': fqdn})15:51
blackboxswcloud-init -v and cloud-id commands will tell us a bit more15:51
blackboxswalso sudo cloud-init query --all will show you all metadata that cloud-init is looking at on your system (careful there may be sensitive information in there if you setup passwords and keys in your userdata)15:52
blackboxswand cloud-init query local_hostname  should show you the standardized metadata value that cloud-init is sourcing when trying to set hostname15:53
blackboxswfor more info: https://cloudinit.readthedocs.io/en/latest/topics/instancedata.html15:54
blackboxswultimately this could be a bug once you track down where /var/lib/cloud/data/set-hostname is being written as empty. if so, run "ubuntu-bug cloud-init" and it'll allow you to create a bug and attach the cloud-init logs.15:55
blackboxswif you are on Ubuntu that is. on other distros "cloud-init collect-logs" creates a tar of all artifacts/logs to aide in debugging)15:56
* MAbeeTT reading 15:57
MAbeeTTthis is a particualr instance ina lab, so there is no sensitie iformation, no problem. An error from my part is at the moment the best candidate for root cause. Anyway this is a good excuse for learning.16:00
MAbeeTTthis is an ubuntu focal (20.04) vm in a proxmox PVE server, the cloud-init is generated by proxmox pve tool. (as cdrom drive).16:01
blackboxswMAbeeTT: if you are providing user-data to the instance at boot, it generally is the most-likely source if deployment issues.  try "sudo cloud-init query userdata > my-userdata.yaml;   cloud-init devel schema --config-file my-userdata.yaml --annotate"    it will at least validate your userdata is proper yaml and may give hints about failures16:06
blackboxswrun that on the system exhibiting failures just to double check a couple things about proper whitespace formatting. ... it's still work in progress (as we need better schema coverage) but it may find some glaring issues16:07
blackboxswhttps://cloudinit.readthedocs.io/en/latest/topics/faq.html has some typical debug suggestions16:08
MAbeeTTgreat.16:09
MAbeeTTfrom the part of formatting it seems there are no problems `Valid cloud-config file /tmp/my-userdata.yml`16:12
blackboxswok, one ✔confirmed16:12
MAbeeTT`sudo egrep --color 'Trace|Failed' /var/log/cloud-init.log | wc -l 1` gives 3 tracebacks and 1 `Failed to get raw userdata in module rightscale_userdata`. Tis file is just last boot, previous boots are in cloud-init.log_ (just for clearance)16:18
MAbeeTTsudo cat /run/cloud-init/instance-data.json  | jq '.v1.local_hostname'16:27
MAbeeTTshows the previous hostname (previous to  cdrom rebuild and reboot)16:27
MAbeeTTwell, i will be investiating diring the weekend, thanks you so much!16:28
blackboxswrharper: is there anyway I can ammend the author of the latest commit without forcing people to rebase? Somehow my last squash and merge for AWS Fred's PR ended up giving 'me' authorship'18:08
blackboxswmaybe it's that the last commit on his branch he attributed to me via Test provided by: Chad Smith <chad.smith@canonical.com>18:09
rharperblackboxsw: hrm;   ISTR we had something like this before18:09
rharperI thought it was supposed to have multiple authors or something like that18:09
blackboxswI think we might have to add the directive Authored-by: <pr submitter> if it has multiple attributions18:12
rharperhrm18:13
rharperI'm out of my gitfu level here...18:13
blackboxswstrange is that that merge commit doesn't even have a merge marker from me vs the author like other merges I've squashed using the github ui18:15
rharperit wouldn't be terrible to amend with author fix;18:17
blackboxswrharper: but that changes the commitish, so it might break consumers of tip18:18
rharperdoing that sooner rather than later will reduce the number of rebases needed, no ?18:18
rharperonly if they've pulled since that commit ?18:18
blackboxswyes18:18
rharperI'm not saying do it Right Now, but I don't know another way;18:18
rharpermaybe rbasak or other git folks know how best to handle this18:18
blackboxswand if doing we changed the author, I'd also like to correct fomatting on the cmt message and add the LP:#186629018:19
blackboxswworth a discussion in ubuntu-devel18:19
rharperyeah18:20
blackboxswcommunity-notice: Ubuntu focal upload of tip of cloud-init master accepted [ubuntu/focal-proposed] cloud-init 20.1-9-g1f860e5a-0ubuntu1 (Accepted)20:43
blackboxswcommunity-notice: Certified cloud images should update with 20.1-9 over the next couple of days20:43
rharperblackboxsw: nice!20:46

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