Custom Search

Friday, April 18, 2014

SOLVED:nova.virt.driver ImportError: libvirt.so.0: cannot open shared object file: No such file or directory

Error
=====

2014-04-18 09:13:46.503 ERROR nova.virt.driver [-] Unable to load the virtualization driver
2014-04-18 09:13:46.503 TRACE nova.virt.driver Traceback (most recent call last):
2014-04-18 09:13:46.503 TRACE nova.virt.driver   File "/opt/stack/nova/nova/virt/driver.py", line 1115, in load_compute_driver
2014-04-18 09:13:46.503 TRACE nova.virt.driver     virtapi)
2014-04-18 09:13:46.503 TRACE nova.virt.driver   File "/opt/stack/nova/nova/openstack/common/importutils.py", line 54, in import_object_ns
2014-04-18 09:13:46.503 TRACE nova.virt.driver     return import_class(import_str)(*args, **kwargs)
2014-04-18 09:13:46.503 TRACE nova.virt.driver   File "/opt/stack/nova/nova/openstack/common/importutils.py", line 30, in import_class
2014-04-18 09:13:46.503 TRACE nova.virt.driver     __import__(mod_str)
2014-04-18 09:13:46.503 TRACE nova.virt.driver   File "/usr/lib/python2.7/dist-packages/libvirt.py", line 25, in
2014-04-18 09:13:46.503 TRACE nova.virt.driver     raise lib_e
2014-04-18 09:13:46.503 TRACE nova.virt.driver ImportError: libvirt.so.0: cannot open shared object file: No such file or directory
2014-04-18 09:13:46.503 TRACE nova.virt.driver
n-cpu failed to start

Fix
======

a)
I had libvirt0.9.8 by default on my ubuntu 12.04.  Later i installed libvirt1.2 from source. And later i removed that using the command#make uninstall. Then now, I am trying to install default libvirt 0.9 back using #sudo apt-get install libvirt-bin.  That got installed. But getting error when running my application which using libvir Error:nova.virt.driver ImportError: libvirt.so.0: cannot open shared object file: No such file or directory

b)

jitsusama> It's not loading up the dynamic library file.
jitsusama> curious. Try find / -name "*libvirt*" -print
jitsusama> Look for any .a or .so files.
jitsusama> I'm thinking you have conflicting library files installed. make uninstall might not have done its job.

stackuser@mypc:~$ sudo find / -name "*libvirt*" -print | grep .so
/usr/lib/python2.7/dist-packages/libvirtmod.so
/usr/lib/python2.7/dist-packages/libvirtmod_qemu.so
/usr/lib/libvirt.so.0.9.8
/usr/lib/libvirt-qemu.so.0.9.8
/usr/lib/pyshared/python2.7/libvirtmod.so
/usr/lib/pyshared/python2.7/libvirtmod_qemu.so
/home/stackuser/openstack/devstack/lib/nova_plugins/hypervisor-libvirt
/opt/libvirt/libvirt/src/qemu/.deps/libvirt_driver_qemu_impl_la-qemu_monitor_json.Plo
/opt/libvirt/libvirt/src/qemu/libvirt_driver_qemu_impl_la-qemu_monitor_json.lo
/opt/libvirt/libvirt/src/qemu/.libs/libvirt_driver_qemu_impl_la-qemu_monitor_json.o
/opt/libvirt/libvirt/src/rpc/libvirt_net_rpc_la-virnetsocket.lo
/opt/libvirt/libvirt/src/rpc/.deps/libvirt_net_rpc_la-virnetsocket.Plo
/opt/libvirt/libvirt/src/rpc/.deps/libvirt_setuid_rpc_client_la-virnetsocket.Plo
/opt/libvirt/libvirt/src/rpc/libvirt_setuid_rpc_client_la-virnetsocket.lo
/opt/libvirt/libvirt/src/rpc/.libs/libvirt_setuid_rpc_client_la-virnetsocket.o
/opt/libvirt/libvirt/src/rpc/.libs/libvirt_net_rpc_la-virnetsocket.o
/opt/libvirt/libvirt/src/util/libvirt_util_la-virjson.lo
/opt/libvirt/libvirt/src/util/.deps/libvirt_util_la-virjson.Plo
/opt/libvirt/libvirt/src/util/.deps/libvirt_setuid_rpc_client_la-virjson.Plo
/opt/libvirt/libvirt/src/util/.deps/libvirt_setuid_rpc_client_la-virsocketaddr.Plo
/opt/libvirt/libvirt/src/util/.deps/libvirt_util_la-virsocketaddr.Plo
/opt/libvirt/libvirt/src/util/libvirt_setuid_rpc_client_la-virsocketaddr.lo
/opt/libvirt/libvirt/src/util/libvirt_util_la-virsocketaddr.lo
/opt/libvirt/libvirt/src/util/libvirt_setuid_rpc_client_la-virjson.lo
/opt/libvirt/libvirt/src/util/.libs/libvirt_setuid_rpc_client_la-virsocketaddr.o
/opt/libvirt/libvirt/src/util/.libs/libvirt_util_la-virsocketaddr.o
/opt/libvirt/libvirt/src/util/.libs/libvirt_setuid_rpc_client_la-virjson.o
/opt/libvirt/libvirt/src/util/.libs/libvirt_util_la-virjson.o
/opt/libvirt/libvirt/src/xen/.deps/libvirt_driver_xen_impl_la-xen_hypervisor.Plo
/opt/libvirt/libvirt/src/.libs/libvirt.so.0.1002.3
/opt/libvirt/libvirt/src/.libs/libvirt_driver_network.so
/opt/libvirt/libvirt/src/.libs/libvirt-lxc.so.0
/opt/libvirt/libvirt/src/.libs/libvirt_driver_vbox.so
/opt/libvirt/libvirt/src/.libs/libvirt_driver_nwfilter.so
/opt/libvirt/libvirt/src/.libs/libvirt-lxc.so.0.1002.3
/opt/libvirt/libvirt/src/.libs/libvirt-lxc.so.0.1002.3T
/opt/libvirt/libvirt/src/.libs/libvirt-qemu.so.0
/opt/libvirt/libvirt/src/.libs/libvirt-lxc.so
/opt/libvirt/libvirt/src/.libs/libvirt_driver_qemu.so
/opt/libvirt/libvirt/src/.libs/libvirt_driver_nodedev.so
/opt/libvirt/libvirt/src/.libs/libvirt-qemu.so.0.1002.3T
/opt/libvirt/libvirt/src/.libs/libvirt_driver_secret.so
/opt/libvirt/libvirt/src/.libs/libvirt-qemu.so.0.1002.3
/opt/libvirt/libvirt/src/.libs/libvirt-qemu.so
/opt/libvirt/libvirt/src/.libs/libvirt.so.0
/opt/libvirt/libvirt/src/.libs/libvirt_driver_interface.so
/opt/libvirt/libvirt/src/.libs/libvirt_driver_lxc.so
/opt/libvirt/libvirt/src/.libs/libvirt.so
/opt/libvirt/libvirt/src/.libs/libvirt_driver_uml.so
/opt/libvirt/libvirt/src/.libs/libvirt_driver_storage.so

c)
saju_m: sudo ldconfig -v | grep libvirt

stackuser@mypc:~$ sudo ldconfig -v | grep libvirt
/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
    libvirt-qemu.so.0 -> libvirt-qemu.so.0.9.8 (changed)
    libvirt.so.0 -> libvirt.so.0.9.8 (changed)
stackuser@mypc:~$

jitsusama> Ah ha, changed.
jitsusama> That might've fixed ya.
jitsusama> Try loading it again.
jitsusama> Do you still have libvirt-bin installed btw?
jitsusama> If not, you might want to load that first.
jitsusama> Try the command sysinfo and see if you get a response.
jitsusama> saju_m: You'd want to run that command from virsh.

d)
stackuser@mypc:~$ sudo service libvirt-bin restart
libvirt-bin stop/waiting
libvirt-bin start/running, process 54833
stackuser@mypc:~$
stackuser@mypc:~$
stackuser@mypc:~$
stackuser@mypc:~$ sudo ldconfig -v | grep libvirt
/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
    libvirt.so.0 -> libvirt.so.0.9.8
    libvirt-qemu.so.0 -> libvirt-qemu.so.0.9.8
stackuser@mypc:~$
stackuser@mypc:~$
stackuser@mypc:~$
stackuser@mypc:~$ sudo virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh #
virsh # sysinfo
virsh #

e)
saju_m> jitsusama: which command got fixed this issue ?

jitsusama> You compiled and installed from source.
jitsusama> At some time your library file cache was rebuilt.
jitsusama> You did a make uninstall, then installed the binary.

jitsusama> Your library file cache didn't get rebuilt.
jitsusama> So, when the libvirt daemon tried to load, Linux didn't have a cache of the proper library file loaded.

jitsusama> So, it couldn't dynamically link it with the binary.
jitsusama> This caused the failure.
jitsusama> Running ldconfig recreated the library file cache.

jitsusama> Whenever you muck around with .so files, you want to run ldconfig to "refresh" your library file cache.
jitsusama> Otherwise, binaries won't know where to find their library files.

jitsusama:thanks, Let me try to create a VM

No comments:

Post a Comment