/srv/irclogs.ubuntu.com/2023/07/27/#cloud-init.txt

rharperhttps://github.com/canonical/cloud-init/issues/4288   - this also hit the focal version 23.2.1-0ubuntu0~20.04.2  --  is there a lp bug (or github issue) to track the fix into focal/jammy ? 00:11
-ubottu:#cloud-init- Issue 4288 in canonical/cloud-init "v23.2.1 failing on ubuntu 22.04 with local variable 'ds_name' referenced before assignment" [Closed]00:11
rharperhttps://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2028784   00:22
-ubottu:#cloud-init- Launchpad bug 2028784 in cloud-init (Ubuntu Mantic) "Variable 'ds_name' referenced before assignment" [Undecided, New]00:22
falcojrrharper: fix has already been released upstream. SRU will follow asap but will still need some time 02:11
rharperfalcojr: thanks;  I was looking further into how we saw it but the cloud-images didn't; I *think* if ds-identify returns something it detects, then the importer code isn't run;  we have a non-ds-id datasource which we enable via cloud.cfg in the image;  this definitely hit the issue; but major cloud/ds won't see it.  I was hoping the commit or even the SRU bug could cover what code paths trigger it; 02:37
falcojrrharper: Good point, I'll update the bug with the contex. Datasources can be specified with a "DataSource" in front of them. So the datasource list could contain either "LXD" or "DataSourceLXD" and either one should be recognized. The "DataSource" prefix isn't common. It's not used at all upstream or in stock ubuntu images, and isn't used on any of02:46
falcojrthe major clouds either. We integration tested on the big 3 (plus a few more) and didn't see any issues then.02:46
aniblackboxsw any ideas >? https://github.com/canonical/cloud-init/pull/429108:33
-ubottu:#cloud-init- Pull 4291 in canonical/cloud-init "[RFC] NM renderer: set default IPv6 addr-gen-mode for all interfaces to eui64" [Open]08:33
anifalcojr08:33
falcojrani: unfortunately it's been a busy week of hotfixes. Realistically we probably won't get around to reviewing most PR until sometime early next week 10:29
=== rharper_ is now known as rharper
=== orndorffgrant5 is now known as orndorffgrant
effendy[m]Hi. I'm using ubuntu ova templates 22.04 and cloud-init started acting differently since around the beginning of June. I'm creating a template and then I'm cloning a virtual machine. The problem is that cloud-init starts both init-local and init stages before rebooting, instead of just init-local. That exposes the ssh server and so terraform immediately tries to connect to it. After creating the template, I'm resetting cloud-init so that19:17
effendy[m]I can provision more specific stuff again with cloud-init. Is there any way I could force cloud-init to change it behaviour while creating the template and not start the init-local stage so early (before reboot)?19:17
minimaleffendy[m]: are you using Ubuntu's subquity to install Ubuntu?19:28
effendy[m]This is a cloudimage, the OS is already installed, as far as I understand.19:30
effendy[m]It just read the cloud-init configuration, I'm not giving it any parameters in grub or anything like that (like I used to with the 'classical' installation when I created templates with packer)19:31
minimalso you boot the image once and modify things to create a template?19:32
effendy[m]It boots once and then it restarts automatically. This is the behaviour that I see with cloud images (at least with ova).19:33
minimalI expect that would depend on the user-data being provided19:33
effendy[m]So I inject the cloudinit configuration from the very beginning. It boots once, then it restarts. In the cloudinit configuration I have a trick to tell it to stop the ssh service only once.19:34
minimalunless there is vendor-data or similar triggering a reboot19:34
effendy[m]Would that trigger a reboot?19:35
effendy[m]#cloud-config\nbootcmd:\n  - [ cloud-init-per, once, systemctl, stop, sshd ]\nusers:\n  - default\n  - name: packer\n    groups: sudo\n    lock-passwd: false\n    ssh_authorized_keys:\n      - ssh-ed25519 ssh-public-key\n    sudo: ['ALL=(ALL) NOPASSWD:ALL']\n    shell: /bin/bash\n    inactive: false\n    passwd: $6$HASH/19:35
effendy[m]This is basic.19:35
minimalI was referring to something like "power_state:\n  mode: reboot\n"19:36
effendy[m]I'm injecting this with vapp (this is how it works with vsphere).19:36
effendy[m]with vsphere and ova.19:36
effendy[m]I"m not doing that anywhere.19:36
minimalso what is doing the reboot?19:36
effendy[m]I've no idea.19:36
effendy[m]I would think it's cloud-init.19:36
effendy[m]The reason for that is that cloud-init changed its behaviour in June in the cloudimage (ova) template.19:36
minimalonly if it is told to do so, like with the config example I pasted19:36
effendy[m]not template, image.19:36
effendy[m]Right, but why would cloud-init run only one stage until June this year (before rebooting) and now it's running two stages before rebooting? The second stage presupposes starting the ssh server.19:37
minimalhave you looked at /var/log/cloud-init.log to see what is happening and why?19:38
effendy[m]I can assure you that I'm not running any commands that reboots the image. I think cloud-init does that, for example, for stuff like adding disk partition maybe and thereabout.19:38
minimalnope, c-i doesn't reboot to add disk partitions19:39
effendy[m]Yes, I have, the discussion is here: https://github.com/canonical/cloud-init/issues/418819:39
-ubottu:#cloud-init- Issue 4188 in canonical/cloud-init "cloud-init changes behaviour with ubuntu cloud image ova starting from version 20230602" [Closed]19:39
effendy[m]the only conclusion is what I said about the different stages.19:39
effendy[m]Ok, it was a supposition.19:39
minimalif cloud-init is rebooting then you will see the power_state module being run in the cloud-init.log19:40
effendy[m]yeah, I'm not seeing it.19:40
minimalso then it is unlikely that cloud-init is doing the reboot19:41
effendy[m]So you mean it is atypical that the a cloudimage would reboot once?19:42
minimallooked at that (closed) issue several people commented that the version of cloud-init before and after is the same19:42
minimaland that therefore they assumed any change in behaviour was due to something else in the "environment"19:42
effendy[m]Yeah, well, as I said there, I initially started the conversation on an Ubuntu channel.19:43
effendy[m]But I at least expected to be pointed in the right direction, if they cannot do anything about it, given that this is still canonical.19:43
effendy[m]And I obviously thought about cloud-init anyway, given how tightly connect to it the Ubuntu cloudimages are.19:44
effendy[m]connected*19:45
effendy[m]In any case, as I said, I'm not bothered as much by the reboot (although it would be nice not to have it at all after all), but about cloud-init's changing its behaviour, which is then related to Ubuntu only, but not to cloud-init. Although they're both tied to canonical.19:47
minimalwhere is the logfile from when you say it worked differently earlier?19:52
effendy[m]It's right there in the thread: https://github.com/canonical/cloud-init/issues/418819:53
-ubottu:#cloud-init- Issue 4188 in canonical/cloud-init "cloud-init changes behaviour with ubuntu cloud image ova starting from version 20230602" [Closed]19:53
effendy[m]I wouldn't be able to (easily) reproduce this, I've deleted the image. I'm trying to figure out what reboots the system in the meantime.19:54
effendy[m](I deleted the image because I thought I was out of the woods, but I didn't think it through and I thought I wouldn't have issues with the second stage -terraform)19:54
effendy[m]I've found a very similar issue here: https://www.reddit.com/r/Proxmox/comments/11zwxq4/reboot_after_cloudinit/19:57
minimalin one of the logs in that Issue I see "Invalid cloud-config provided: Please run 'sudo cloud-init schema --system' to see the schema errors.", though this is a warning, not an error19:57
effendy[m]This is a different context where proxmox is being used. So the reboot is typical of the Ubuntu cloudimages.19:57
minimalI don't understand what you mean19:57
effendy[m]Ah, no, this is misleading. The user says that a reboot is needed in order to start ssh (never mind).19:58
minimalwhat user?19:58
effendy[m]in the link, never mind, you can ignore it.19:58
minimalas I said previously, cloud-init does *not* reboot a machine unless it is configured to do so20:00
effendy[m]If I don't run cloud-init clean in the first stage (when I create the template), so that cloud-init won't run again, and then, after I clone the VM, I see that the VM isn't restarting, that still doesn't necessarily mean that cloud-init triggered it, right?20:20
effendy[m]Or about filesystem resizing done by cloud-init? Wouldn't that require a reboot?20:27
effendy[m]I know it doesn't normally if you do it yourself manually, but maybe cloud-init is acting differently.20:28
effendy[m]Not re-enabling cloud-init when creating the template does indeed stop the reboot when I clone the template.21:19
effendy[m]I'm still at a loss to understand how the situation is explained to me as if it were worlds apart from cloudinit :)21:19
minimaleffendy[m]: what do you mean by "re-enabling cloud-init"?21:39
minimalalso what do you mean by "the reboot when I clone the template"? A reboot of the VM running the template? or a reboot of a VM created using the created template?21:40
effendy[m]I mean not doing cloud-init clean 21:40
effendy[m]A reboot of a VM created from the template.21:40
minimalif you are created a "template" (i.e. a image to later used) then you need to clean cloud-init so that cloud-init can run from a "fresh" situation21:41
effendy[m]Yeah, I'm not sure if you read what I said.21:42
effendy[m]I do that normally.21:42
effendy[m]But I've just tested it without doing the clean. And the VM created from the template isn't rebooting anymore, now that cloud-init isn't running anymore.21:42
minimalwhy is cloud-init not running anymore? you said you didn't do a clean, you didn't say you disabled cloud-init21:43
effendy[m]I'm not seeing the systemd cloud-init anymore if I don't do the clean. In any case, when I don't do it, cloud-init will read (at least this is my impression) parts of the configuration only once.21:44
effendy[m]the networking part seems to be read though and for that I add the disable-network-whatever file (when it to – in other contexts)21:45
minimalif you don't do a clean when info regarding the previous run will be kept - which is not what you want for a template to create VMs from21:45
minimals/when/then/21:45
effendy[m]Yes, I guess so. As i said, the point was to test how it behaves.21:46
effendy[m]cloud-init isn't running anymore - the vm isn't rebooting anymore.21:47
minimalthe tasks that run for a "fresh" instance won't run as without a "clean" then cloud-init will not see a machine as being a fresh instance21:47
minimals/then/as/21:47
effendy[m]Yeah, I got that... 21:47
effendy[m]I'm not sure how to explain more clearly that I was just testing it.21:47
effendy[m]And that I normally run the clean.21:47
effendy[m]The point was to see a connection between cloud-init and the reboots. And there obviously is. I just don't understand how and to what extent this is related to something specific to the ubuntu cloud-image.21:48
minimalok, and to reinforce the point, the only thing in cloud-init that would trigger reboots is the power_state module which would only cause reboots in the configuration told it to do so21:48
minimalsin/if/21:48
effendy[m]Right, but aren't there any point of references, such as concrete images, where cloud-init runs? I mean, when you run cloud-init, there is a clear context. I don't understand why the ubuntu images seem so foreign.21:50
effendy[m]as if I were doing something weird.21:50
minimalI can't speak for Ubuntu, I'm looking at this from a cloud-init perspective21:50
effendy[m]So if you test cloud-init, it's only as a generic abstract layer? Not actually tested on linux distros?21:51
minimalyou are asking me specifically?21:51
minimalI don't work for Canonical21:51
effendy[m]For instance, sure :)21:51
effendy[m]For also generally.21:51
effendy[m]But also*21:51
minimalI'm the cloud-init maintainer for Alpine Linux21:51
effendy[m]I see, so you're testing it only on alpine then.21:52
minimalme personally, yes21:52
minimaland it doesn't reboot at the end of configuration unless I give it user-data telling it to do so21:52
minimalcloud-init is typically tested on distros by the maintainers of those distros21:56
effendy[m]Yes, I see. Maybe there's a specific version for Ubuntu, I don't know... but you (and the others) say that as long as the version is the same, it's the same cloud-init. However cloud-init does behave differently, that I know. The versions before June vs those afterwards.21:57
minimalthough cloud-init itself have a set of automated testcases that cover some aspects of different distros21:57
effendy[m]Maybe the only difference is that in the cloudimages before June it would reboot faster, before cloud-init would start the init stage :D21:57
effendy[m]But I guess you'd normally see issues there, as in interrupted pocesses.21:58
minimalperhaps you ned to workout was is triggering any reboots21:58
minimals/was/what/21:58
effendy[m]Yeah, I was thinking about that. I'm not sure how though.21:58
effendy[m]auditd?21:58
effendy[m]There's nothing in syslog, I just see services/processes reacting to sigterm signals.21:59
minimalyou said you don't have logs from earlier when things worked...21:59
effendy[m]I do. In the github thread.21:59
effendy[m]I said that I couldn't easily recreate them now, because I'd need the cloudimage from before June.21:59
effendy[m]which I've deleted. I guess I could get it from somewhere, I would just need to work at it a little bit.22:00
effendy[m]This thread, they're there: https://github.com/canonical/cloud-init/issues/418822:00
-ubottu:#cloud-init- Issue 4188 in canonical/cloud-init "cloud-init changes behaviour with ubuntu cloud image ova starting from version 20230602" [Closed]22:00
minimalI looked at the tarfiles in the github issue but despite the 2 tarfiles having different dates the cloud-init.log files inside them have entries from the same date22:00
effendy[m]Because I tested them in parallel, if you're referring to the timestamps.22:01
effendy[m]I mean in the same period of time.22:01
effendy[m]But the images were different.22:01
effendy[m]One from 24.05.2023 and the other from 02.06.2023. That's got nothing to do with when the systems booted.22:02
effendy[m]blackboxsw also saw the difference.22:03
minimalare these logs from the VM creating the templates? or from VMs booting using the created templates?22:04
effendy[m]From the VM that were created from the templates. So the latter. So after running clean.22:08
effendy[m]Ah, no!22:08
effendy[m]They're from the initial VM, run with packer, yes. So the VM that is creating the template.22:08
minimalwell the cloud-init logs show things like packer user being created22:08
effendy[m](the context is packer, so yes, it's the first stage)22:08
effendy[m]Yeah, I've remembered.22:09
minimalso either the pre-existing logs weren't removed when creating the template, or else the log is from the VM building the template22:09
effendy[m]As I said, it's from the VM building the template :)22:09
minimalbut you said the problem is not with creating the templates but later when they're being used?22:10
minimalin which case logs from then would be what is needed22:10
effendy[m]Good catch :) I said that because I found the solution with packer (stopping ssh temporarily with bootcmd).22:10
effendy[m]But the behaviour is identical in both cases.22:10
minimalbut the logs won't be...22:10
effendy[m]And with terraform it becomes much more difficult to circumvent the SSH problem.22:11
effendy[m]by "both cases" i meant in the case of packer and in the case of terraform22:11
effendy[m]so in the case of creating the template and in the case of creating the virtual machine from the template.22:11
minimalyou're getting BOTH the template creation VM and the VM running using the templates rebooting?22:11
effendy[m]Yes.22:12
minimalthat wasn't clear to me22:12
effendy[m]They both reboot once after the first boot.22:12
effendy[m]But as I said previously, if I don't run the clean command when creating the template, the virtual machine (created form the template) won't reboot, because cloud-init doesn't seem to be running at all (systemd services aren't there).22:12
effendy[m]I see in the logs that the second cloud init finishes running the final module, the rebooting process starts. Now there might be something external to cloud-init that watches cloud-init, but I'm not sure.23:08
effendy[m]Jul 27 22:52:06 omni-consul-0 cloud-init[1051]: Cloud-init v. 23.2.1-0ubuntu0~22.04.1 running 'modules:final' at Thu, 27 Jul 2023 22:52:06 +0000. Up 47.58 seconds.23:09
effendy[m]Jul 27 22:52:06 omni-consul-0 systemd[1]: Reloading.23:09
effendy[m]Jul 27 22:52:07 omni-consul-0 systemd[1]: Removed slice Slice /system/modprobe.23:09
effendy[m]That's the start of the rebooting process.23:09

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