The lxd ci[1] noticed an issue in ALT linux's cloud-init package. The issue is caused by code that does not exist in upstream cloud-init: ``` Traceback (most recent call last): File "/usr/lib/python3/site-packages/cloudinit/config/modules.py", line 286, in _run_modules ran, _r = cc.run( ^^^^^^^ File "/usr/lib/python3/site-packages/cloudinit/cloud.py", line 71, in run return self._runners.run(name, functor, args, freq, clear_on_fail) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/site-packages/cloudinit/helpers.py", line 156, in run results = functor(**args) ^^^^^^^^^^^^^^^ File "/usr/lib/python3/site-packages/cloudinit/config/cc_update_hostname.py", line 62, in handle cloud.distro.update_hostname(hostname, fqdn, prev_fn) File "/usr/lib/python3/site-packages/cloudinit/distros/__init__.py", line 546, in update_hostname prev_hostname = self._read_hostname(prev_hostname_fn) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/site-packages/cloudinit/distros/altlinux.py", line 154, in _read_hostname return util.load_file(filename).strip() ^^^^^^^^^^^^^^ AttributeError: module 'cloudinit.util' has no attribute 'load_file' ``` It looks like ALT's distro never made it into upstream, so a recent change in upstream util.py broke ALT's distro definition. It should be easy to update to use the new function name. If you're interested in getting the distro defintion into upstream, that would help prevent future breakage like this. [1] https://github.com/canonical/lxd-ci/pull/344
I was able to reproduce the issue by undoing the change in the PR linked below. To reproduce, basically just undo the effects of the PR in a container, then `cloud-init reboot -h now` to simulate first boot, then reboot the container and see the error. Something like this: ``` $ lxc launch images:alt/p11/cloud alt-p11 [root@alt-p11 ~]# # re-introduce update_hostname to /etc/cloud/cloud.cfg [root@alt-p11 ~]# # ... [root@alt-p11 ~]# cloud-init clean --logs --reboot $ lxc shell alt-p11 [root@alt-p11 ~]# reboot -h now [root@alt-p11 ~]# # now view the errors [root@alt-p11 ~]# cloud-init status --long [root@alt-p11 ~]# # and for more detail: [root@alt-p11 ~]# vi /var/log/cloud-init.log ```
cloud-init-24.2-alt2 -> p11 * Fri Nov 22 2024 Alexander Stepchenko <geochip@altlinux.org> 24.2-alt2 - NMU: Fix update_hostname module (Closes: 52029)
Fix confirmed. The workaround was removed from upstream lxd[1]. [1] https://github.com/canonical/lxd-ci/pull/369