KVM hypervisor and QEMU install on CentOS 7 : ImportError: cannot import name UnrewindableBodyError

I love it when an error is disappearing on a clean way, like tears on the rain, like a snowman on a winter’s sun. Whatever. This was the case of this ImportError. But first, context. You remember I have installed IMOD on a docker. Well, that solution was not fast enough to process (??) so I decided to go for VM. Now I managed to reach a wobbling 18.5 Gbits/sec between the VM host and my client, an Ubuntu VM. Let me explain how I did it and how I get the error on the title, as well as how I got rid of it. The KVM Hypervisor is a an open source hardware virtualisation software through which we can create and run multiple Linux based and windows based VMs in a very good, professional, and confortable way. It comes with QEMU (install instruction here, but you don’t need them) that can be used to devfine VMs through the command line. In principle we look for the GUI, called virt-manager, that gives us the option to create new VMs just by filling some fields, step-by-step. The installation instruction I follow come from this page, and I list them here:

[root@server ~]# grep -E '(vmx|svm)' /proc/cpuinfo
---> OK
[root@server ~]# yum install qemu-kvm qemu-img virt-manager
libvirt libvirt-python libvirt-client virt-install
virt-viewer bridge-utils
--> OK
[root@server ~]# systemctl start libvirtd [root@server ~]# systemctl enable libvirtd
[root@server ~]# lsmod | grep kvm
kvm_intel 188688 0
kvm 636931 1 kvm_intel
irqbypass 13503 1 kvm
[root@server ~]# virt-manager
Traceback (most recent call last):
File "/usr/share/virt-manager/virt-manager",
line 35, in <module> from virtinst import util as util
File "/usr/share/virt-manager/virtinst/__init__.py",
line 90, in <module>
from virtinst.distroinstaller import DistroInstaller
File "/usr/share/virt-manager/virtinst/distroinstaller.py",
line 23, in <module> from . import urlfetcher
...
from ..exceptions import UnrewindableBodyError

As usual, colours are mine. The fact that the error is on import is pointing me to python, which makes sense to me, since my server is a test machine and we do all kind of nasty things on it. We are supposed to get the GUI above, so let’s fix it. The solution found here is for Ubuntu and similar. This is my CentOS 7.X equivalent:

root@server ~ ## > pip uninstall requests
root@server ~ ## > pip uninstall urllib3
root@server ~ ## > yum remove python-urllib3
root@server ~ ## > yum remove python-requests
root@server ~ ## > yum install python-requests
root@server ~ ## > yum install qemu-kvm qemu-img
virt-manager libvirt libvirt-python libvirt-client
virt-install virt-viewer bridge-utils
root@server ~ ## > systemctl start libvirtd
root@server ~ ## > virt-manager

I hope it works for you also! About the creation of my Ubuntu VM using the menus I have no complains: it went smoothly. Once I have the VM set it up as I like, with user mapped and so on, I can install the ssh server (sudo apt install openssh-server), start the service (systemctl start ssh.service) and connect to it using ssh. But of course we can enable VNC access by editing the config file, as this page explains.

Happy…virtualisation (??)

Advertisement

2 thoughts on “KVM hypervisor and QEMU install on CentOS 7 : ImportError: cannot import name UnrewindableBodyError

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s