cloud-init icon indicating copy to clipboard operation
cloud-init copied to clipboard

Meson and code disconnect regarding libexec directory location

Open dermotbradley opened this issue 1 month ago • 0 comments

Bug report

meson.build defines:

lib_exec_dir = get_option('prefix') / get_option('libexecdir') / 'cloud-init'

and then uses lib_exec_dir as the location to install these scripts/programs:

tools/cloud-init-hotplugd tools/ds-identify tools/hook-hotplug tools/uncloud-init tools/write-ssh-key-fingerprints

Some distro files (azurelinux.py, freebsd.py, and rhel.py) define usr_lib_exec explicitly and distros/init.py provides a fallback definition of "/usr/lib". cloudinit/config/cc_keys_to_console.py uses the value of distro.usr_lib_exec to find a helper program write-ssh-key-fingerprints, with a hardcoded fallback location of "/usr/lib".

cloudinit/config_cc_install_hotplug.py is hardcoded to check both /usr/libexec/cloud-init and /usr/lib/cloud-init to determine where to find hook-hotplug (and likewise tests/unittests/config/test_cc_install_hotplug.py uses both).

The value used by Meson should also be the same value used at runtime to access these programs/scripts.

packages/suse/cloud-init.spec.in, packages/debian/rules, and packages/redhat/cloud-init.spec have references to libexecdir.

Finally systemd/cloud-init-generator.tmpl, sysvinit/openrc/cloud-init-hotplug and sysvinit/openrc/cloud-init-ds-identify all have hardcoded paths for /usr/libexec/cloud-init

Steps to reproduce the problem

Boot an Alpine cloud image (e.g. using NoCloud DataSource). During boot the cloud-init-final service outputs an error to the console:

2025-11-06 01:20:55,029 - cc_keys_to_console.py[WARNING]: Unable to activate module keys_to_console, helper tool not found at /usr/lib/cloud-init/write-ssh-key-fingerprints

Environment details

  • Cloud-init version: Main
  • Operating System Distribution: Alpine
  • Cloud provider, platform or installer type: any/all

cloud-init logs

dermotbradley avatar Nov 27 '25 19:11 dermotbradley