[11:33] <Guest48> hi 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 to
[11:33] <Guest48> "ds=nocloud" but that does not seem to fix it. cloud-id still reports "none"
[11:39] <meena> Guest48: have you tried hard-coding it in the config?
[11:42] <Guest48> no. where would I do that?
[11:55] <meena> Guest48: in /etc/cloud-init/ lemme check where i set it
[12:00] <meena> Guest48: i set it in https://github.com/canonical/cloud-init/blob/main/config/cloud.cfg.tmpl under datasource_list
[12:00] <meena> i only set the one i want
[12:02] <Guest48> interestingly enough ds-identify reads the smbios value: DMI_PRODUCT_SERIAL=ds=nocloud
[12:11] <Guest48> meena: 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] <meena> Guest48: i'd setup higher logging and see what it says there
[12:11] <meena> there must be a good reason why it's refusing it recognize it correctly
[12:12] <meena> and if it's a bad reason, it should be fixed
[12:12] <meena> heck, maybe even if it's a good reason
[12:12] <meena> which version of cloud-init is this, Guest48 ?
[12:13] <Guest48> 21.4-0ubuntu1~20.04.1
[12:19] <meena> that's not too long ago? right?
[12:19] <Guest48> like I said, fresh install of ubuntu server
[12:20] <meena> November last year; yeah, so,
[12:40] <minimal> Guest48: how did you create the "cloud-init drive"? using cloud-localds?
[12:42] <Guest48> in Proxmox I added the cloud-init drive and then on the cloud-init tab I set the values and clicked recreate image
[12:44] <minimal> not familiar with Proxmox, I assume that is creating a suitably "formatted" ISO/VFAT drive for NoCloud (i.e. fs label of "cidata" etc)
[12:48] <Guest48> fs label is "cidata" and It is a proper iso file that the guest os recognises as cdrom
[12:49] <minimal> so 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.log
[12:50] <Guest48> minimal, regardless of what "cloud_name" is detected as in instance_data.json?
[12:52] <Guest48> https://pastebin.com/raw/iksNcC7T
[12:53] <minimal> Guest48: what is in the datasource_list of /etc/cloud/cloud.cfg?
[12:53] <Guest48> datasource_list: ['NoCloud', 'ConfigDrive']
[12:54] <minimal> ok, 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 happening
[13:01] <Guest48> root@ubuntu204:~# grep -i nocloud /var/log/cloud-init.log
[13:01] <Guest48> root@ubuntu204:~#
[13:02] <minimal> Guest48: did you enable debugging for cloud-init?
[13:06] <Guest48> I 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:10] <minimal> typically in /etc/cloud/cloud.cfg.d/05_logging.cfg you change entries that mention level=INFO to level-DEBUG
[13:10] <minimal> s/l-D/l=D/
[13:12] <minimal> with that set then I'd expect to see information related to NoCloud in cloud-init.log
[13:18] <Guest48> that seems to be the default? all entries with "level=" are set to DEBUG except for 1 that is set to WARNING (console handler)
[13:29] <minimal> in my case I enable debugging by setting level=DEBUG for the [logger_root], [logger_cloudinit], and [handler_cloudLogHandler] entries
[13:31] <minimal> with that in place then cloud-init.log contains an entry: __init__.py[DEBUG]: start: init-local/search-NoCloud: searching for local data from DataSourceNoCloud
[13:32] <minimal> and subsequent lines show it running "blkid" search for filesystems with the "cidata" label
[13:34] <Guest48> minimal, 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:36] <minimal> Guest48: cloud-init uses the DataSources listed in cloud.cfg's datasource_list
[13:36] <minimal> only what is listed there is "enabled".
[13:36] <minimal> so it checks for each of the listed DataSources to try and use one of them
[13:37] <minimal> for NoCloud it is used if a suitable source of meta-data/user-data is found - i.e. a fs with the "cidata" label
[13:37] <Guest48> https://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:38] <minimal> if you use "ds=nocloud" then you are providing the information as part of that cmdline option
[13:39] <Guest48> hmm
[13:39] <minimal> you have already indicated you have created a suitable cidata ISO and so the "alternatively" part is not relevant, read the paragraph preceeding that
[13:40] <minimal> the "ds=nocloud" part comes in if you do *NOT* want to provide a cidata filesystem
[13:45] <Guest48> 2022-03-10 13:41:17,708 - main.py[DEBUG]: No local datasource found
[13:47] <minimal> do you see an entry of the form: __init__.py[DEBUG]: Looking for data source in: ['NoCloud', 'None']
[13:47] <minimal> or similar?
[13:47] <Guest48> no
[13:48] <minimal> that's where it should log the values from datasource_list that it will try to use
[13:50] <minimal> this is Ubuntu Server - perhaps there's some other factor in play - like "subiquity". That's something the Canonical guys would be familiar with
[13:52] <minimal> have you tried using an Ubuntu Cloud Image rather than Ubuntu Server?
[14:56] <Guest48> it 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.
[15:22] <minimal> Guest48: 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:33] <Guest48> does ubiquity have it's dirty fingers in the installed system or did you assume I am at the install process?
[15:35] <minimal> No 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 answer