'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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content