/srv/irclogs.ubuntu.com/2022/04/26/#cloud-init.txt

=== fowl1 is now known as fowl
=== gschanuel7 is now known as gschanuel
=== gschanuel7 is now known as gschanuel
=== h is now known as hexa-
=== meena1 is now known as meena
=== hexa- is now known as hess
=== hess is now known as Guest3633
=== Guest3633 is now known as hexa-
OneBitHello, i want install a ubuntu-server via cloud-init autoinstall. I have two disks and i want RAID 1. Is this possible?14:32
dalurkaOneBit: yes15:55
akutzIs there a known issue where MAC addresses in metadata need to be case-specific for a given renderer? We found that when our provided MACs are lower-case, networking fails on RHEL. Now, this would be an older version of CI without several of the more recent patches, including one I did in network_state.py that does switch to case-insensitive MAC matching, but I am not sure if that actually addressed the issue or if it is even the same issue.17:55
akutz Regardless, I think CI should 1) accept MACs in either case and 2) compare them in a case-insensitive manner and 3) output the value in the format required by the renderer.17:55
minimalakutz: do the MAC addresses have a leading zero? are they quoted?17:57
akutzThey will always have the correct number of digits, as for quoted, not sure. Regardless, I've not seen the quoting affect it in the past. Is that possibly renderer specific?17:58
akutzJust verified that we do not quote the value.17:59
minimalakutz: I had an issue in past with network-config that required MAC quoting as due to YAML "smarts" they could be misinterpreted17:59
akutzAck. Interesting.17:59
akutzThank you.17:59
akutzBut wouldn't that be specific to CI and not the distro? I guess since it's older CI on RHEL then Ubuntu/Photon may not be subject to the same issue since their CI will be newer.18:00
minimalakutz: here's my related MR from a couple of years ago: https://github.com/canonical/cloud-init/pull/62318:01
ubottuPull 623 in canonical/cloud-init "Update v1 and v2 network config docs to clarify MAC addresses" [Merged]18:01
akutzminimal: cool, thank you. Here's the one to which I was referring up above -- https://github.com/canonical/cloud-init/pull/132718:01
ubottuPull 1327 in canonical/cloud-init "Fix sysconfig render when set-name is missing" [Merged]18:01
minimalakutz: there is https://github.com/canonical/cloud-init/pull/1135 when the change updated the docs to state "Letters must be lowercase"18:04
ubottuPull 1135 in canonical/cloud-init "docs: Make MACs lowercase in network config (SC-541)" [Merged]18:04
akutzThanks again minimal -- we're going to try adding the quotes to see if that solves the issue. If it does, and it works for RHEL, then it would mean that there's some change in CI where uppercase worked on newer versions of CI but now older.18:05
minimalthe quotes issue is only really a factor if the mac address contains no letters as then the YAML library treats it as a Base60 number instead18:06
akutzAck.18:06
akutzSo it turns out my engineer built CentOS 8 with CI 22.1. I didn't know she didn't use a stock image. That means she likely hit the change to requiring lcase MACs, and once we start testing against newer ubuntu and Photon images that use 22.1 and have that patch from 12/21, we'd hit it there too.18:07
holmanbakutz: yeah there was an old bug about the mac case that was worked on last cycle, but I guess that's already been brought up - the "built with 22.1" explanation makes sense18:10
akutzDo you happen to have that bug ID handy? The issue linked was just the doc change.18:11
akutzI found https://bugs.launchpad.net/cloud-init/+bug/1876941, but I don't see any code that addresses this. The solution is just to doc it?18:12
ubottuLaunchpad bug 1876941 in cloud-init "Document that network-config MAC addresses should be lower case" [High, Fix Released]18:13
akutz(not judging, just asking)18:13
akutzAh, found https://bugs.launchpad.net/cloud-init/+bug/187636318:13
ubottuLaunchpad bug 1876363 in cloud-init "cloud-init should not treat MAC addresses as case sensitive" [High, Triaged]18:13
holmanbakutz: the first one is the one I was referring to "worked on last cycle" - I think we discussed and agreed that supporting both cases should happen18:14
akutzI may take on this bug, but I'm concerned about back-compat and the level of testing to ensure that it's handled appropriately everywhere.18:14
holmanbakutz: if you want to take it on, you're welcome to :)18:15
holmanbcan help with ensuring test coverage when it comes time for review18:15
akutzHeh, I know no one would stop me per se, I'm just not sure I'm the right person for it. The LP has a specific location where this needs to be addressed (wait_for_phys_devices). I actually addressed this issue in the sysconfig renderer earlier this year as well. That's at least *one* location the LP didn't mention -- I'm sure there are others.18:16
akutzI think the first step will be to find out whether each renderer has specific requirements regarding MACs to ensure that any changes to those in CI does not affect how they are emitted for their respective renderers.18:17
holmanbakutz: that or you could just convert both cases to the case currently in use (assuming that works as expected)18:18
holmanbwhich would probably be less work than auditing various renderers :)18:18
akutzYep. My concern is that the renderer may not actually correctly know which case it should be used and is dependent upon having the correct case passed all the way through via the metadata.18:19
akutzSo there are two methods here -- normalize all macs or update all comparisons or dict lookups to be case insensitive. 18:20
holmanbakutz: agreed18:21
akutzAnd I guess my first thought is normalization is generally easier because there are only so many places where the value is inputted and outputted. That's true for comparison and lookup as well, but those will be trickier to spot I think. Anyway, that's what prompted my comment about renderers.18:22
akutzHuh, in netinfo.py the REs for matching MACs for various distros all use [\da-f], effectively asserting the system tools that report MAC info always do so in lcase.18:25
holmanbakutz: not sure if it helps, but here is a pointer to some mac regex I submitted to a different project: https://github.com/bee-san/pyWhat/blob/main/pywhat/Data/regex.json#L147918:29
holmanbit supports either case18:30
akutzholmanb: thanks! I guess my point was more that CI seems to already internally expect MACs to be lcase in certain situations. And more importantly those situations involve the distro command used to produce the network info data. The fact that these distros all report MACs in lcase is strong evidence that they should be normalized as such. 18:31
akutzIt honestly makes me wonder if there shouldn't just be a function that processes metadata prior to processing and updates all MACs to be lcase.18:32
holmanbakutz: ah, I see what you're saying18:32
holmanbyeah, agreed, normalize to lower case on input is how I'd tackle this18:33
chilukHey folks.  Does anyone have an example of a cloud.cfg that can actually set up dns nameserver, and search domains on 20.04 in aws?   The resolv_conf module doesn't work, and I can't seem to get a functional incantation of https://cloudinit.readthedocs.io/en/latest/topics/network-config.html21:17
chilukReally it just feels like there are many ways to skin this cat, (forcibly setting /etc/resolv.conf, systemd-resolved, netplan, network-manager, ifcfg) what's the recommended way to do this.21:19
holmanbchiluk: Hello! Could you expand on "resolv_conf doesn't work"? I seem to recall systemd-resolved wiping out /etc/resolv.conf on $OTHER_DISTROBUTION, but I can't speak for 20.04 off the top of my head.21:32
holmanbchiluk: I would probably start with configuring dns along with other network configs via: https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html, but I don't have an AWS/20.04 config lying around, sorry21:34
chilukholmanb: yeah the resolv_conf cloud-init module is not resulting in a modified /etc/resolv.conf.  I haven't figure out if the module is failing or if resolv.conf is getting overwritten by systemd-resolvd ..21:37
holmanbminimal: Would you happen to know offhand whether cloud-init analyze works on Alpine?21:37
chilukholmanb: as for network-config-format-v2, I couldnt' seem to make that work either, and I was hoping someone had a functional cloud.cfg I could copy.21:38
minimalholmanb: one sec whilst I check on a VM I have handy...21:38
minimalblame/show/dump work, boot fails with "You must be running a Kernel Telemetry supported distro."21:40
holmanbminimal: Interesting, thanks! 21:44
* holmanb needs to figure out why lxc wasn't working for an alpine image21:47
minimalholmanb: have never tried lxc with Alpine cloud-init, its on my "to test" list21:48
holmanbminimal: I use lxc for checking various distro things, makes it really easy to test things quick21:49
minimalyeah I just need to figure out how to create a LXC container inside a chroot, that's how my script currently builds VM disk images21:50
minimalor else take a different approach for LXC21:50
minimalholmanb: is there a particular lxc template you're using for Alpine?21:51
holmanbminimal: I was trying to pull and run from the canonical image server: https://us.lxd.images.canonical.com/21:51
holmanbminimal: I don't build them myself21:51
holmanblooks like they have templates/build scripts/jenkins info on that page ^^21:52
minimalholmanb: this seems to be it: https://github.com/lxc/lxc-ci/blob/master/images/alpine.yaml21:53
minimalI think I looked at that once briefly21:53
holmanbyeah that looks like it21:56
minimalholmanb: which Alpine release did you use?21:57
chilukMaybe I should ask a different question.  What is the best way to debug a failing cloud.cfg?  Is there a cloud-init command that forces it to rerun the network configuration?21:57
chilukbasically I want to boot a node ... modify cloud.cfg, and run something so that cloud-init attempts to use or analyze cloud.cfg21:57
minimalchiluk: have you tried enabling debugging for cloud-init? then the /var/log/cloud-init.log file would show a lot more detail as it processes network-config and user-data21:58
holmanbminimal: the cloud one: lxc init images:alpine/cloud21:58
chilukwell the problem is that I can't log in with my broken cloud.cfg21:58
minimalholmanb: did you write the user-data yourself or got it from the lxc people? e.g. from that template they seem to install openssh rather than openssh-pam which will cause problems if the user-data locks a user-account22:01
holmanbchiluk: there's a newer "pre-test-flight" tool for validating that your cloud-config is valid - that will check for obvious errors like keys that aren't valid even though yaml is valid22:02
chilukcool I'll check that out.22:02
chilukis there a way to force cloud-init to run as if it was running for a first-boot?22:02
holmanbchiluk: invoked via cloud-init devel schema -c ./config.yml on a running cloud-init system, or you could grab the cloud-init repo and run it locally setting the pythonpath22:02
holmanbchiluk: yes, to re-run use `cloud-init clean --reboot`, which will reset and reboot22:03
holmanbchiluk: or cloud-init clean followed by --reboot22:03
chilukholmanb: will that reboot the node though?22:03
chilukmy issue is that I'm borking networking ..22:03
holmanbchiluk: yes it will22:04
chilukis there a way to do that without the reboot?22:04
holmanbchiluk: have you tested your config locally in a container/vm?22:04
chilukthat's an idea... I guess I could probably just configure serial console in aws.22:04
chilukalright I have some things to try .. thanks holmanb.22:05
holmanbchiluk: you _could_, by running the cloud-init "local" stage22:05
chilukhow does one do this?22:05
holmanbchiluk: I would highly recommend iterating in a local container/vm (where networking can be borked and you can debug) until your config works22:06
holmanbbut...22:06
chilukalright.22:07
holmanbchiluk: honestly I don't know if I would recomend running individual stages of cloud-init without a reboot22:08
holmanblikely to get results you don't expect, and there's four separate systemd services that run at particular parts of the systemd boot order22:09
holmanberr, minimal: I don't think we're talking about the same thing22:09
minimalholmanb: I thought you were creating a cloud-init enabled Alpine LXC container22:10
holmanbminimal: I'm just trying to pull down the image from the server to run an alpine container - I haven't managed to pull an image, so I haven't even gotten to cloud-config22:10
holmanbminimal: the canonical server has pre-built cloud-init containers of various distros22:11
minimalright: so you're trying to use this one? alpineedgeamd64cloud20220426_13:00YES (2.0 and up)YES (2.0 and up)YESYES22:12
minimalfor 3.15?22:12
holmanbthe first one 22:12
minimaloops, sorry, Edge22:12
minimalthe first one? 3.12?22:12
minimalthe first Alpine version that had cloud-init packaged was 3.1322:13
holmanbminimal: ahh, it was user error22:14
holmanbedge22:14
minimalok, edge is the "bleeding edge" of Alpine :-)22:14
holmanbminimal: perfect :)22:15
holmanbminimal: broken and new is my favorite22:15
minimalso if you can't even pull down the image then is that not a tooling issue?22:15
holmanbminimal: yeah you asking which version made me realize I was just invoking lxc wrong22:15
minimalhotmanb: so I was assuming those Canonical images were based on the upstream lxc templates, in which I pointed out a potential issue with the alpine cloud one & cloud-init22:17
minimalthat behaviour of openssh (if PAM not enabled) and locked users22:18
holmanbminimal: ahh, because openssh is not used on alpine?22:18
minimalbecause in Alpine the package openssh-server is OpenSSH compiled without PAM and package openssh-server-pam is it compiled with PAM support22:19
minimalactually I'll have to check as they're actually specifying "openssh": https://github.com/lxc/lxc-ci/blob/master/images/alpine.yaml#L33122:20
minimalso "openssh" depends on "openssh-server"22:20
holmanbminimal: ahh, I see22:23
minimallong-story-short: in Linux a locked account is one where password access is blocked (acct is no disabled and so SSH-key-based access should still work), however upstream OpenSSH treat locked as completely locked (inc. SSH-key-based-access) *UNLESS* PAM is enabled22:23
minimaldoesn't affect most distros as they only ship a single OpenSSH server package with PAM support22:23
minimalfor Alpine though there's 3 different packages for OpenSSH server (3rd is with Kerberos support)22:24
holmanbminimal: sure, makes sense22:24
minimalI discussed this about 2 months ago on here with either blackboxsw or smoser as I wanted to figure out some sort of cloud-init way to handle this (e.g. adding a "disabled" option to "users:" section)22:25
minimalwhere "disabled" wouldn't lock the account (which puts "!" in password field) but rather put something else like "*" in there instead22:26
minimalholmanb: so have you now managed to pull down the image ok?22:30
holmanbminimal: I have, thanks22:31
minimaldoes it boot ok?22:31
holmanbminimal: it does22:32
holmanbone error, datasource related22:32
holmanb__init__.py[ERROR]: Could not import DataSourceVMware. Does the DataSource exist and is it importable?22:32
minimalI didn't see anything in the template about tweaking cloud.cfg's datasources list so I'm guessing its using the default list22:32
minimalholmanb: hmm, it is in the package: https://pkgs.alpinelinux.org/contents?file=*VM*&path=&name=cloud-init&branch=edge&repo=community&arch=x86_6422:34
minimalI would have assumed the LXC people would have tweaked the cloud.cfg to only try the LXC DataSource (for "performance" reasons) rather than go through a list of various DS22:35
holmanbminimal: /shrug22:36
holmanbI just use it 22:36
* holmanb needs to eat food now22:37
minimalactually there is no LXC in c-i, only a LXD DS - I assume this handles both LXC and LXD22:37
holmanbThanks for the help minimal!22:38
minimalholmanb: no problem. If its trying to use NoCloud for LXC then I suspect the LXC image has some other problems (i.e. they didn't follow the notes in my README.Alpine file for the cloud-init package)22:39
minimalholmanb: light reading here if you're interested ;-) https://git.alpinelinux.org/aports/tree/community/cloud-init/README.Alpine22:41

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