/srv/irclogs.ubuntu.com/2016/11/18/#cloud-init.txt

rharpersmoser@smoser1117x:~$ sudo blkid00:26
rharper/dev/sda1: LABEL="cloudimg-rootfs" UUID="e990f8b3-1d6b-4615-8280-8ead4ed2fe7c" TYPE="ext4" PARTUUID="2865a230-01"00:26
rharper/dev/sdb1: UUID="c2108ffd-a113-4c1f-add4-4d6c92c7bef9" TYPE="ext4" PARTUUID="9b4d08ab-01"00:26
rharper\o/00:26
rharpersmoser: here's my changes to get it working: http://paste.ubuntu.com/23493164/00:33
smoserrharper, still there ?00:58
rharpery00:58
smoserrealpath will work on the devpath even if its a link00:58
smoserexists does the right thing on a link or dangling link00:59
rharperyou mean if it's not a link ?00:59
smoserright?00:59
rharperbut we *want* to be sure it's a real device ?00:59
rharperI'm confused why you ask ?00:59
rharperif the link exists but the device doesn't then we can't do anything00:59
smoserln -s /does-not-exist /tmp/foo01:00
smoser$ python3 -c 'import os; print(os.path.exists("/tmp/foo"))'01:00
smoserFalse01:00
smoserfor this case, just checking if somethign exists, exists is enough even on a link.01:00
smoserthe only rason we convert it to realpath was because that is what find_devs_with would respond with01:00
rharperrealpath only resolves a symlink if it has a valid target01:01
smoserright.01:01
smoserbut it has a valid target01:01
rharpersure01:01
smoseror os.path.exists("this symllink") will say no01:01
rharperit doesnt check if it exists (the target)01:02
smoserit does01:02
smosersee above01:02
rharperonly if it's pointing to other links01:02
smoserno. i doubt it01:02
smoserstupid me and isfile01:03
rharperwe went throught this in curtin;  don't we want to know if the target kernel device exists? (/dev/sdb1 ) ?01:03
smoseri just assumed "in unix everythign is a file"01:03
smoserwe do, but it is sufficient to say "os.path.exists()"01:03
smoseras os.path.exists("dangling symlink") == false01:03
smoserand01:03
smoseros.path.exists("non existant file") == false01:03
rharper(foudres) tmp % ls -al invalid01:04
rharperlrwxrwxrwx 1 root root 8 Nov 17 19:00 invalid -> /dev/sdz01:04
rharper(foudres) tmp % test -e /dev/sdz; echo $?01:04
rharper101:04
rharper(foudres) tmp % python3 -c 'import os; print(os.path.realpath("invalid"))'01:04
rharper/dev/sdz01:04
rharperI don't have an sdz, but realpath tells me that it's resolved any relative paths01:04
smoserok.01:04
smoserhttp://paste.ubuntu.com/23493164/01:05
smoserin line 9 there, you dont have to do that....01:05
smoseryou could use your line 14 ahead of it01:05
rharper(foudres) tmp % ls -al invalid crazylink01:05
rharperlrwxrwxrwx 1 root root 7 Nov 17 19:05 crazylink -> invalid01:05
rharperlrwxrwxrwx 1 root root 8 Nov 17 19:00 invalid -> /dev/sdz01:05
rharper(foudres) tmp % python3 -c 'import os; print(os.path.realpath("crazylink"))'01:05
rharper/dev/sdz01:05
smosersure.01:05
smoserbut print(os.path.exists("crazylink")01:05
smoserit will be false01:05
rharperyes01:05
rharperwhich proves that realpath does not check for existance01:05
smoser:)01:06
rharperjust resolvs symlinks01:06
smoseri agree01:06
rharper=)01:06
smoserbut we dont care01:06
rharperwhy not?01:06
smoserin your pasete01:06
rharperhow can you know you can reformat if the device doesn't exist ?01:06
smoserif you moved line 14 up01:06
rharperthat's the part I'm confused about01:06
smoserthen "device does not exist"01:06
smoserbefore we ever try to resolve the devpath01:06
rharperhrm01:06
rharperthen why did you fail before ?01:07
rharperindeed, exists does a realpath (I suppose)01:07
smoserbecause we used os.path.isfile01:07
rharperah01:07
rharperright01:07
smoserwhich is not true for a block device01:07
rharperand there is no path.isdevice01:07
smoserbut /me just assumed it was01:07
smoserright01:07
rharperwell, it's pretty crappy to not have that but I suppose that's a posix thingy (or even linux ism)01:07
smoseryeah. curtin probably has one01:08
smoserjust stat and check its doable. but this is sufficient. we're reasonably sure that //dev/disk/cloud/azure_resource is not goign to point to a character device or a directory01:08
smoseror even a file01:08
smoserand if it does, then other crap is gonna fail01:08
rharpery01:09
smoserthank you for your help, rharper!01:09
rharpernp01:09
smoserrharper, did you find evidence of /dev/sdb1 existing01:14
smoserwhen the /dev/disk/cloud/azure_resource did not ?01:14
smoserer... /dev/disk/cloud/azure_resource-part1 did not01:15
smoseri did consider it possible htat we could find existance of /dev/disk/cloud/azure_resource before kernel had probed the partitiones01:15
rharpersmoser: no, but it's certainly possible w.r.t udev race with symlink01:16
rharperI thought it was the case01:16
smoserbut a udevadm settle shoudl work01:16
smoserright ?01:16
rharperyes (empty the queue)01:16
smoseror maybe not01:16
smoseractually not though01:16
smoserbecause i guess the device could exist01:16
smoserbut the kernel not have probed01:17
smoserthen we see it exist01:17
smoserudevamd settle01:17
smoserand *then* kernel probe01:17
smoserpossible ?01:17
smoserso i dont know what to do there...01:17
rharperwell, the kernel will probe the device01:17
rharperfor us01:17
rharperand reports the partition table (and emits two events)01:17
rharperoen for the the disk and one for the partition01:17
smoserright. but it might not have gotten around to it01:17
rharperso, the only tiem would be between the two01:17
smoserright.01:17
rharperok, I've gotta run and get my son, bb in 3001:17
smoserok.01:18
smoserthankds.01:18
=== mgagne is now known as Guest52285
jgrimmpowersj, for awareness -> https://gist.github.com/smoser/29ea35a797c0df1fcb6ac875a024efa915:23
jgrimmconsider as part of scenarios we'd like to make sure covered in integration tests15:24
powersjjgrimm: thanks - I will add that to the docs of things we need to do16:21
jgrimmthanks16:22
powersjrharper: there was another document you put together that had like 8 steps for cloud-init that was a good test. I can't seem to find my bookmark for it.16:41
powersjDo you recall where that is as well?16:41
rharperyes16:42
rharper<rharper> but, really it was just a list of things to check (didn't discuss how to do that): Networking, User Creation, Import ssh keys, ssh to instance, sudo privs, resizes disk, “refreshes on boot”, install snaps16:51
rharper<powersj> I wanted to check to see if the tests I wrote either covered all that or I should write a custom case for that16:51
rharper<rharper> nice16:51
rharper<powersj> refreshes on boot == re-runs parts of cloud-init on a reboot?16:51
rharper<rharper> the "refreshes on boot" and "install snaps" is snappy specific,  resizes disks happens both in cloud-image and UC16 image but in different places (UC16 initramfs does it vs. cloud-init)16:51
rharper<rharper> no, rather snapd checks if there are new snaps (core, kernel) downloads, installs and schedules a reboot16:51
rharper<rharper> that can be put on-the-side for now (UC16 specific test)16:51
rharper<rharper> and unrelated to cloud-init other than, it should still work in UC16 + cloud-init (which it does, though testing that is hard since we don't control what's in the channel)16:51
rharper<powersj> ok thank you!16:51
vans163Fedora 24 cloud image. "calling 10.0.2.2/latest/meta-data/instance-id"  does this mean my cloud-init iso is invalid?16:58
vans163so its defaulting to trying cloudinit over the network?16:58
vans163is instance-id: a manditory field? i was missing it17:01
vans163Alot of cloud images do not have root user inmind.  I want to set root password the same on all cloud images (vs using their default users)17:04
vans163so I just did   chpasswd: list | root:1234567817:04
vans163maybe this is wrong?17:05
rharpervans163: if you provide a configdrive then you need an instance-id17:05
rharperif you only provide user-data, it is going to search for an instance id17:05
rharpervans163: you don't want a root password, really ;  cloud-init can configure sudo privs for a user (The ubuntu cloud-image does this for the default ubuntu user if you don't specify your own list)17:06
vans163rharper: my problem is this is for veterans to beginners of linux, the vets can use their own custom cloud-config, but beginners will have a hrd time trying new distros if every distro has their own default user17:09
vans163rhapher: let me try with adding instance-id17:10
vans163(kind of how digital ocean and vultr do it)17:10
vans163every flavor of linux has the same default user (root)17:10
rharper=(17:13
rharpersudo bash, gets you to root17:13
rharperwithout setting root password17:13
rharperyou can define the name of the user the same across distros via the cloud-init user: config17:14
rharperhttp://cloudinit.readthedocs.io/en/latest/topics/examples.html   the 'users'17:14
vans163rharper: that is what I am confused about, root should automatically be defined so if I wanted to make it only SSH key accessible, I do users: - name: root ssh-authorized-keys: ...17:22
vans163and it worked for me on a simple config, duplicate sshkeys were ignored17:22
rharperroot of course exists, but it doesn't have a password set17:23
rharperto enable root ssh access, there may be another switch17:23
rharperremote root via ssh is really bad too17:23
vans163hum.. neither is working for me now. it prints "cloud init 0.7.7 running init-local".. and stucks. Then after a while starts trying URL, then boots the cloud image having not ran anything.  Going to try I guess to pick apart the cloud-config I have?17:25
vans163and see what could be making it freeze like this17:25
rharperhttp://cloudinit.readthedocs.io/en/latest/topics/modules.html#ssh17:25
rharperit's not freezing, but likely looking for a network datasource which you don't have;  I suggest using cloud-localds  --help as a starting point for building a working local data source (configdrive)17:26
vans163using a simple config taht smoser linked me, i had no problems eirler17:26
vans163going to start from there i guess17:27
vans163instance-id does this have to be string actually?17:27
vans163i just put 1 for testing, maybe thats causing the issue?17:27
rharpernot sure what the min is17:27
rharperbut using `uuidgen` output is going to work fine17:27
rharperthe example is i-abcdefg17:28
=== Guest52285 is now known as mgagne
vans163rharper: currently trying this config http://paste.ubuntu.com/23486774/17:34
vans163can that instance-id go into the user-data tho?17:35
rharperno, instance-id is always part of meta-data17:35
rharperso, the configdrive is an iso of a directory structure17:35
rharperin there will be a metadata dir with the instance-id in it17:35
rharper% cat m/meta-data17:36
rharperinstance-id 7c871218-4ba9-45ba-854a-2a0a41cb928f17:36
vans163ah17:36
vans163so using that links config, I can boot BUT the password for user fedora (the default fedora 24 user) is not passw0rd17:47
vans163also i see the cloud init stuff go off17:47
vans163it says I need to provide a http://cloudinit.readthedocs.io/en/latest/topics/datasources.html#no-cloud.17:49
vans163no-cloud datasource?17:49
rharperwell, you did, if you created the iso file and passed it in17:49
vans163yea i see.  let me go back to trying the ubuntu image again and confirm the password for ubuntu changed17:49
rharpernocloud is embedded within the image, the configdrive is equivalent ;17:50
rharperlooking at the fedora distro code in cloud-init, need to see where the default username is set17:50
vans163i jsut googled for fedora cloud image default username, seems to indicate fedora.17:50
rharperright17:50
rharperbut cloud-init has a distro class which can set these values17:51
rharperI'm not sure what's set at the moment in your cloud-init rpm17:51
vans163ahh17:51
vans163i have cloud init 0.7.7 not sure what ver of cloud-localds17:52
rharperhttp://paste.ubuntu.com/23496463/17:53
rharperI think that should get you a fedora user for now;  harlowja had a merge proposal which would have broken out the default distro and user stuff  better;    you can look at /etc/cloud/cloud.cfg in your instance to see what the system_info dict looks like17:55
vans163tried ubuntu. I see the cloud init go off saying things like "resizing root " etc, but go to login screen and i cant login as ubuntu/passw0rd18:00
vans163let me try that fedora config, back to fedora18:02
powersjsmoser: rharper: have time for int. test meeting?18:03
rharpery18:03
jgrimmpowersj, interetsted too if you have a HO18:05
vans163hum  hostfwd=tcp::2222-:2218:05
vans163is this line critical?18:05
vans163i took that line out18:06
vans163dont see why the need to forward a port.. but cloud-localds shows that line in the example18:06
rharperthat just lets  you ssh into your VM if you're running local18:08
rharpervs login via console18:08
rharperit forwards host port 2222 into the guest 2218:08
vans163yea i see, so not critical to cloudinit i tried to ssh to localhost 222218:12
vans163fedora and pass passw0rd18:12
vans163Thisis what im doing  https://gist.github.com/anonymous/1406b7470736587554075f1f9be5873418:16
vans163maybe the config is broken so it stops parsing it without error?18:16
rharpervans163: not sure, if you cleanly shutdown, then you can mount it up and extract /var/log/cloud-init*.log so we can see what happened18:18
vans163okay il do that, let me try 1 last thing.  notice how I passed paths to the file, but the example clearly say user-data and meta-data18:19
vans163maybe the cloud-localds does not form the right paths?18:20
vans163okay rharper: so if I follow the instruction to a T it works18:24
vans163x.x18:24
vans163but how can I add more flexibilty18:24
rharpercloud-localds does the right thing18:25
vans163like I cannot call the files meta-data as tehre could be a case when I spin up 2 at once18:25
rharpernot following, you can point to the same iso, it's read-only18:25
vans163actually there maybe 1 thing I missed  the two EOF's18:25
rharperif you want the same user-data into multiple instances, you can re-use the same iso18:25
vans163or is that just for the terminal.. sec18:26
vans163yea that EOF is just for the terminal18:26
vans163(it does not change the file)18:26
vans163oaky let me try something then18:27
vans163fedora still does not work. Ubuntu worked, fedora I see my script executed (because sshd restarted)18:30
rharperok, there may be something not quite right with the default cloud.cfg in the fedora cloud-init;  is there a fedora cloud-image that is publicly available ?18:31
vans163https://getfedora.org/en/cloud/download/  i got it from here the raw image and made it into a qcow218:32
rharperok18:32
rharperI'll see what I can figure out in a bit18:32
vans163md5sum  672669a587d653ef4100bcd03cb4ce32  /cloud/image_mnt/Fedora-Cloud-Base-24-1.2.x86_64.qcow218:33
vans163thanks18:34
vans163rharper: i fetched the cloud-init-output.log does not seem to have anything useful.  cloud-init.log is empty18:42
rharperthat's odd18:42
vans163do you still need the *-output.log?18:42
rharpernot really, if cloud-init.log is empty, I don't see why we'd have anything in -output.log (that's stderr/stdout from cloud-init )18:42
vans163ah I see a line like this:18:42
rharperdoe syslog have an error ?18:43
rharpermaybe like a python stacktrace ?18:43
vans163ci-info: no authorized ssh keys fingerprints found for use fedora.18:43
vans163cc_set_passwords.py [WARNING]: no default or designated user to change password work18:44
vans163(that was the password: passw0rd line probably outside the scope of users)18:44
vans163*work/for18:44
vans163it seems as if it ignored the users: field18:45
vans163or no thats not the case. otherwise it would not print that ci-info:  (the order of those 2 is reversed, first the cc_set_passwrd.py warn, then that other)18:46
rharperI think the cloud.cfg inside the image is probably still set to ubuntu, rather than fedora;  need to check that out...18:46
vans163where woudl the syslog be located?18:47
rharpervar/log/syslog18:47
vans163its not there18:48
vans163i can dump you the /etc/cloud/cloud.cfg?18:48
rharperI'm opening it up now18:49
vans163ah18:49
rharperit's working for me here18:52
rharperthe default user is fedora18:52
rharperso, you can leave the 'user:' key out18:52
vans163does your config look the same as this http://paste.ubuntu.com/23486774/?18:55
vans163let me try redownload the image again maybe i got the openstack one by accident, pretty certain i got raw tho.18:55
rharperyes18:55
vans163so you just downloaded the raw and did  xz Image.raw.xz  then used that?18:56
rharperI used the qcow2 file18:57
rharperit works fine18:57
rharperbut the 0.7.7 I think has a bug that's been fixed upstream but not in there, yet18:57
rharperso, it's trying to load the user-data but failing18:57
rharperwhich is why you're seeing anything besides fedora: passw0rd not working18:57
vans163let me try.. also does that mean I wont be able to set a ssh key for a user other then fedora?19:01
rharperI think so, but I need to find out a bit more19:01
rharperI believe the cloud-init in the image is going to need a patch; but I need to find out the actual bug19:01
vans163say once it gets patched (if it does) would I be able to simply mount the image and apply the patch?19:03
vans163vs a more complex process19:03
rharpercloud-utils includes a tool called mount-image-callback which would aide in injecting an updated package (or applying a patch)19:05
rharperwhat does your meta-data look like ?19:06
rharperhttps://gist.github.com/anonymous/1406b7470736587554075f1f9be5873419:07
vans163hum wtf19:08
vans163that raw image is 500mb while the decompressed openstaack qcow2 is 1gb19:08
rharperthat looks fine, you can drop the users dict;  then you can in-line a ssh-authorized key19:08
vans163let me try that other image19:08
vans163instance-id: i-abcdefg   is all thats inside meta-data19:09
rharperthat's fine; I had a typo in mine19:10
rharperfixed that and the sample config works just fine19:10
rharperI'm testing adding an ssh public key to fedora user19:10
vans163going to brb in an hour or two19:11
rharpersure19:11
rharpervans163: so, things appear to be working fine for me:  http://paste.ubuntu.com/23496940/  is the template I'm using, I see a default password for user: fedora, and then import a ssh public key to them, I used 'users' to define a new user 'rharper' and import an ssh public key there.  That runs fine in the qcow2 image (I expect the raw to work just as well);  I can ssh in to either fedora or 'rharper' in that image after19:31
rharper cloud-init runs.19:31
vans163rharper: I am back let me test22:46
seanbrighthi. about to head out for the weekend, does everything look ok with this merge request:22:47
seanbrighthttps://code.launchpad.net/~sbright/cloud-init/+git/cloud-init/+merge/31131322:47
seanbrightfirst time submitting a LP patch22:48
vans163rharper: this is not working for me on ubuntu :( http://paste.ubuntu.com/23496940/22:48
vans163i replaced <ssh key here> with  wtff abababab ee22:49
vans163in both cases22:49
vans163if I only leave the top 4 lines of that paste, it works22:49
vans163otherwise even ubuntu users password is not passw0rd22:49
rharpervans163: if you don't want the ssh key, take the 3 lines out;  5-7, and 13-15; don't make them gibberish22:56
vans163the command works its starnge i just mounted the drive and the user has a home folder authorized keys are there22:57
vans163but at the login prompt i cant login as the user22:57
vans163(using vnc)22:57
vans163so cloud init successfully created everything22:58
vans163maybe some command is blocking..22:59
vans163i cant even ssh to it23:01
vans163as soon as i delete everything except the top 4 lines of that config file I can login as ubuntu/passw0rd23:02
vans163when I add the line to create a new user (leaving the top 4 as well)23:02
vans163the /home/jharper/.ssh/authorized_keys is there23:02
vans163but i cannot login as jharper/passw0rd nor ubuntu/passw0rd23:02
vans163also /var/log/cloud-init.log is quite populated23:03
vans163now even ubuntu stopped working23:27
vans163something is def wrong with my system i guess23:27
vans163and not cloud init23:27
vans163no nevermind i got confused, i just retried ubuntu with the top 4 lines of the config. everything works23:29
vans163as soon as i make config more complex. nothing23:29
vans163call it a bug or a feature but apparnetly passwords like passw0rd and toor dont work23:48
vans163using wtf12345! for example works23:48
vans163so maybe something inside cloud-init is checking the passwords complexity or something and silently failing23:49
vans163and a silent failure here seems to make the entire config fail or locks the system from login or something23:49
vans163fedora works finally!23:51
vans163so conclusion. 99% of ppl use cloud-init in openstack23:51
vans163and openstack generates the passwords by random23:51
vans163for ppl using cloud-init and setting a password of hello, it silently fails23:51
vans163thus this bug/feature was never reported23:52
vans163maybe this conclusion is wrong and the underlying OS is limiting it but i doubt it as i can set a password of 12345 for excample on fedora 24 wiht no problems23:52
vans163even for root23:52

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