Open derSchweiger opened 3 weeks ago
Hello @derSchweiger,
I see in the logs a NoCloudConfigDriveXService
, which is not present in the upstream cloudbase-init code. If you use a fork with another metadata service, you might want to check https://github.com/cloudbase/cloudbase-init/commit/f0fe66b30bf95d05ebecb74d8059ea2cdda37d0f, as there might be some code you need to change to make it work again?
Thanks and please let me know how I can reproduce the issue if you use a custom metadata service.
Hi @ader1990,
thank you! You are right, we had to implement a minor change because the configuration of the Administrator password didn't work properly:
from .nocloudservice import NoCloudConfigDriveService
class NoCloudConfigDriveXService(NoCloudConfigDriveService):
def get_admin_password(self):
meta_data = self._get_meta_data()
meta = meta_data.get('meta')
if meta and 'admin_pass' in meta:
password = meta['admin_pass']
elif 'admin_pass' in meta_data:
password = meta_data['admin_pass']
else:
password = None
return password
To load our modified NoCloudConfigDriveService service instead of the default one, we have slightly adapted the cloudbase-init[-unattend].conf:
metadata_services=cloudbaseinit.metadata.services.nocloudservicex.NoCloudConfigDriveXService
The rest (including the network configuration) stays the same. In my opinion, this should not be the cause of the problem mentioned?
Appreciate your help!
I think this commit needs to be investigated: https://github.com/cloudbase/cloudbase-init/commit/f0fe66b30bf95d05ebecb74d8059ea2cdda37d0f
Can you please provide the full meta_data file from your config drive, so that I can try to reproduce the issue?
Yes, it also fits in terms of time. Cloudbase-Init v1.1.5dev11 (in which the network config works) has been released before this commit.
Metadata as requested (needed to remove some unreadable chars):
{"admin_pass":"CENSORED","local-hostname":"ks-testvm0402","instance-id":"989cb4fa-3a69-4eb9-b420-0db4d31e0940"}
From nobody Fri Jun 09:19:04 2024
Content-Type: multipart/mixed; boundary="===============171895434496808=="
MIME-Version: 1.0
--===============171895434496808==
MIME-Version: 1.0
Content-Type: text/cloud-config; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.yaml"
#cloud-config
{ }
--===============171895434496808==--
config:
- mac_address: 6a:bb:c3:2f:d3:22
name: eth0
subnets:
- address: 10.196.59.9/24
dns_nameservers:
- 94.16.16.94
- 94.16.16.16
gateway: 10.196.59.254
type: static
type: physical
version: 1
Please let me know if you need any additional information.
Hello, I have created a patch here with a possible fix: https://review.opendev.org/c/x/cloudbase-init/+/922464 Let me know if you need an MSI installer, as I can create one if needed for you to download to test.
If you could compile a MSI file for me that would be great!
If you could compile a MSI file for me that would be great!
This Github Action should create a test installer using the branch https://github.com/ader1990/cloudbase-init-1/tree/add_nocloud_network_tests https://github.com/ader1990/cloudbase-init-installer-1/actions/runs/9613069308/job/26515021223
The installer can be found in the Artifacts tab as a zipped artifact.
Cool, appreciated! Our automation is already creating a new build with this version of cloudbase-init. I'll let you know as soon as my tests are completed.
@ader1990 while loading and configuring the unattend phase I receive the following error:
2024-06-21 17:27:31.793 3404 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.osutils.windows.WindowsUtils' load_class C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\utils\classloader.py:35
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell [-] No module named 'pywintypes': ModuleNotFoundError: No module named 'pywintypes'
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell Traceback (most recent call last):
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\shell.py", line 33, in main
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell init.InitManager().configure_host()
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\init.py", line 169, in configure_host
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell osutils = osutils_factory.get_os_utils()
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\osutils\factory.py", line 27, in get_os_utils
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell return cl.load_class(osutils_class_paths[os.name])()
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\utils\classloader.py", line 37, in load_class
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell module = __import__(parts[0], fromlist=parts[1])
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\osutils\windows.py", line 27, in <module>
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell import pywintypes
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell ModuleNotFoundError: No module named 'pywintypes'
2024-06-21 17:27:31.855 3404 ERROR cloudbaseinit.shell
Therefore, the machine is hanging in a sysprep loop and cannot be started normally.
Shouldn't this module be included in the MSI package or do I've to prep it manually?
Hello, this might be an issue with how the Github Actions created the installer - as it used a Python embedded version. The Github actions are usually more flaky as well. I started a new build here with the official Python installer contents version: https://github.com/ader1990/cloudbase-init-installer-1/actions/runs/9617044573.
The fastest way to test this would be to just drop in replace the nocloud service python file using the change from https://review.opendev.org/c/x/cloudbase-init/+/922464 or https://github.com/ader1990/cloudbase-init-1/commit/90c0546b005ab9b2676bd5459f8fdcf4b50250e9, delete the registry folder HKLM:\SOFTWARE\Cloudbase Solutions\Cloudbase-Init and rerun cloudbase-init on the initial env.
Option #2 didn't do the trick for me. VM started but I received the same error message in the cloudbase-init.log file and the service didn't run successfully. But no problem, I started another build with the new version and will test it.
The patch https://review.opendev.org/c/x/cloudbase-init/+/922464 was tested with https://github.com/cloudbase/cloudbase-init-test-resources/pull/14/files#diff-4708310a57ee945744728723c092dd3aeca2354e84070b51e7d6254c389309f0 network-config and it worked correctly when using the Github Runners too.
Yeah, error might be on my side, but nevermind, your new build works just fine! Network config gets set properly and the other stuff works too. Just a quick log output:
2024-06-21 20:10:43.180 5104 INFO cloudbaseinit.init [-] Respawning current process with updated credentials.
2024-06-21 20:10:43.805 3692 INFO cloudbaseinit.init [-] Cloudbase-Init version: 1.1.6.dev692
2024-06-21 20:10:44.571 3692 INFO cloudbaseinit.init [-] Executing plugins for stage 'PRE_NETWORKING':
2024-06-21 20:10:44.571 3692 INFO cloudbaseinit.init [-] Executing plugins for stage 'PRE_METADATA_DISCOVERY':
2024-06-21 20:10:44.571 3692 INFO cloudbaseinit.init [-] Executing plugin 'MTUPlugin'
2024-06-21 20:10:44.680 3692 WARNING oslo_config.cfg [-] Deprecated: Option "config_drive_raw_hhd" from group "DEFAULT" is deprecated. Use option "raw_hdd" from group "config_drive".
2024-06-21 20:10:44.680 3692 WARNING oslo_config.cfg [-] Deprecated: Option "raw_hdd" from group "config_drive" is deprecated for removal. Its value may be silently ignored in the future.
2024-06-21 20:10:44.680 3692 WARNING oslo_config.cfg [-] Deprecated: Option "config_drive_cdrom" from group "DEFAULT" is deprecated. Use option "cdrom" from group "config_drive".
2024-06-21 20:10:44.680 3692 WARNING oslo_config.cfg [-] Deprecated: Option "cdrom" from group "config_drive" is deprecated for removal. Its value may be silently ignored in the future.
2024-06-21 20:10:44.680 3692 WARNING oslo_config.cfg [-] Deprecated: Option "config_drive_vfat" from group "DEFAULT" is deprecated. Use option "vfat" from group "config_drive".
2024-06-21 20:10:44.680 3692 WARNING oslo_config.cfg [-] Deprecated: Option "vfat" from group "config_drive" is deprecated for removal. Its value may be silently ignored in the future.
2024-06-21 20:10:44.711 3692 WARNING cloudbaseinit.metadata.services.osconfigdrive.windows [-] ISO extraction failed on <Partition: \\?\GLOBALROOT\Device\Harddisk1\Partition2> with WindowsCloudbaseInitException("Cannot open file: 'The process cannot access the file because it is being used by another process.'"): cloudbaseinit.exception.WindowsCloudbaseInitException: Cannot open file: 'The process cannot access the file because it is being used by another process.'
2024-06-21 20:10:45.149 3692 WARNING cloudbaseinit.metadata.services.osconfigdrive.windows [-] ISO extraction failed on <Partition: \\?\GLOBALROOT\Device\Harddisk1\Partition4> with WindowsCloudbaseInitException("Cannot open file: 'The process cannot access the file because it is being used by another process.'"): cloudbaseinit.exception.WindowsCloudbaseInitException: Cannot open file: 'The process cannot access the file because it is being used by another process.'
2024-06-21 20:10:45.243 3692 INFO cloudbaseinit.metadata.services.osconfigdrive.windows [-] Config Drive found on disk '\\\\.\\PHYSICALDRIVE0'
2024-06-21 20:10:45.305 3692 INFO cloudbaseinit.init [-] Metadata service loaded: 'NoCloudConfigDriveXService'
2024-06-21 20:10:45.305 3692 INFO cloudbaseinit.init [-] Executing plugins for stage 'MAIN':
2024-06-21 20:10:45.305 3692 INFO cloudbaseinit.init [-] Executing plugin 'ExtendVolumesPlugin'
2024-06-21 20:10:45.883 3692 INFO comtypes.client._code_cache [-] Could not import comtypes.gen, trying to create it.
2024-06-21 20:10:45.883 3692 INFO comtypes.client._code_cache [-] Created comtypes.gen directory: 'C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\comtypes\gen'
2024-06-21 20:10:45.883 3692 INFO comtypes.client._code_cache [-] Writing __init__.py file: 'C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\comtypes\gen\__init__.py'
2024-06-21 20:10:45.899 3692 INFO comtypes.client._code_cache [-] Using writeable comtypes cache directory: 'C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\comtypes\gen'
2024-06-21 20:10:47.227 3692 INFO cloudbaseinit.utils.windows.storage.vds_storage_manager [-] Extending volume "\\?\GLOBALROOT\Device\HarddiskVolume4" with 19328384512 bytes
2024-06-21 20:10:47.274 3692 INFO cloudbaseinit.init [-] Executing plugin 'CreateUserPlugin'
2024-06-21 20:10:47.274 3692 INFO cloudbaseinit.plugins.common.createuser [-] Setting password for existing user "Administrator"
2024-06-21 20:10:51.812 3692 INFO cloudbaseinit.init [-] Executing plugin 'SetUserPasswordPlugin'
2024-06-21 20:10:51.812 3692 WARNING cloudbaseinit.plugins.common.setuserpassword [-] Using admin_pass metadata user password. Consider changing it as soon as possible
2024-06-21 20:10:51.843 3692 INFO cloudbaseinit.plugins.common.setuserpassword [-] Password succesfully updated for user Administrator
2024-06-21 20:10:51.843 3692 INFO cloudbaseinit.plugins.common.setuserpassword [-] Cannot set the password in the metadata as it is not supported by this service
2024-06-21 20:10:51.843 3692 INFO cloudbaseinit.init [-] Executing plugin 'LocalScriptsPlugin'
2024-06-21 20:11:06.851 3692 INFO cloudbaseinit.plugins.common.fileexecutils [-] Script "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\CleanupWinRMSettings.ps1" ended with exit code: 0
2024-06-21 20:11:06.851 3692 INFO cloudbaseinit.init [-] Executing plugin 'NetworkConfigPlugin'
2024-06-21 20:11:06.851 3692 INFO cloudbaseinit.plugins.common.networkconfig [-] Renaming network adapter "Ethernet Instance 0" to "eth0"
2024-06-21 20:11:07.196 3692 INFO cloudbaseinit.plugins.common.networkconfig [-] Setting static IP configuration on network adapter "eth0". IP: 10.196.59.7, prefix length: 24, gateway: 10.196.59.254, dns: ['94.16.16.94', '94.16.16.16']
2024-06-21 20:11:07.463 3692 INFO cloudbaseinit.init [-] Executing plugin 'WindowsAutoUpdatesPlugin'
2024-06-21 20:11:07.463 3692 INFO cloudbaseinit.init [-] Executing plugin 'UserDataPlugin'
2024-06-21 20:11:07.588 3692 ERROR cloudbaseinit.plugins.common.userdataplugins.cloudconfig [-] Could not process part type <class 'bytes'>: 'Empty yaml stream provided.': cloudbaseinit.plugins.common.userdataplugins.cloudconfig.CloudConfigError: Empty yaml stream provided.
2024-06-21 20:11:07.588 3692 INFO cloudbaseinit.init [-] Plugins execution done
2024-06-21 20:11:07.588 3692 INFO cloudbaseinit.init [-] Stopping Cloudbase-Init service
I haven't tested the userdata plugin (to inject a PowerShell script) yet but afaik there was no change so it should work. Thank you very much for your work and I'm looking forward to test the stable build in some time :)
Just another quick question: do you summarise all the changes between the different versions in a changelog or something like that? Haven't found anything.
Hello, we are planning to move to GitHub shortly and we will also have a good changelog history in the release. Also, we are adding Github Actions functional testing to properly cover the network static configuration https://github.com/cloudbase/cloudbase-init-test-resources/pull/14/files.
I will keep you posted once the new beta MSI gets built and also when a new release is made.
Thanks alot, Adrian.
Hello @derSchweiger, the fix has been merged and you can check the beta build installer: https://www.cloudbase.it/downloads/CloudbaseInitSetup_x64.msi. We are planning a new stable release soon, after more functional tests are added to the github actions. Please let me know if you can test it and if it works as expected.
@laozc -> this commit https://github.com/cloudbase/cloudbase-init/commit/f0fe66b30bf95d05ebecb74d8059ea2cdda37d0f added a regression in the NoCloud metadata service and has been fixed already. Can you please check if the fixed MSI (latest beta build https://www.cloudbase.it/downloads/CloudbaseInitSetup_x64.msi) still works as expected with the VmwareGuest metadata service?
Thank you all.
Have tested the new beta version (1.1.6dev20) and it works as expected. Network configuration was successfully read and set. Great work, thank you!
Sure. Let me verify the change with VMware Guest metadata service.
@ader1990 The beta version (1.1.6dev20) works with both V1 and V2 network config format with VMware DataSource.
Thanks @laozc!
Hi,
it seems that since the release of stable Cloudbase-Init v1.1.5, the network configuration can no longer be set properly. There is no error message, instead cloudbase-init assumes that we are not injecting a network configuration: cloudbaseinit.metadata.services.nocloudservice [-] Network configuration is empty
Injected network config:
cloudbase-init logs:
Same issue on the newest unstable build v.1.1.6dev13. The last build I'm aware of where the injection of the network configuration works is 1.1.5dev11. Something has changed since then.
If you need any further information, please let me know.