The FHS says that binaries under /usr/libexec are not intended to run directly on the host, and not, as I incorrectly assumed (probably from some outdated distribution guidelines), on other hosts only: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html If we move them to /usr/bin in the guest image, the helpers or programs that are supposed to run those binaries might not find them. We have, however, cases like /usr/libexec/qemu-kvm on some distributions where we might have programs, on the host, which are meant to run them, but we don't want to copy those to the guest image, and we want to run the binary we copied from /usr/libexec directly. This was the reason why I initially added this special handling. Instead of doing that, simply add /usr/libexec to the guest's $PATH, from the $FIXUP script. Suggested-by: David Gibson <david(a)gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com> --- mbuto | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/mbuto b/mbuto index a2a8147..c2fffa0 100755 --- a/mbuto +++ b/mbuto @@ -48,10 +48,13 @@ COPIES="${COPIES:-}" # Workers for time-consuming tasks such as stripping modules, see workers() THREADS="$(nproc)" -# Fix-up script to run before /init, can be omitted +# Fix-up script to run before /init, can be omitted. Note that we're adding +# /usr/libexec to PATH because, while a given program might not be intended to +# directly run on the host (that's what /usr/libexec is for), we might need to +# run it directly on the guest instead. [ -z "${FIXUP}" ] && FIXUP='#!/bin/sh -export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sbin: +export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sbin:/usr/libexec: mount -t proc proc /proc mount -t sysfs sys /sys @@ -752,14 +755,7 @@ prog_add() { unset IFS [ -z "${__bin}" ] && err "Can't source ${1}" - # Binaries in /usr/libexec are meant to run on other hosts only, so they - # can't reside in /usr/libexec on the target image. Move to /usr/bin. - if [ "$("${DIRNAME}" "${__bin}")" = "/usr/libexec" ]; then - __bindir="${wd}/usr/bin" - else - __bindir="${wd}$("${DIRNAME}" "${__bin}")" - fi - + __bindir="${wd}$("${DIRNAME}" "${__bin}")" "${MKDIR}" -p "${__bindir}" "${CP}" --preserve=all "${__bin}" "${__bindir}" -- 2.43.0