On a stock Rocky-8-GenericCloud-8.6-20220515.x86_64.qcow2 image, imported into Openstack and booted, cloud-init fails due to missing hostname and service commands. Here the relevant log snippets:
2022-05-30 16:21:31,521 - util.py[DEBUG]: Failed to update the hostname to testinstance.novalocal (testinstance)
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/cloudinit/subp.py", line 259, in subp
env=env, shell=shell, cwd=cwd)
File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: b'hostname': b'hostname'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/cloudinit/config/cc_update_hostname.py", line 52, in handle
cloud.distro.update_hostname(hostname, fqdn, prev_fn)
File "/usr/lib/python3.6/site-packages/cloudinit/distros/__init__.py", line 292, in update_hostname
(sys_fn, sys_hostname) = self._read_system_hostname()
File "/usr/lib/python3.6/site-packages/cloudinit/distros/rhel.py", line 106, in _read_system_hostname
return (host_fn, self._read_hostname(host_fn))
File "/usr/lib/python3.6/site-packages/cloudinit/distros/rhel.py", line 112, in _read_hostname
(out, _err) = subp.subp(['hostname'])
File "/usr/lib/python3.6/site-packages/cloudinit/subp.py", line 268, in subp
) from e
cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
Command: ['hostname']
Exit code: -
Reason: [Errno 2] No such file or directory: b'hostname': b'hostname'
Stdout: -
Stderr: -
2022-05-30 16:21:31,524 - handlers.py[DEBUG]: finish: init-network/config-update_hostname: FAIL: running config-update_hostname with frequency always
...
2022-05-30 16:21:33,016 - util.py[DEBUG]: Running module set-passwords (<module 'cloudinit.config.cc_set_passwords' from '/usr/lib/python3.6/site-packages/cloudinit/config/cc_set_passwords.py'>) failed
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/cloudinit/subp.py", line 259, in subp
env=env, shell=shell, cwd=cwd)
File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: b'service': b'service'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/cloudinit/stages.py", line 876, in _run_modules
freq=freq)
File "/usr/lib/python3.6/site-packages/cloudinit/cloud.py", line 54, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
File "/usr/lib/python3.6/site-packages/cloudinit/helpers.py", line 185, in run
results = functor(*args)
File "/usr/lib/python3.6/site-packages/cloudinit/config/cc_set_passwords.py", line 234, in handle
service_name=cloud.distro.get_option('ssh_svcname', 'ssh'))
File "/usr/lib/python3.6/site-packages/cloudinit/config/cc_set_passwords.py", line 131, in handle_ssh_pwauth
subp.subp(cmd)
File "/usr/lib/python3.6/site-packages/cloudinit/subp.py", line 268, in subp
) from e
cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
Command: ['service', 'sshd', 'restart']
Exit code: -
Reason: [Errno 2] No such file or directory: b'service': b'service'
Stdout: -
Stderr: -
2022-05-30 16:21:33,027 - stages.py[DEBUG]: Running module rh_subscription (<module 'cloudinit.config.cc_rh_subscription' from '/usr/lib/python3.6/site-packages/cloudinit/config/cc_rh_subscription.py'>) with frequency once-per-instance
...
On a stock Rocky-8-GenericCloud-8.6-20220515.x86_64.qcow2 image, imported into Openstack and booted, cloud-init fails due to missing
hostname
andservice
commands. Here the relevant log snippets:So the result is: