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

vans163smoser: I want it to, i set it to true right now getting ready to test00:04
vans163would genisoimage execute the meta-data (containg #cloud-config) and user-data in the order specified?00:07
vans163so for exampl I should probably set the meta-data first, then the user-data (which can also be #cloud-config but supplied by user)00:07
vans163genisoimage -output cloud-init.iso -volid cidata -joliet -rock meta-data user-data    ?00:07
vans163https://cloudinit.readthedocs.io/en/latest/topics/modules.html#set-passwords  Also is that top level password by default the root password?00:09
vans163For example even on ubuntu which seems to say the default user is ubuntu00:09
smoservans163, not sure what you mean 'execute'01:27
smoserpassword is for default user.01:28
smosermeta-data does not get executed. and order of arguments to genisoimage does not matter. you're mastering a filesystem.01:29
vans163smoser: i see okay, I think i need to use chpasswd then to change root password01:33
nilujej/close09:21
=== shardy is now known as shardy_lunch
=== shardy_lunch is now known as shardy
vans163is the correct way to mount the cloud-init for qemu to set it to -hda ?14:46
vans163also do we need to remove it before restarting the vm? or would cloud-init gaurantee it wont execute twice?14:46
cpaelzervans163: I don't know what config you have - but e.g. user-scripts usually only run once14:57
cpaelzervans163: on those you find a bit more, maybe the frist slightly outdated http://stackoverflow.com/questions/6475374/how-do-i-make-cloud-init-startup-scripts-run-every-time-my-ec2-instance-boots http://cloudinit.readthedocs.io/en/latest/topics/examples.html#run-commands-on-first-boot14:58
cpaelzerand I must admit I should know better but I don't14:58
cpaelzergut feeling tells me to remember that the actual config is only done once, but I'm not feeling confident enough to tell any hard facts14:58
cpaelzerhighlighting smoser for some real insight for you14:58
cpaelzersmoser: ^^14:58
smoservans163, most user-ata is handled once "per instance"15:00
smosermeaning per-instance-id. if you want to run it again, you'd need to change thte instance id that is on the config disk.15:00
smosermostly , it shoudl "do the right thing".15:00
smoserif you want to detach that disk, then you will need to tell cloud-init "manual_cache_clean: True".  And you have to write that (probably via user-data) into /etc/cloud.cfg.d or the next reboot, it will go  looking for a datasource again.15:01
smoser-hda doesn't matter.15:02
smoserany block device will suffice.  cloud-init finds disks by the disk label, so as long as the guest sees the block device its fine.15:02
rharpervans163: alternatively, if you're just re-testing that same user-data; I usually blow away the instance data (sudo rm -rf /var/lib/cloud/* /var/log/cloud-init* ) and reboot;15:02
smoseri would nto suggest using '-hda' generally as virtio is superior in just about everyr way15:02
rharperother than having a nice shorthand cli name15:03
vans163smoser: im thinking if I dynamically can add disks and things. if then it would be good to assign that cloud-init disk to something that would not get in the way.15:03
vans163for example one instance may need cloudinit.iso mycustomiso.iso  disk.qcow2 disk2.qcow215:03
vans163where should cloudinit.iso so it does not get in the way15:04
smoseri dont know what "get in the way means".15:04
vans163because afaik using -cdrom it automatically assigns a hdx15:04
rharperthere's only one cdrom15:04
smoserit doesnt have to be a cdrom15:04
smoserany block device.15:04
rharpervans163: yeah, if you use virtio to host the iso file, that works fine too15:04
smoserpretty sure you *could* attaach multiple cdroms to a guest if you wanted.15:05
rharperthe IDE devices (hd[abcd]) supports only 4 devices, but virtio-blk, or scsi support many more15:05
smoserbut i'd just do it as a virtio disk15:05
smosersurely you could with virtio cdrom15:05
rharpersmoser: only two, IIRC15:05
rharperwell, virtio block15:05
rharperwith an ISO payload15:05
vans163ah so  -drive id=disk0,file=/cloud/cloudinit/100.iso,if=virtio   for example?15:05
smoserther eis a virtio cdrom i think, no?15:05
rharperthat's not quite the same as a cdrom device15:05
rharpervans163: yeah15:05
vans163then disk1 could be the qcow2?15:05
rharpersmoser: no, just virtio-blk, or virtio-scsi (which can have cdrom properties)15:06
smoserah.  sure.15:06
rharpervans163: sure;  Ubuntu cloud-images find the root devices via label15:06
rharperand cloud-init finds the datasource disk via label as well15:06
vans163disk1=...disk1.qcow2   disk2=...disk2.qcow2   disk5=...Another.iso15:06
rharperroot=cloudimg-rootfs  userdata=cidata15:06
smoservans163, cloud-localds --help shows:15:06
smoser    * kvm -net nic -net user,hostfwd=tcp::2222-:22 \15:06
smoser         -drive file=disk1.img,if=virtio -drive file=my-seed.img,if=virtio15:06
smoserthat works fine.15:07
vans163ah so i can drop the id then, im not using it elsewere in the cmdline15:07
smoserdrop the id ?15:37
vans163smoser: -drive id=disk0,..15:37
smoseroh. well, that is a more verbose way of doing things. you do need the moer verbose way in some cases.15:38
smoserqemu is not fun ot interact with from a command line.15:39
smoseri use xkvm. http://bazaar.launchpad.net/~curtin-dev/curtin/trunk/view/head:/tools/xkvm15:39
smoserwhich generates those id= and such.15:39
smoserits not perfect, but makes at least network devices and block devices easier15:40
smoserxkvm --disk=/tmp/asdf --dry-run --netdev=user15:40
smoser qemu-system-x86_64 -enable-kvm -device virtio-scsi-pci,id=virtio-scsi-xkvm -device virtio-net-pci,netdev=net00 -netdev type=user,id=net00 -drive file=/tmp/asdf,id=disk00,if=none,index=0 -device virtio-blk,drive=disk00,serial=asdf15:40
smoserhttp://bazaar.launchpad.net/~curtin-dev/curtin/trunk/view/head:/tools/xkvm15:40
vans163smoser: that looks sweet ty15:43
vans163gonna check it out15:43
=== rtheis_ is now known as rtheis
vans163so im just seeing a black screen with blinking cursor16:21
vans163i tried to use a live iso and it works fine, when i use the cloud-init iso i made with genisoimage16:21
vans163black screen, blinking cursor at bottom left16:21
vans163I used genisoimage -output 100.iso -volid cidata -joliet -rock user-data meta-data    user-data was an empty file, meta-data had the #cloud-config16:23
vans163catting the 100.iso i can see the #cloud-config is htere16:23
vans163could this mean my #cloud-config is incorrect, or could it mean the iso is not correctly generated?16:25
powersjvans163: if you suspect issues with your cloud-config you could use lxd to test it if the config is not too complex.17:27
powersjif the config is bad you can view the /var/log/cloud-init-output.log and it will have a message about failing to read the user data17:28
vans163i think its to do with qemu and the image i am using, i cant figure this out atm17:32
vans163I download xenial-server-cloudimg-amd64-disk1.img and set that as first disk via -disk17:32
vans163but even that does not boot. afaik without cloud init the cloud image should boot no?17:32
vans163i can boot using a live iso just fine though, say if i insert a Fedora_24_workstation.iso17:33
vans163Qemu just says booting harddisk.. failed to boot, not a bootable disk.  I set virtio off17:33
vans163gave the .img 777 even17:34
vans163file on it reveals xenial.img: QEMU QCOW Image (v2), 2361393152 bytes17:35
powersjAre you using qemu via the cli? or via someting like virt-manager?17:35
vans163cli for now i can paste my config17:35
powersjif you could17:35
vans163so 2 cases here i tried both. 1 with that -cdrom 1 without.  With cdrom errorcode 0004, without cdrom hangs indefinately on Reading harddrive (i forgot to change format=raw to format=qcow2)  https://gist.github.com/anonymous/5049a93256c69f4a2a3dd93bc163c82617:39
vans163"Could not read from CDROM (errorcode 0004)17:40
vans163100.iso is the genisoimage with the #cloud-config17:40
vans163my thoughts are even if the #cloud-config is wrong, the CDROM should still boot/read from and give an error17:43
vans163or maybe not..17:44
vans163ahhh missing a \ at end of the -cdrom line. added it and its stuck indefinately at booting from harddrive17:45
vans163iotop reveals 0 disk activity17:45
vans163http://imgur.com/a/FrBJV17:47
powersjlooking - nice catch on the \17:52
vans163powersj: ty note if I change that -cdrom to -cdrom /root/iso/fedora_24.iso  i boot immediately to the live installer17:55
vans163my best guess right now is not proper genisoimage ?17:55
powersjwell so your qemu command line says boot order=d which means to boot the cdrom first17:57
powersjorder=c will boot the drive first17:57
powersjwhen using -drive I think you have to use order=c as well, but I'm not certai17:59
powersjcertain, rather17:59
powersjqemu-system-x86_64 -enable-kvm -boot order=c -drive format=qcow2,file=ubuntu-16.04-server-cloudimg-amd64-disk1.img18:09
powersjis what I used as a very simple example to get drive going. Otherwise may chime in with better suggestions18:10
vans163let me try18:16
vans163it just boots from harddrive first now and stucks indefinetaly. I think a good question would be can a ubuntu cloud image (qcow2 format) boot itself?18:18
vans163without a cloud-init iso supplie18:18
smoservans163, you have to boot the cloud image.18:19
smoseri'm confused as to what you were trying to boot.18:20
vans163does not matter what, if I boot the CDROM it fails and boots the harddrive, if i boot the harddrive it skips booting cdrom18:21
vans163in both cases the problem is the same, infinite stuck while booting harddrive   seems there are issues https://bugs.launchpad.net/cloud-images/+bug/157309518:21
vans163going to try another cloud image18:21
smoservans163, can you just show what you're doing ?18:24
smoseryou're using qemu (or kvm) right ?18:24
vans163this is qemu.  and i think the problem is im not using the right clud image18:28
vans163it seems most cloud images are for openstack or ec218:28
vans163going to try the generic centos image18:30
vans1631 moment18:30
vans163okay so the centos generic cloud image boots to grub atleast18:34
vans163then the infinite hang, guessing this is where cloud-init comes into play18:34
vans163so after grub it needs to do cloud-init?18:34
vans163*after grub boots kernel18:34
smoserhttp://paste.ubuntu.com/23486774/18:37
smoser^ that works. i dont know about centos images, or what they have.18:37
smoserbut quite possible you can substitue the centos cloud image for this.18:38
vans163smoser: wow let me try that!18:38
vans163smoser: ty so much it works!18:50
vans163smoser: 1 key point that i missed was the xenial image is compressed. had to qemu-img convert -O qcow2 to uncomrpessed18:51
smoseryou dont have to do that.18:51
vans163strange18:51
smoseryou can, but you dont have to18:51
vans163let me try again18:51
vans163first time i tried it hanged at Reading harddrive..18:51
smoserif you try with compressed, it will be slower.18:51
smoseras you're doing cpu decompression on every read18:51
smoserbut it will work18:51
smoseri did exactly above and it worked.18:52
vans163yoyur right18:52
vans163it works in both cases18:52
vans163strange i think im just confused as i have liek 10 of these configs18:52
vans163must of confused something, but compressed and not compressed both work18:52
vans163going to try that same seed with the openstack debian image18:53
vans163works18:54
vans163I found the problem. I was using -cpu host18:57
vans163when I add that to your config, i get the hang on boot18:57
vans163just like with my config18:57
vans163but as far as im aware -cpu host gives you better performance?18:57
vans163it seems it might not be the case19:01
=== shardy is now known as shardy_afk
rharpervans163:  -cpu host just exports host cpu features into the guest but the default qemu64 cpu is usually sufficient unless you have a highly tuned application looking for specific recent cpuflag features and the app would otherwise turn things off19:12
rharperfor example, ffmpeg does per-cpu tuning of ussing sse2 vs sse4;  there are ways to expose just those features instead of -cpu host which can cause issues for migration (if that's a use-case)  , you can do -cpu qemu64,+sse4  etc.  or use the cpu classes like Nehalem, etc.19:13
smoservans163, where are you running this ?19:13
smoseradding -cpu host doesn't change anything for me.19:13
smoseryou probably need -m 512 (or more) . default memory is 128, and with that i saw an OOM on boot. i'd just not go there.19:15
vans163smoser: i get  warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 0]  (bit 0 1 2) 3 of these errors19:15
smoseryeah, i see that.19:15
smoserjust noise19:15
vans163Maybe -cpu host is passing all features of the cpu but this particular cpu is buggy?19:15
vans163hum19:15
vans163rharper: good to know that -cpu qemu64,+sse4  I will note that, as I woudl like the guest to take advantage of things like that and AES-NI19:16
=== shardy_afk is now known as shardy
=== shardy is now known as shardy_afk
vans163also note that i never had an issue using -cpu host before, but here its refusing to boot the qcow2 image19:19
vans163and on this node i can boot a qcow2 image with fedora that i installed from a iso with no problems. and win10 works19:19
rharpervans163: if you have the bootlog from the failed scenario, I can look at see if something obvious comes up19:20
vans163i built qemu from source hence its version 2.7.519:20
vans163maybe something do to with that?19:20
vans163any idea how to fetch that?19:20
rharperyou can use -serial stdio19:21
rharperand it will spit serial console data to stdout19:21
vans163sec19:21
rharperUbuntu cloud images boot with console=ttyS0 by default, so boot messages will show up there19:21
vans163nothing out of the ordinary, those same warning msgs19:22
vans163then vnc shows Booting from hard disk... MBR   and stuck19:22
vans163remove -cpu host,  and it shows the same thing except continues19:23
vans163then boots19:23
vans163maybe theres a way to get more logs?19:23
vans163it does not even get to boot  http://imgur.com/a/FrBJV  this screen is where it gets stuck on .  Except it also prints MBR now19:24
vans163maybe.. its in some kind of eufi mode and looks for a GPT?19:24
vans163It also prints SYSLINUX 6.03 EDD 20150820 Copyright (C) 1994-2014 H. Peter Anvin et al  after the MBR on a new line. and thats it19:25
vans163cpu usage is 100% io seems 019:26
rharperwhat host cpu do you have?19:27
rharperI wonder if the 16-bit emulation in-kernel kvm is failing19:27
vans163Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz   stepping 7, microcode 0x71019:27
rharpernewer intel cpus have a feature to provide support for 16-bit "big real mode" instead of having kvm do software 16-bit emulation19:28
vans163ohh i enabled 1 thing new, on the motherboard i enabled power saving mode19:28
vans163before it had all powersaving and C states disabled, and i passed to the kernel to disable it19:29
rharperpower states shouldn't matter19:29
vans163okay so thats off the table19:29
rharpercan you show your full commandline ? with the -cpu host ?19:29
vans163i could run it in valgrind and print a report19:29
rharperit's in-guest19:29
rharperso valgrind won't show yuou anything19:29
vans163ah19:29
rharperit's stuck in bios19:29
vans163sec19:30
rharperwhich is early bootstrap of the vm, running 16-bit asm of SeaBIOS19:30
vans163https://gist.github.com/anonymous/5cd8e1110161adba6a597b1494ea458d   remove that -cpu host everything works19:30
rharperthis may help see the difference of bios boot between with and without -cpu host;  -chardev stdio,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios19:31
rharperand just the debian image? or all images?19:31
vans163all19:31
rharperok19:31
vans163(ubuntu deb fedora)19:31
vans163i could boot non-cloud images but I did not test once i enabled power saving19:32
vans163let me try..19:32
vans163so its not an oversight19:32
vans163gonna try your extra param first19:33
rharperok, on Yakkety qemu 2.6.1, that boots fine with a Xenial VM19:35
rharperon my Intel NUC (i5)19:35
rharpercan you try a different qemu as well?  I can't quite see why -cpu would affect the bios boot19:35
rharperif you drop -enable-kvm19:35
rharperand it boots, that might suggest some emulation if 16-bit boot code being an issue ... what host kernel ?19:36
vans163https://www.diffchecker.com/JOdZ8vQk  left fails right works. (no diff)19:36
rharpervery strange19:36
rharperwhat about leaving -cpu host, vut droppping the -smp ?19:37
vans163Linux x7 4.7.6-200.fc24.x86_6419:37
rharperI'm just poking at things;  there's noething obviously wrong with your command, and I see no reason why host cpu flags would affect it;  you could try to extract the kernel/initrd from the image, and boot those directly with -kernel  and -initrd;  that would take the bios bits out of the picture19:38
rharperbasically we need to hunt and peck to find out which code path is failing;  something is sensitive to the cpu flags; just not sure what or why; nothing obvious19:38
vans163drop smp still stuck.  drop kvm gives error (host cpu model require kvm).  Do you think I should try the QEMU that is in fedora 24 (the current host system)19:39
rharperyeah, that's another data point19:39
vans163it would be 2.6.219:40
vans1632.6.2 works19:43
vans163o.o19:43
vans163does not get stuck19:43
vans163Also 2.6.2 does not print the warnings that CPU extension bits are missing19:44
vans163maybe it means 2.7.5 got better support for other cpu extensions, and host is enabling them but really the CPU dont have them, and QEMU gets stuck trying to use them?19:45
rharperlemme see what that's about19:48
rharperit did sorta stickout19:48
vans163i tried googling for those errors but there is close to 0 details19:49
vans163*warnings19:49
rharperhttps://lists.gnu.org/archive/html/qemu-devel/2016-09/msg07278.html19:52
rharperthat looks relevant19:52
rharperthe xsave cpu flag, it seems19:52
vans163rharper: let me check if that landed19:54
vans163IT does not seem so . https://github.com/qemu/qemu/blob/83c83f9a5266ff113060f887f106a47920fa6974/target-i386/cpu.c#L226419:56
vans163but i386 arnt I using x86_64?19:56
vans163or is i386 still used?19:56
vans163in an emulated way to something19:56
rharperit's not i386 specific19:57
rharperit's just how the cpu targets are organized19:57
rharperthe target-i386 code produces both a 32-bit and 64-bit cpu model19:57
vans163they have 2.8 out now, let me try to patch that manually first, then stash and try 2.819:58
vans163Im not sure if I even need 2.7.5 i just wanted -device virtio-input-host-pci support19:59
vans163funny the latest commit on 2.7.5 is sept 28. so 2.8 might fix things20:03
vans163commit 453ac8835b002263a6 is very nice, its a doc update on pcie passthrough best practises20:11
powersjrharper: the snappy module is primarily for snap based system I take it? If for example I wanted it to install packages from the store on a cloud image could I use it for that?21:31
powersjI was hoping https://paste.ubuntu.com/23487411/ would install those snaps, not just install snap21:32
rharperare those snaps in stable channel ?21:33
powersjyes21:33
rharperwhich cloud-init are you testing?21:33
rharperthose certainly should get installed21:33
rharperI'm testing with 'hello' snap21:33
rharperbut I can switch to those21:33
rharperpowersj: it will work on any system that has snapd installed (so classic, or all snap)21:34
powersjrharper: using lxd cloud image of xenial with the cloud config linked above21:34
rharperpowersj: snap has to be installed, which it is in xenial +21:34
powersjsnap list after boot works, but shows nothing installed21:35
rharperwhich cloud-init are you running ?21:35
rharperwe're just now sru21:35
rharper'snap' command into xenial cloud-init; it's not there yet21:35
rharperso, yakkety  would work21:35
rharperon default lxc, snap install fails21:36
powersj0.7.8-1-g3705bb5-0ubuntu1~16.04.321:36
rharperso there may be some sort of lxd update or config to enable snap install to work21:36
rharper# snap install hello21:36
rharpererror: cannot perform the following tasks:21:36
rharper- Mount snap "ubuntu-core" (423) ([start snap-ubuntu\x2dcore-423.mount] failed with exit status 1: Job for snap-ubuntu\x2dcore-423.mount failed.21:36
rharpermaybe error like that in cloud-init-output.log21:36
rharperor an error in cloud-init.log around installing snaps21:37
rharpermight pop in #lxd to check about snap installing21:37
powersjok I'll mark this down as something to circle back to then21:38
powersj"modules-final/config-snappy: SUCCESS: config-snappy ran successfully"21:38
rharperthrm21:38
rharperthere should be some subp on the command in the log21:39
rharperif not, we definitely need a task for util.subp to create events so they're trackable via cloudinit-analyze21:40
rharpermagicalChicken: smoser ^^ item for roadmap21:40

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