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

=== vrubiolo1 is now known as vrubiolo
Krikkehey, testing out the archlinux openstack image and a centos image with terraform libvirt provider, I can't seem to get cloud-init to run or at least it's not making any changes13:33
Krikkeif cloud-init is installed in the image it should just run if the commoninit.iso is mounted or?13:34
Krikkethis is on kvm/qemu13:34
Krikkehmm I'm reading now that networking should be working, does it not work with a bridge device?13:37
Odd_BlokeKrikke: cloud-init will run in some capacity on every boot (because it needs to check if this is a first instance boot to determine whether it should be doing anything more).  Do you have a /var/log/cloud-init.log in these instances?13:37
KrikkeI have a hard time accessing the instances since I can't configure credentials to login13:38
Krikkeis it possible to mount the qcow2 images to inspect them?13:38
KrikkeI tried with this one https://linuximages.de/openstack/arch/arch-openstack-LATEST-image-bootstrap.qcow213:39
Krikkeand this one https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow213:39
Krikkehmm I found out how to mount the things13:44
Krikkechecking the log now13:44
KrikkeI added my ssh rsa public key but it still asks for password on connect to ssh13:47
Krikke2020-09-10 13:38:06,180 - util.py[DEBUG]: Read 619 bytes from /run/cloud-init/tmp/tmpvym7iuca//user-data13:48
Odd_BlokeOK, so cloud-init is running.13:49
Krikkeyeah seems so13:49
Odd_BlokeAnd that suggests it is finding your configuration ISO.13:49
Krikke2020-09-10 13:38:06,180 - util.py[DEBUG]: Running command ['umount', '/run/cloud-init/tmp/tmpvym7iuca'] with allowed return codes [0] (shell=False, capture=True)13:49
Krikke2020-09-10 13:38:06,181 - util.py[DEBUG]: Attempting to load yaml from string of length 0 with allowed root types (<class 'dict'>,)13:49
Krikkemaybe I'm configuring it wrong13:49
KrikkeI have everything in user-data13:50
Odd_BlokeYeah, potentially; could you pastebin (https://paste.ubuntu.com/) your user-data?13:50
Krikketrying with this atm https://paste.ubuntu.com/p/WhMQY4cmVf/13:51
KrikkeI remove the public key13:51
KrikkeI don't see any mentions of my user in the logs, only the default arch user13:58
KrikkeRead 0 bytes from /home/arch/.ssh/authorized_keys13:58
KrikkeWriting to /home/arch/.ssh/authorized_keys - wb: [600] 0 bytes13:59
Krikkeit's not even the correct user13:59
rharperKrikke: do you have #cloud-config at the top of your user-data file ?14:01
Krikkeprobably not14:01
Krikkeis that a requirement?14:01
rharperyes14:01
Krikkeoh14:01
Krikkeseemed like an arbitrary comment to me :D14:01
Krikkelike who forces these kind of things?14:02
rharperhehe14:02
rharperdetecting whether a file is a specific sort of input needs something;14:02
Krikkeas long as it's documented somewhere14:03
rharperhttps://cloudinit.readthedocs.io/en/latest/topics/format.html14:05
KrikkeI usually skip the documentation14:07
Krikkeseems I also need to recreate the volume after fixing the config14:07
rharperif it's an iso, then yes14:09
Krikkeit works!14:12
rharper\o/14:12
KrikkeI mean, cloud-init only runs on first boot right?14:13
Krikkeso if I want to test changes to the image I need to recreate it14:13
Odd_BlokeKrikke: cloud-init runs on every boot; I actually recently wrote some documentation about it that hasn't landed yet: https://github.com/canonical/cloud-init/pull/568/files14:18
Odd_BlokeAs that doc outlines, cloud-init determines whether this is an instance's first boot to decide what it will execute during this particular boot.14:18
Odd_BlokeIt does this using the cache in /var/lib/cloud/; if you want to force cloud-init to detect a first boot (and therefore re-apply your configuration), then you can run `cloud-init clean`.14:19
Krikkeok14:20
Odd_BlokeThen reboot, to be clear.14:20
Krikkecool14:20
Odd_BlokeNote that that only undoes cloud-init's state: any changes you asked cloud-init to make to the system will persist.14:21
Krikkethe packages section works for archlixux right?14:21
Odd_BlokeI can't speak from experience, but we have code that certainly suggests it should. :)14:22
Krikkeok :)14:22
Krikkewonder why their image doesn't provide "which" command14:22
Odd_Bloke(And the bug link is in the topic if it doesn't. ^_^)14:23
Odd_BlokeMost (all?) shells provide `which` builtin, that may be the thinking?14:24
Odd_Bloke(It's in an essential package in Debian (and therefore Ubuntu), so it's likely to be on Debian-derived systems for eternity, even if people wanted to remove it; Arch may not have had their hand forced that way.)14:25
Krikkeyeah that's what is says when I do which which on my host system14:27
Krikkestarting to get there, wow this is so much nicer than nixos :D14:38
rharperQuote of the day right there ^14:56
smoserOdd_Bloke:which is almost never a shell builtin14:57
smosercommand -v is the posix shell builtin.14:57
Odd_BlokeOh, huh, I did not realise that was only a zsh thing.15:04
Krikkeany way to change the root shell?15:05
Krikkejust add root to users section?15:06
Krikkemaybe I just run chsh15:11
Krikkehmmm, cloud init is overwriting locale-gen15:13
Krikke/etc/locale.gen15:13
Krikkeah I can just override that15:18
Krikkeseems the owner param doesn't work for write_files: content:15:39
Krikkeneed to set them in runcmd after write_files15:42
rharperKrikke: owner works.  it's but the user/group has to exist at the time the file is written; write-files runs before users-groups runs so that's likely what' you're seeing16:28
=== MAbeeTT4 is now known as MAbeeTT
rharperI have a branch, I need to put it up, called write-files-late, which would run after user-groups are created to sort out the write-file ownership issue with dynamically created user/groups16:29
smoserKrikke: that is bug https://bugs.launchpad.net/cloud-init/+bug/148611317:58
ubot5Ubuntu bug 1486113 in cloud-init "write_files runs before users/groups, renders "owner" useless" [Medium,Triaged]17:58
=== paride is now known as paride|off

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