Monday, July 7, 2014

Running virt-manager from its master branch (1.0.1) on Ubuntu 14.04

Hey all,

After upgrading my system from Ubuntu 12.04 to Ubuntu 14.04 I decided to check whether the latest package of virt-manager ( http://virt-manager.org/ ) comes with the feature that I needed the most - snapshots.

Unfortunately, The current Ubuntu 14.04's version of virt-manager is still based on the 0.9 branch,
So I decided to clone the latest version from the project's git repository ( https://git.fedorahosted.org/git/virt-manager.git ) and try it out.

While doing so, I had several issues which I will list here so you won't have to waste your time doing the same research.

Summary for busy people
There are several packages that you will need to install:
$ sudo apt-get install gir1.2-libvirt-glib-1.0 python-ipaddr libosinfo-bin libosinfo-1.0-dev libgtk-3-dev gir1.2-gtk-vnc-2.0 python-spice-client-gtk gir1.2-spice-client-gtk-3.0
This should fix all the following issues.

End of summary for busy people


After the git-clone's process was over, I read the README and INSTALL files, which told me that I should just run the virt-manager script ./virt-manager from the root directory. This was the result:

$:~/work/virt-manager$ ./virt-manager
ERROR:root:Could not find any typelib for LibvirtGLib
Traceback (most recent call last):
  File "./virt-manager", line 30, in <module>
    from gi.repository import LibvirtGLib
ImportError: cannot import name LibvirtGLib


According to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=736547 you should install gir1.2-libvirt-glib-1.0:

sudo apt-get install gir1.2-libvirt-glib-1.0

Running the virt-manager again will produce:

Traceback (most recent call last):
  File "./virt-manager", line 32, in <module>
    from virtinst import util as util
  File "/home/tal/work/virt-manager/virtinst/__init__.py", line 40, in <module>
    from virtinst.interface import Interface, InterfaceProtocol
  File "/home/tal/work/virt-manager/virtinst/interface.py", line 26, in <module>
    import ipaddr
ImportError: No module named ipaddr

Searching for the python package using apt-cache:
apt-cache search ipaddr

Revealed the python-ipaddr package:
sudo apt-get install python-ipaddr


Moving forward and running again:
ERROR:root:Could not find any typelib for Libosinfo
Traceback (most recent call last):
  File "./virt-manager", line 32, in <module>
    from virtinst import util as util
  File "/home/tal/work/virt-manager/virtinst/__init__.py", line 70, in <module>
    from virtinst.distroinstaller import DistroInstaller
  File "/home/tal/work/virt-manager/virtinst/distroinstaller.py", line 32, in <module>
    from virtinst import urlfetcher
  File "/home/tal/work/virt-manager/virtinst/urlfetcher.py", line 35, in <module>
    from virtinst import osdict
  File "/home/tal/work/virt-manager/virtinst/osdict.py", line 25, in <module>
    from gi.repository import Libosinfo as libosinfo
ImportError: cannot import name Libosinfo

This was solved by installing libosinfo-1.0-dev and libosinfo-bin:
sudo apt-get install libosinfo-bin libosinfo-1.0-dev


This time the application successfully ran, but pressing the "Open" button generates the following error:
Error launching details: cannot import name GtkVnc
Traceback (most recent call last):
  File "/home/tal/work/virt-manager/virtManager/engine.py", line 753, in _show_vm_helper
    details = self._get_details_dialog(uri, vm.get_connkey())
  File "/home/tal/work/virt-manager/virtManager/engine.py", line 731, in _get_details_dialog
    obj = vmmDetails(conn.get_vm(connkey))
  File "/home/tal/work/virt-manager/virtManager/details.py", line 495, in __init__
    from virtManager.console import vmmConsolePages
  File "/home/tal/work/virt-manager/virtManager/console.py", line 26, in <module>
    from gi.repository import GtkVnc
ImportError: cannot import name GtkVnc

After reading https://www.redhat.com/archives/virt-tools-list/2014-March/msg00128.html and https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1188846.html:
sudo apt-get install libgtk-3-dev gir1.2-gtk-vnc-2.0

Which led to the next issue:
Error launching details: cannot import name SpiceClientGtk
Traceback (most recent call last):
  File "/home/tal/work/virt-manager/virtManager/engine.py", line 753, in _show_vm_helper
    details = self._get_details_dialog(uri, vm.get_connkey())
  File "/home/tal/work/virt-manager/virtManager/engine.py", line 731, in _get_details_dialog
    obj = vmmDetails(conn.get_vm(connkey))
  File "/home/tal/work/virt-manager/virtManager/details.py", line 495, in __init__
    from virtManager.console import vmmConsolePages
  File "/home/tal/work/virt-manager/virtManager/console.py", line 27, in <module>
    from gi.repository import SpiceClientGtk
ImportError: cannot import name SpiceClientGtk

Now, I ran the following command:
sudo apt-get install python-spice-client-gtk gir1.2-spice-client-gtk-3.0

Finally! Now you should be able to easily run your new virt-manager.


NOTE: This post was written based on the master branch with a specific commit (aa823b5b58d689e2a69a9822fd462a1333d8d415) since the current state had a small issue creating new machines (I sent a patch https://www.redhat.com/archives/virt-tools-list/2014-July/msg00051.html).

Have fun!
Tal Kain

3 comments:

  1. I should have read this:-)

    I was in the same position and but I did it via som ppa etc and got a mess. Now I have libvirt git repo and others and I can't get it to hold together.

    Am I right in that your virt-manager from source works with everything else based on supported 14.04 packages? libvirt, kvm qemu etc. Or is the starting point for this blogpost something else than plain 14.04.
    I would much rather go with 16.04 but I am stuck with 14.04 a while longer unfortunately.

    Kind regards,

    ReplyDelete
    Replies
    1. Hey soundoptics,
      When I did this post, everything was installed using the standard packages (no PPA, no manually installed debs).

      I am not sure what is the current status of the project (this post is from 2014 :) ), but I assume that everything should still work perfectly on Ubuntu 14.04.

      Good luck!
      - Tal

      Delete

Note: Only a member of this blog may post a comment.