Monday, September 29, 2014

Ubuntu && Python: Solving "ImportError: No module named OpenSSL"

In order to easily solve the following Python import error on Ubuntu systems:
ImportError: No module named OpenSSL

You can install the relevant package using the following command:
$ sudo apt-get install python-openssl
 The other option would be to install the OpenSSL paackage using Python's pip:
$ sudo pip install pyOpenSSL

Good luck!
- Tal Kain

Saturday, September 27, 2014

Ubuntu and Gnome: Moving the Close, Maximize and Minimize buttons to the right corner.

A quick tip:

One of the first things that I do after setting a new Ubuntu system is changing the location of the Close && Minimize && Maximize buttons to be on the right side of the window.

There are several ways to achieve this, but the simplest way is using the command line, running the following command:

gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close"
(The colon should be on the left side of the string)


Tuesday, July 8, 2014

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

After installing the latest Steam client ( 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 precise/main amd64 Packages            
Err precise/main i386 Packages              
Ign precise/main Translation-en_US          
Ign trusty-security/main Translation-en_US    
W: Failed to fetch  HttpError401
W: Failed to fetch  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 ( ) 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 ( ) 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 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/", line 40, in <module>
    from virtinst.interface import Interface, InterfaceProtocol
  File "/home/tal/work/virt-manager/virtinst/", 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/", line 70, in <module>
    from virtinst.distroinstaller import DistroInstaller
  File "/home/tal/work/virt-manager/virtinst/", line 32, in <module>
    from virtinst import urlfetcher
  File "/home/tal/work/virt-manager/virtinst/", line 35, in <module>
    from virtinst import osdict
  File "/home/tal/work/virt-manager/virtinst/", 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/", line 753, in _show_vm_helper
    details = self._get_details_dialog(uri, vm.get_connkey())
  File "/home/tal/work/virt-manager/virtManager/", line 731, in _get_details_dialog
    obj = vmmDetails(conn.get_vm(connkey))
  File "/home/tal/work/virt-manager/virtManager/", line 495, in __init__
    from virtManager.console import vmmConsolePages
  File "/home/tal/work/virt-manager/virtManager/", line 26, in <module>
    from gi.repository import GtkVnc
ImportError: cannot import name GtkVnc

After reading and
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/", line 753, in _show_vm_helper
    details = self._get_details_dialog(uri, vm.get_connkey())
  File "/home/tal/work/virt-manager/virtManager/", line 731, in _get_details_dialog
    obj = vmmDetails(conn.get_vm(connkey))
  File "/home/tal/work/virt-manager/virtManager/", line 495, in __init__
    from virtManager.console import vmmConsolePages
  File "/home/tal/work/virt-manager/virtManager/", 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

Have fun!
Tal Kain

Saturday, April 26, 2014

Saving space on an SSD hard drive using Sysinternal’s Junction

(NOTE: This is a post that I made on March 4, 2012 that I re-post on this blog after restoring it using


Not so long ago I decided to buy myself a new computer (since my old one could handle the pressure), I bought myself two hard drives:

  1. OCZ Vertex2 60GB
  2. Western Digital Caviar Blue (1TB)

The SSD for the operating system and the Caviar Blue for all my data.

I installed my Windows 7 Ultimate edition (with no SP1), Visual Studio, Office and updated them all using Windows Update.
After doing so, I was amazed to find out that I had only 20GB left on my SSD drive – bummer…

In order to find out what is taking me so much space I used WinDirStat ( and find out that my C:\WINDOWS\Installer folder took almost 6GB of my expensive SSD space!

After searching the web for a while I found out about Mark Russinovich’s tool called "Junction"

From his site (

Windows 2000 and higher supports directory symbolic links, where a directory serves as a symbolic link to another directory on the computer. For example, if the directory D:\SYMLINK specified C:\WINNT\SYSTEM32 as its target, then an application accessing D:\SYMLINK\DRIVERS would in reality be accessing C:\WINNT\SYSTEM32\DRIVERS. Directory symbolic links are known as NTFS junctions in Windows. Unfortunately, Windows comes with no tools for creating junctions—you have to purchase the Win2K Resource Kit, which comes with the linkd program for creating junctions. I therefore decided to write my own junction-creating tool: Junction.Junction not only allows you to create NTFS junctions, it allows you to see if files or directories are actually reparse points. Reparse points are the mechanism on which NTFS junctions are based, and they are used by Windows’ Remote Storage Service (RSS), as well as volume mount points.

So I have downloaded Junction, created a folder (with the correct credentials of course) on my other hard drive and pointed C:\WINDOWS\Installer to the new folder... success! Everything is working as expected (Windows Update) and I just cleared 6GB from my SSD hard drive…

You can download Junction from here:
(Using instructions can be found under the download page)


BinDiff error: "Can't start disassembler. Please set correct path in the main settings first"

After installing BinDiff and running the application for the first time on my Windows 7 x64 machine, I tried comparing two different binaries but got an error in the middle of the process:

Can't start disassembler. Please set correct path in the main settings first

The solution for this error is very simple:
While installing BinDiff, the installation process asks for the installation path of IDA. The default path (on x64 machine) would be C:\Program Files (x86)\IDA\. This is not always correct.

At my case the installation was at C:\Program Files (x86)\IDA 6.3\.
Moving the path inside BinDiff will not be sufficient since part of BinDiff's files are still on the old directory.

Easiest way to fix it (or by doing it in advance): Uninstall BinDiff and install it while pointing to the correct IDA's path.


Python PIP Error: Unable to find vcvarsall.bat

While trying to install the Python's PIL package on my Windows 7 machine using pip I came across this error:

Error: Unable to find vcvarsall.bat

Although I had Visual Studio 2010 installed, and made sure the batch file exists and the batch file creates the compilation environment correctly, I still got this error.

Googling the issue brought this question with this specific solution.

The short answer (credits to fmuecke) is to point the environment variable VS90COMNTOOLS to the value of  VS100COMNTOOLS.


This solved the issue.