/srv/irclogs.ubuntu.com/2020/09/01/#cloud-init.txt

=== vrubiolo1 is now known as vrubiolo
=== cpaelzer__ is now known as cpaelzer
viks____hi,  how to upgrade the cloud-init in the image when creating a fresh instance.. i want this to happen before cloud-init user data being run..09:23
meenaviks____: by building a fresh image with an upgraded cloud-init09:57
viks____meena: thanks... but is there any other way like say if a user uploads an image to my image repo, i want to make sure that a required version of cloud-init say 19.3 is present when an instance is created out of it10:00
meenayou could possibly add scripts to vendor-data far far either check the version and error out, or very hackishly try to update cloud-init. however, vendor-data can be overwritten by user-data… so, if your horrible hackishly scripts don't work, your users will circumvent them10:06
viks____meena: ok.. thnx11:45
Odd_Blokeviks____: If you want cloud-init upgraded before cloud-init runs, then you can't use cloud-init to do it.  And if you don't have a way of modifying the image before it launches (either to upgrade cloud-init, or to add some pre-cloud-init systemd unit that attempts something similar on boot), then I don't think there is a good way of doing it.13:04
Odd_Blokeviks____: What is it that drives the minimum requirement?13:04
viks____Odd_Bloke: Ok.. thanks.. actually i was trying to inject root password via cloud-init for debian9 i.e. http://cdimage.debian.org/cdimage/openstack/current-9/debian-9-openstack-amd64.qcow2  for my local test openstack cluster. it seems the above image has old cloud-init and it seems that is the reason cloud-init is not able to set root password given via user-data.13:13
viks____so in case if any user tries to upload the image from the above link and tries to create instance, root password injection will not work via cloud init. So i wanted to know if there is any standard way this can be upgraded to a give cloud init version13:13
viks____i even tried to install manually by cloning cloud-init repo in the instance created from the above link(debian9), but installation is not successful. Also i do not find any pip packages or any prebuilt  package for debian 913:16
Odd_Blokeviks____: Hmm, that sounds like something that I would expect to work even on an older version of cloud-init.  What does your user-data look like?13:51
viks____https://www.irccloud.com/pastebin/2k5X0RpZ/13:52
viks____which works fine on debian10 based instance13:53
viks____Also i see the discussion abt the version issue here: https://forum.proxmox.com/threads/change-password-cloud-init-does-not-work.46118/13:55
Odd_Blokeviks____: Hmm, I _would_ expect that to work on an older version of cloud-init.  Could you pastebin /var/log/cloud-init.log from a failing instance (if you have some other way of gaining access)?13:57
riccardomCiao, I'm new to the technology, and trying to understand. I see that cloud-init is strongly bound to systemd13:59
riccardomIs the implementation dependant on systemd?14:00
viks____Odd_Bloke: here it is: http://paste.openstack.org/show/797330/.. i do not see any error in this14:02
viks____i'm facing this only in debian9. most of other distributions and their versions it works fine14:04
Odd_Blokericcardom: cloud-init is involved in setting things up during the boot process (generally in four different stages: https://cloudinit.readthedocs.io/en/latest/topics/boot.html), so it has to be well-integrated with the init system.  However, it doesn't have to be systemd: we have upstart scripts in the upstream tree, and I believe Alpine uses OpenRC.14:08
Odd_BlokeOne caveat: the "Generator" stage in that link is systemd-only, as it relies on systemd's generator functionality (which allows us to enable/disable services at boot time, so cloud-init won't run when it isn't needed).14:09
Odd_Blokeviks____: From that log, it looks like cc_set_passwords never runs.  Can you paste /etc/cloud/cloud.cfg, please?14:12
viks____Odd_Bloke:  here it is -> http://paste.openstack.org/show/797331/14:15
Odd_Blokeviks____: Hmm, it is in there.  Looking back at the log, it appears to be truncated, is that really the full file?14:17
viks____yes14:17
viks____wait.. it seems to be getting trucated..14:19
viks____here is the remaining part -> http://paste.openstack.org/show/797334/14:20
Odd_Blokeviks____: Hmm, looks like it has worked.  Can you confirm for me how you're testing that it hasn't worked?  (Does the password work locally but not via SSH, for example?)14:36
viks____i try to login via console on openstack horizon dashboard which fails... not ssh... i also cross verified the encrypted password in userdata with the password in shadow file which are not same14:48
Odd_Blokeviks____: What user are you trying to login as?15:00
Odd_BlokeBecause your cloud.cfg has things configured such that the default user will be `ubuntu` (so I would expect the password to be set on `ubuntu`, not on `root`).15:01
=== smoser1 is now known as smoser
viks____Odd_Bloke: Oh i see... let me try changing that in the image and create an instance.. will let you know..15:33
viks____Odd_Bloke:  but we are setting it for root right as in userdata file... also even in debian10, i see debian as default user in cloud.cfg:15:35
viks____https://www.irccloud.com/pastebin/AcL0ZSuT/15:35
viks____but root password works there15:36
viks____it seems cloud.cfg got changed when i tried to upgrade the version manually in instance... in original image it's indeed debian: http://paste.openstack.org/show/797342/15:40
viks____also on the debian 9 instance:16:03
viks____https://www.irccloud.com/pastebin/JSdKixBo/16:03
viks____whereas on debian10 instance:16:03
viks____https://www.irccloud.com/pastebin/GW6ivhw5/16:03
meenaGood grief16:58
apattHello everyone :-)  Hoping someone can tell me if what I want to do is possible.18:15
apattI'm trying to create a linux image that works across multiple server vendors. I've got a base cloud-init setup working great that uses the NoCloud provider and pulls a config from a web server. That all works great.18:15
Odd_Blokeviks____: Hmm, I'm not 100% sure we've seen a good test with Debian 9 if you'd tried to fix the instance yourself before capturing logs etc.; would you be able to spin up a clean one and recapture stuff?  (If it's easier, you can push the tarball that `cloud-init collect-logs` generates.)18:16
apattHowever, when I push my linux image to another server that has different network interface names that doesn't work so well since my netplan configuration is in the user-data file out on the network.18:16
apattSo I was curious if its possible to have a local user-data file that gets the network up and then have it pull the user-data information from the network share to finish up customization18:17
apattI hate baking everything into the image since I have to respin the image just to change simple things18:17
Odd_Blokeapatt: netplan supports matching interfaces; would using that allow you to share your network configuration across servers?18:19
Odd_BlokeOr are the network configurations for each instance very different?18:19
apattit does, but if the netplan information is in the user-data located on the network.... so if the target server has different network interface names the network does not come up at boot so we can't reach the network to tell us what our network configuration should be ;-)18:20
Odd_Blokeapatt: Are you using DHCP?18:21
apattYEs18:21
apattwrite_files:- path: /etc/netplan/50-cloud-init.yaml  content: |    network:     version: 2     ethernets:       id0:         match:           name: eno1*         dhcp4: trueruncmd:- netplan --debug apply18:21
apattwell that didn't format so well18:21
Odd_BlokeI got the gist. :)18:21
Odd_Bloke(But in future multiline stuff would be better in a pastebin like https://paste.ubuntu.com/ :)18:22
Odd_Blokeapatt: So I would expect that cloud-init should be able to perform DHCP and reach your NoCloud endpoint without you providing any network configuration, either in the image or via user-data.18:22
apattAt least on Ubuntu it doesn't seem to work that way18:23
apattunless I'm just horribly ignorant of how netplan deals with new interface names18:24
FolamhHi I've come across an issue with an issue with cc_package_update_upgrade_install.py on arch distributions. It passes "upgrade" to arch.py which would create the command "pacman -Sy --quiet --noconfirm upgrade" which should actually be "pacman -Syu --quiet --noconfirm" or "pacman -Sy --quiet --noconfirm -u". What should I do to get this addressed?18:25
blackboxswFolamh: probably file a bug https://bugs.launchpad.net/cloud-init/+filebug with details18:26
Folamh(y)18:26
blackboxswand new contributions via pushing a PR up to https://github.com/canonical/cloud-init/ also encouraged18:27
Odd_Blokeapatt: Apologies, NoCloud doesn't actually behave in the way I was thinking of; it's datasource-specific.18:27
apattIt's not the end of the world if that just isn't possible, it just means I put some basic network information into a local user-data seed and then do everything else with Ansible once the host is up and on the network.18:28
apattand give up on using a user-data config from a http share18:29
Odd_Blokeapatt: How are you specifying where to seed from?18:30
apattOdd_Bloke specifying a NoCloud datasource cloud.cfg18:31
apattOdd_Bloke what I may end up doing is writing out a netplan config that brings up the local adapters by matching everything (en*) and then pulling in the new netplan information once it boots. That would elongate the boot however, since Linux is going to try and bring up all six ethernet adapters I have in my servers. Only two of them are plugged in18:33
apattso we pause quite a while.18:33
apattNot sure if that would get me into any timeout issues18:34
Odd_Blokeapatt: Would you be able to gather logs from an instance which doesn't have local netplan configuration but does have your cloud.cfg?  I'd like to see what's going on.18:38
Odd_Bloke(A pastebin of cloud-init.log would be a good starting point. :)18:40
apattOdd_Bloke I'm fairly confident that the issue is that my user-data contains this text: https://paste.ubuntu.com/p/xhVXVDbZPZ/18:40
apattbut before running cloud-init the local machine only has this https://paste.ubuntu.com/p/Dxg6n9pqzH/18:42
smoserapatt: write_files attempting to write that is not really going to work.18:45
smoserby the time cloud-init writes files, networking is already up based on what it declared. and then... runcmd of 'netplan --debug apply', maybe that would do what you wanted.18:46
smoserbut, yuck.18:46
apattsmoser I agree it's not optimal, but best I could come up with. All ears if you have a better alternative.18:48
smoserapatt: what i think you want to do is provide network config in the nocloud seed (i suspect that is what you mean by nocloud data)18:49
apattcorrect18:50
smoserhttps://asciinema.org/a/14577218:51
smoserhttps://asciinema.org/a/14577218:51
apattsmoser thanks, will take a look.18:52
smoseri think it would work to #include a url from the user-data you provided.18:52
smoseror maybe use seed-from18:53
smoserbut i'm not sure if that would work or not.18:53
smoserif you just #include the userdata, then you're going to have to hard-code the instance-id18:54
smoserand then its always going to be the same instance18:54
apattSince I'm using bare metal servers I'm not sure that is going to work for me since it requires using a disk image attached to the VM.18:58
apattAfter talking to you and Odd_Bloke I think I have an idea of how to make it work though18:58
Odd_Blokeapatt: Let us know how you get on! :)19:08
Odd_Blokesmoser: So as I'm working through these manual_cache_clean docs, my initial feeling is that exposing "trust" and "check" as values for a new configuration option would be a good step forward.  This would allow us to introduce other modes; the first that occurs to me is, say, "check_failsafe" which would behave as "check" does _unless_ we fail to determine the current instance ID, in which case it behaves20:16
Odd_Blokeas "trust" does.  I think this would be a best effort solution to bug 1885527; if there's an IMDS outage then you can't launch new instances, but your existing instances aren't trampled (and when there isn't an IMDS outage, you can launch instances from captured images; "trust" would prohibit this).20:16
ubot5bug 1885527 in cloud-init (Ubuntu) "cloud-init regenerating ssh-keys" [Undecided,Incomplete] https://launchpad.net/bugs/188552720:16
Odd_BlokeI don't think that's a short-term thing at all, I'm more curious as to what you think of it as an idea.20:17
Odd_Bloke(s/you can't launch/you won't successfully launch/)20:18
smoserOdd_Bloke:i'm not sure i understand.21:05
smoseryeah, i dont think you ever really want what you're after.21:08
smosereither21:08
smosera.) trust the cache completely (manual_cache_clean=true)21:09
smoserb.) check it.21:09
smoserdoing21:09
smoserc.) check it, but if that check failed, then use it.21:10
smoserb.) was 'check it, and if it is good use it'21:10
smoseri dont know. i think it generally does work correctly as it is.21:12
smoser(if it in fact works the way i described it is supposed to)21:12
smoserif you wanted to change something, then the easiest thing to change, and probably the least surprising to the end user (or at least the flurry of end-users that have come along recently) is to always trust the cache.21:13
smoserand just throw away the "rebundle without clean" use case.21:13
smoserand just document that if the user wants to take a snapshot, they have to run 'cloud-init clean'21:14

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