Tuesday, July 8, 2014

Ubuntu: Fixing issues with apt-get after installing Steam client

After installing the latest Steam client (http://store.steampowered.com/) on my Ubuntu 14.04 using the Ubuntu Software Center, I decided to install another package using the package manager.

As a first step I ran apt-get update, which (you guessed correctly) failed fetching several index files:

Err https://private-ppa.launchpad.net precise/main amd64 Packages            
  HttpError401
Err https://private-ppa.launchpad.net precise/main i386 Packages              
  HttpError401
Ign https://private-ppa.launchpad.net precise/main Translation-en_US          
Ign http://security.ubuntu.com trusty-security/main Translation-en_US    
.....
... 
W: Failed to fetch https://private-ppa.launchpad.net/commercial-ppa-uploaders/steam/ubuntu/dists/precise/main/binary-amd64/Packages  HttpError401
W: Failed to fetch https://private-ppa.launchpad.net/commercial-ppa-uploaders/steam/ubuntu/dists/precise/main/binary-i386/Packages  HttpError401
E: Some index files failed to download. They have been ignored, or old ones used instead.


It seems that my /etc/apt/auth.conf pointed to an incorrect username (a user that was used to merge between 2 different accounts that I had), changing the username to my current username fixed the problem and I was able to update the index files with no errors/warnings.

That's all,
Tal Kain

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