Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nocloud-net;s=<url>;h=<name> fails #4271

Closed
rustydb opened this issue Jul 21, 2023 · 3 comments
Closed

nocloud-net;s=<url>;h=<name> fails #4271

rustydb opened this issue Jul 21, 2023 · 3 comments
Assignees
Labels
bug Something isn't working correctly priority Fix soon

Comments

@rustydb
Copy link

rustydb commented Jul 21, 2023

Bug report

We leverage the nocloud-net datasource and are in the midst of upgrading from cloud-init 21.4 to 23.2.

We currently pass the nocloud-net value as such:

ds=nocloud-net;s=http://10.1.1.2:8888/;h=ncn-s001

Upon upgrading to cloud-init 23.2 we were encountering the following error when cloud-init started:

[   39.752699] cloud-init[3154]: Cloud-init v. 23.2.1-1 running 'init-local' at Fri, 21 Jul 2023 16:41:52 +0000. Up 39.66 seconds.
[   39.773874] cloud-init[3154]: 2023-07-21 16:41:52,598 - util.py[WARNING]: failed stage init-local
[   39.793869] cloud-init[3154]: failed run of stage init-local
[   39.809822] cloud-init[3154]: ------------------------------------------------------------
[FAILED] Failed to start Initial cloud-init job (pre-networking).
[   39.825817] cloud-init[3154]: Traceback (most recent call last):
[   39.861830] cloud-init[3154]:   File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 766, in status_wrapper
[   39.881829] cloud-init[3154]:     ret = functor(name, args)
[   39.901820] cloud-init[3154]:   File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 384, in main_init
[   39.921828] cloud-init[3154]:     init.fetch(existing=existing)
[   39.937825] cloud-init[3154]:   File "/usr/lib/python3.6/site-packages/cloudinit/stages.py", line 443, in fetch
[   39.957823] cloud-init[3154]:     return self._get_data_source(existing=existing)
[   39.977823] cloud-init[3154]:   File "/usr/lib/python3.6/site-packages/cloudinit/stages.py", line 341, in _get_data_source
[   39.997823] cloud-init[3154]:     self.reporter,
[   40.013821] cloud-init[3154]:   File "/usr/lib/python3.6/site-packages/cloudinit/sources/__init__.py", line 1005, in find_source
[   40.033840] cloud-init[3154]:     ds_list = list_sources(cfg_list, ds_deps, pkg_list)
[   40.049839] cloud-init[3154]:   File "/usr/lib/python3.6/site-packages/cloudinit/sources/__init__.py", line 1053, in list_sources
[   40.069834] cloud-init[3154]:     ds_name, pkg_list, ["get_datasource_list"]
[   40.085829] cloud-init[3154]:   File "/usr/lib/python3.6/site-packages/cloudinit/importer.py", line 70, in find_module
[   40.105831] cloud-init[3154]:     if not importlib.util.find_spec(full_path):
[   40.121839] cloud-init[3154]:   File "/usr/lib64/python3.6/importlib/util.py", line 88, in find_spec
[   40.141927] cloud-init[3154]:     parent = __import__(parent_name, fromlist=['__path__'])
[   40.157838] cloud-init[3154]: ModuleNotFoundError: No module named 'DataSourcenocloud-net;s=http://10'

The h= key is documented here, but there aren't any examples of using it with nocloud-net. It isn't clear if it's officially supported by nocloud-net and we have discovered a bug, or if we're using it where it isn't supported.

Removing ;h= from the command line bypassed the failure, and allowed cloud-init to run successfully.

Steps to reproduce the problem

Environment details

  • Cloud-init version: 23.2.1
  • Operating System Distribution: SLES 15 SP4
  • Cloud provider, platform or installer type: nocloud-net

Setup a nocloud-net DataSource and boot a node with the s and h parameters set:

ds=nocloud-net;s=http://<ip>/;h=hostname

cloud-init logs

cloud-init.tar.gz

@rustydb rustydb added bug Something isn't working correctly new An issue that still needs triage labels Jul 21, 2023
@holmanb holmanb added priority Fix soon and removed new An issue that still needs triage labels Jul 21, 2023
@dermotbradley
Copy link
Contributor

You /etc/cloud/cloud.cfg file contains:

datasource_list: [ nocloud-net;s=http://10.1.1.2:8888/, None ]

This is not a valid configuration. The datasource_list value can only contain a list of DataSources - you are using NoCloud and so it should instead be:

datasource_list: [ 'NoCloud', 'None' ]

(you actually do not need the , 'None' part.)

For nocloud-net that setting is provided in one of several ways:

(1) specify it on the cmdline passed by the bootloader

OR

(2) specify it in either /etc/cloud/cloud.cfg or in a file inside the /etc/cloud/cloud.cfg.d/ directory as:

datasource:
  NoCloud:
    seedfrom: http://10.1.1.2:8888/

@holmanb
Copy link
Member

holmanb commented Jul 21, 2023

You /etc/cloud/cloud.cfg file contains:

datasource_list: [ nocloud-net;s=http://10.1.1.2:8888/, None ]

@dermotbradley I think that's actually the /run/cloud-init/cloud.cfg file included, which is actually generated by ds-identify from the contents of the kernel commandline. I've reproduced and I think this is a real bug. I am working on a fix now.

@holmanb holmanb self-assigned this Jul 21, 2023
holmanb added a commit to holmanb/cloud-init that referenced this issue Jul 21, 2023
@holmanb
Copy link
Member

holmanb commented Jul 24, 2023

Thanks for reporting this bug @rustydb.

The fix for this regression landed in upstream cloud-init on Friday. Cloud-init team will be providing an upstream release with the fix for this regression followed by a release in Ubuntu.

In the meantime, users might have a workaround using cloud-config userdata in the kernel commandline.

aciba90 pushed a commit to aciba90/cloud-init that referenced this issue Jul 26, 2023
Currently >2 keys in NoCloud datasource are not
supported. Previously 250280 attempted to correct
no keys being supported, however that fix was only
partial since more than one key breaks datasource
detection.

Additionally add test coverage.

Fixes canonicalGH-4271
TheRealFalcon pushed a commit to TheRealFalcon/cloud-init that referenced this issue Jul 26, 2023
Currently >2 keys in NoCloud datasource are not
supported. Previously 250280 attempted to correct
no keys being supported, however that fix was only
partial since more than one key breaks datasource
detection.

Additionally add test coverage.

Fixes canonicalGH-4271
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly priority Fix soon
Projects
None yet
Development

No branches or pull requests

3 participants