'virsh define' command in %post section with --nochroot of kickstart outputs error "virsh:error while loading shared libraries: libvirt.so.0: cannot open shared object file: No such file or directory"

Solution Unverified - Updated -

Issue

  • 'virsh define' command in %post section with --nochroot of kickstart outputs error "virsh:error while loading shared libraries: libvirt.so.0: cannot open shared object file: No such file or directory":
%post  --nochroot
exec 1>/mnt/sysimage/root/kickstart-log 2>&1

cp /mnt/install/source/isolinux/post/test.xml /mnt/sysimage/etc/libvirt/qemu/test.xml
cp /mnt/install/source/isolinux/post/test.img /mnt/sysimage/var/lib/libvirt/images/test.img

virsh define /mnt/sysimage/etc/libvirt/qemu/test.xml

%end
  • The error is:
virsh:error while loading shared libraries: libvirt.so.0: cannot open shared object file: No such file or directory

Environment

  • Red Hat Enterprise Linux 7
  • kickstart installation

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.