FS#72918 - [cloud-init] should depend on inetutils because of DataSourceAzure
Attached to Project:
Community Packages
Opened by Alexander E. Patrakov (patrakov) - Sunday, 05 December 2021, 01:13 GMT
Last edited by David Runge (dvzrv) - Tuesday, 22 February 2022, 08:03 GMT
Opened by Alexander E. Patrakov (patrakov) - Sunday, 05 December 2021, 01:13 GMT
Last edited by David Runge (dvzrv) - Tuesday, 22 February 2022, 08:03 GMT
|
Details
Description:
I have tried to import the official Arch Linux cloud image from https://mirror.pkgbuild.com/images/v20211201.40458/Arch-Linux-x86_64-cloudimg-20211201.40458.qcow2 into Microsoft Azure. The steps taken (based on https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-generic) were: * Convert the image to fixed-vhd format * Create a storage account * Upload the image * Create a disk from it * Create a VM from this disk * Provide the following cloud-config: ``` #cloud-config fqdn: archlinux-on-azure users: - name: user sudo: "ALL=(ALL) NOPASSWD: ALL" ssh_authorized_keys: - "ssh-ed25519 AAAA... my-ssh-key" shell: "/bin/bash" ``` Result: cloud-init failed to run in the resulting Azure VM, because it could not execute the "hostname" command to set the host name. The log (extracted by attaching the disk to a different instance) is attached. Fixing up the image by installing inetutils was sufficient for cloud-init to run successfully. Conclusion: cloud-init must have a dependency on inetutils, because this is the package that provides the "hostname" program, without which cloud-init does not run at all on Azure and does not continue e.g. provisioning user accounts. I have tried to reproduce this locally without Azure, using the "nocloud" data source, but it appears that cloud-init can set the hostname without calling "hostanme" in this case. So the bug is Azure-specific, and you can find explicit references to the "hostname" command if you look into /usr/lib/python3.9/site-packages/cloudinit/sources/DataSourceAzure.py . |
This task depends upon
Closed by David Runge (dvzrv)
Tuesday, 22 February 2022, 08:03 GMT
Reason for closing: Upstream
Additional comments about closing: Fixed with the release of cloud-init 22.1
Tuesday, 22 February 2022, 08:03 GMT
Reason for closing: Upstream
Additional comments about closing: Fixed with the release of cloud-init 22.1
cloud-init 21.4-1
Hm, I was under the impression that this has been finally fixed upstream (by wCPO) and relies on systemd's hostnamectl if hostname is not available.
```
------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/cloudinit/subp.py", line 257, in subp
sp = subprocess.Popen(bytes_args, stdout=stdout,
File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: b'hostname'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/cloudinit/cmd/main.py", line 689, in status_wrapper
ret = functor(name, args)
File "/usr/lib/python3.9/site-packages/cloudinit/cmd/main.py", line 411, in main_init
init.setup_datasource()
File "/usr/lib/python3.9/site-packages/cloudinit/stages.py", line 443, in setup_datasource
self.datasource.setup(is_new_instance=self.is_new_instance())
File "/usr/lib/python3.9/site-packages/cloudinit/sources/helpers/azure.py", line 66, in impl
return func(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/cloudinit/sources/DataSourceAzure.py", line 854, in setup
fabric_data = self._negotiate()
File "/usr/lib/python3.9/site-packages/cloudinit/sources/helpers/azure.py", line 66, in impl
return func(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/cloudinit/sources/DataSourceAzure.py", line 1509, in _negotiate
self.bounce_network_with_azure_hostname()
File "/usr/lib/python3.9/site-packages/cloudinit/sources/helpers/azure.py", line 66, in impl
return func(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/cloudinit/sources/DataSourceAzure.py", line 384, in bounce_network_with_azure_hostname
with temporary_hostname(azure_hostname, self.ds_cfg,
File "/usr/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/usr/lib/python3.9/site-packages/cloudinit/sources/DataSourceAzure.py", line 319, in temporary_hostname
previous_hostname = get_hostname(hostname_command)
File "/usr/lib/python3.9/site-packages/cloudinit/sources/DataSourceAzure.py", line 302, in get_hostname
return subp.subp(hostname_command, capture=True)[0].strip()
File "/usr/lib/python3.9/site-packages/cloudinit/subp.py", line 264, in subp
raise ProcessExecutionError(
cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
Command: ('hostname',)
Exit code: -
Reason: [Errno 2] No such file or directory: b'hostname'
Stdout: -
Stderr: -
------------------------------------------------------------
```
https://gitlab.archlinux.org/archlinux/arch-boxes/-/jobs/48463/artifacts/file/output/Arch-Linux-x86_64-cloudimg-20220220.48463.qcow2
I confirm that it works on Azure unmodified (other than format-conversion via qemu-img).