/srv/irclogs.ubuntu.com/2022/03/10/#cloud-init.txt

Guest48hi guys. I'm toying around with Proxmox and cloud-init currently. I created a new vm and installed ubuntu 20.4 server in it. in the vm settings I added a cloud-init drive and set some test configuration (user, dns server). however, none of the settings gets applied. digging into it I found that cloud-id reports "none" so I set the smbios serial to11:33
Guest48"ds=nocloud" but that does not seem to fix it. cloud-id still reports "none"11:33
meenaGuest48: have you tried hard-coding it in the config?11:39
Guest48no. where would I do that?11:42
meenaGuest48: in /etc/cloud-init/ lemme check where i set it11:55
meenaGuest48: i set it in https://github.com/canonical/cloud-init/blob/main/config/cloud.cfg.tmpl under datasource_list12:00
meenai only set the one i want12:00
Guest48interestingly enough ds-identify reads the smbios value: DMI_PRODUCT_SERIAL=ds=nocloud12:02
Guest48meena: I set it to NoCloud in cloud.cfg, did cloud-init clean/init no change. I think as long as cloud-id does not report the correct value it won't work?12:11
meenaGuest48: i'd setup higher logging and see what it says there12:11
meenathere must be a good reason why it's refusing it recognize it correctly12:11
meenaand if it's a bad reason, it should be fixed12:12
meenaheck, maybe even if it's a good reason12:12
meenawhich version of cloud-init is this, Guest48 ?12:12
Guest4821.4-0ubuntu1~20.04.112:13
meenathat's not too long ago? right?12:19
Guest48like I said, fresh install of ubuntu server12:19
meenaNovember last year; yeah, so,12:20
minimalGuest48: how did you create the "cloud-init drive"? using cloud-localds?12:40
Guest48in Proxmox I added the cloud-init drive and then on the cloud-init tab I set the values and clicked recreate image12:42
minimalnot familiar with Proxmox, I assume that is creating a suitably "formatted" ISO/VFAT drive for NoCloud (i.e. fs label of "cidata" etc)12:44
Guest48fs label is "cidata" and It is a proper iso file that the guest os recognises as cdrom12:48
minimalso if NoCloud is listed in the datasource_list section of the /etc/cloud/cloud.cfg in your Ubuntu image then it should check all the devices for a "cidata" labelled fs and see that and use with NoCloud - if cloud-init debugging is enabled you will see it doing this in cloud-init.log12:49
Guest48minimal, regardless of what "cloud_name" is detected as in instance_data.json?12:50
Guest48https://pastebin.com/raw/iksNcC7T12:52
minimalGuest48: what is in the datasource_list of /etc/cloud/cloud.cfg?12:53
Guest48datasource_list: ['NoCloud', 'ConfigDrive']12:53
minimalok, so it should only be checking for either of those. So enable debug for cloud-init and then check /var/log/cloud-init.log to see what is happening12:54
Guest48root@ubuntu204:~# grep -i nocloud /var/log/cloud-init.log13:01
Guest48root@ubuntu204:~#13:01
minimalGuest48: did you enable debugging for cloud-init?13:02
Guest48I can't seem to find anything specific for that in the docs. the logging configuration is set to write everything with log level DEBUG or higher already to the log files?13:06
minimaltypically in /etc/cloud/cloud.cfg.d/05_logging.cfg you change entries that mention level=INFO to level-DEBUG13:10
minimals/l-D/l=D/13:10
minimalwith that set then I'd expect to see information related to NoCloud in cloud-init.log13:12
Guest48that seems to be the default? all entries with "level=" are set to DEBUG except for 1 that is set to WARNING (console handler)13:18
minimalin my case I enable debugging by setting level=DEBUG for the [logger_root], [logger_cloudinit], and [handler_cloudLogHandler] entries13:29
minimalwith that in place then cloud-init.log contains an entry: __init__.py[DEBUG]: start: init-local/search-NoCloud: searching for local data from DataSourceNoCloud13:31
minimaland subsequent lines show it running "blkid" search for filesystems with the "cidata" label13:32
Guest48minimal, help me understand this please. the smbios serial "ds=nocloud" should tell cloud-init that the cloud-id / cloud_name should be set to "nocloud" no? the way I understand it is, that cloud-init does not even bother to look for a datasource as the cloud name is "none"13:34
minimalGuest48: cloud-init uses the DataSources listed in cloud.cfg's datasource_list13:36
minimalonly what is listed there is "enabled".13:36
minimalso it checks for each of the listed DataSources to try and use one of them13:36
minimalfor NoCloud it is used if a suitable source of meta-data/user-data is found - i.e. a fs with the "cidata" label13:37
Guest48https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html the documentation seems to tell different?13:37
minimal"Alternatively, you can provide meta-data via kernel command line" - note the use of the word "alternatively"13:37
minimalif you use "ds=nocloud" then you are providing the information as part of that cmdline option13:38
Guest48hmm13:39
minimalyou have already indicated you have created a suitable cidata ISO and so the "alternatively" part is not relevant, read the paragraph preceeding that13:39
minimalthe "ds=nocloud" part comes in if you do *NOT* want to provide a cidata filesystem13:40
Guest482022-03-10 13:41:17,708 - main.py[DEBUG]: No local datasource found13:45
minimaldo you see an entry of the form: __init__.py[DEBUG]: Looking for data source in: ['NoCloud', 'None']13:47
minimalor similar?13:47
Guest48no13:47
minimalthat's where it should log the values from datasource_list that it will try to use13:48
minimalthis is Ubuntu Server - perhaps there's some other factor in play - like "subiquity". That's something the Canonical guys would be familiar with13:50
minimalhave you tried using an Ubuntu Cloud Image rather than Ubuntu Server?13:52
Guest48it must have to do with the ubuntu install. I just tried a fresh Debian netinst, booted the system, installed cloud-init, set datasource_list to nocloud and rebooted. worked instantly.14:56
minimalGuest48: as I indicated, I suspect it may be related to Subiquity which is used for installing Ubuntu Server in general. You could try one of the Ubuntu Cloud images instead, e.g. jammy-server-cloudimg-amd64-disk-kvm.img from here: https://cloud-images.ubuntu.com/jammy/15:22
Guest48does ubiquity have it's dirty fingers in the installed system or did you assume I am at the install process?15:33
minimalNo idea, I'm not familiar with Subquity. I'd expect that a Ubuntu Server *Cloud* image is specifically designed for cloud-init use rather than the "generic" Ubuntu Server image. Against, its something for the Canonical guys on here to give a definitive answer15:35

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