canonical / canonical/cloud-init
Meson and code disconnect regarding libexec directory location
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 22
Description
# 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
Contributor guide
Research direction
Start by comparing meson.build with cloudinit/config/cc_keys_to_console.py, cloudinit/config_cc_install_hotplug.py, distros/_init_.py, and the distro overrides. Then inspect tests/unittests/config/test_cc_install_hotplug.py, systemd/cloud-init-generator.tmpl, the sysvinit scripts, and the listed packaging files. Done means runtime lookups and installed paths consistently use the Meson libexec location, with tests covering the supported locations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, build-system, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100