From 67eaa663682508107a3e7342b779b5c445b88e94 Mon Sep 17 00:00:00 2001 From: Hemanth Nakkina Date: Wed, 29 Apr 2026 12:12:11 +0530 Subject: [PATCH] fix: patch RPATH on staged libs to fix libvirt_iohelper missing libxml2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libvirt_iohelper is spawned by virFileWrapperFdNew() with a minimal environment containing only LIBVIRT_LOG_OUTPUTS=1:stderr. The parent libvirtd's LD_LIBRARY_PATH is never propagated to the child, so staged shared libraries (libxml2, libyajl, libicuuc, etc.) in usr/lib/x86_64-linux-gnu/ are not found, causing server suspend to fail: operation failed: .../libvirt_iohelper: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory Fix by adding build-attributes: [enable-patchelf] to the libvirt part. Snapcraft sets RPATH (old DT_RPATH tag, not RUNPATH) with $ORIGIN on libvirt-built ELF files, enabling the dynamic linker to locate staged libraries transitively — without requiring a build-time patchelf script. Fixes: https://bugs.launchpad.net/snap-openstack/+bug/2150555 Assisted-by: Claude:claude-4.6-sonnet Signed-off-by: Hemanth Nakkina --- snap/snapcraft.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index a234851..184afac 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -676,6 +676,15 @@ parts: rsync --remove-source-files -arhvP $CRAFT_PART_INSTALL/snap/$CRAFT_PROJECT_NAME/current/usr/* $CRAFT_PART_INSTALL/usr/ rm -rf $CRAFT_PART_INSTALL/snap/$CRAFT_PROJECT_NAME/current/usr + # enable-patchelf sets RPATH on libvirt-built ELF files so that shared + # libraries staged under usr/lib/ are found at runtime without + # LD_LIBRARY_PATH. This is required because libvirt_iohelper is spawned + # by virFileWrapperFdNew() with a minimal environment (no LD_LIBRARY_PATH), + # causing the resolution chain libvirt.so.0 -> libxml2.so.2 -> libicuuc.so.74 + # to fail with "cannot open shared object file" on server suspend/resume. + build-attributes: + - enable-patchelf + templates: source: templates/ plugin: dump