Linux – Unable to configure KVM (Qemu or Libvirt) on openSUSE Leap 42.1

linux-kvmopensuseqemuvirt-managervirtualization

I simply want to run multiple VM (not at the same time). I want them to be stored in another partition (mounted here /run/media/shark/VM) and not in the default storage pool /var/lib/libvirt/images/default.

No matter for me to use virsh or qemu-kvm, virtlib or qemu, CLI or GUI, I just want my VMs to run 🙂

I installed KVM as follows :

  1. Start YaST and choose Virtualization > Installing Hypervisor and Tools.
  2. Select KVM and confirm with Accept.
  3. Confirm the list of packages that is to be installed with Install.
  4. Agree to set up a network bridge by clicking Yes.

KVM trying

I tried different ways :

with virtlib (vm-install)

I tried :

 % vm-install --name "mageia5" \ 
--vcpus 2 --memory 1024 --max-memory 2048 \
--disk /run/media/shark/VM/VirtualMachines/mageia_raw_test,0,disk,w,8000,sparse=1 \
--disk /home/shark/Téléchargements/mageia_boot-nonfree.iso,1,cdrom \
--nic model=virtio \
--graphics cirrus --config-dir "/etc/libvirt/qemu"

Prompt for OS :

4: Other operating system

Then :

PXE Boot
(Y / N) [N] > N
Description > 

Virtual Disks:
  7.8 GB Hard Disk (file:/run/media/shark/VM/VirtualMachines/mageia_raw_test)
  0.1 GB CD-ROM or DVD (file:/home/shark/Téléchargements/mageia_boot-nonfree.iso)
Do you want to add another virtual disk?
(Y / N) [N] > N 

Network Adapters
  QEMU Virtualized NIC Card; Randomly generated MAC address
Do you want to add another virtual network adapter?
(Y / N) [N] > N

Specify the bootable virtual disk (often labeled as Disk 1) or the network
installation source URL.  Each CD, DVD, or ISO image required for installation
must be added as a virtual disk.
  1: Virtual Disk (0.1 GB CD-ROM or DVD (file:/home/shark/Téléchargements/mageia_boot-nonfree.iso))
[1] > 1

Preparing to start the installation...

Installing...

Failed to display the VM's console because DISPLAY is not set.  Please connect a VNC viewer to localhost:5900.

But I don't know how to run a VNC viewer (with virt-viewer ?)

with qemu

With qemu-kvm it seems there is a problem of network + problem of permissions + problem of display

 % qemu-kvm -name "mageia 5" -M pc-0.12 -m 1024 \ VM/VirtualMachines linux-7o7a
-boot d \
-drive file=/run/media/shark/VM/VirtualMachines/mageia.qcow2,if=virtio,index=0,media=disk,format=qcow2 \
-drive file=/home/shark/Téléchargements/mageia_boot-nonfree.iso,index=1,media=cdrom \
-net nic,model=virtio,macaddr=52:54:00:05:11:11 \
-balloon virtio \
-vga cirrus
Warning: vlan 0 is not connected to host network
Unable to init server: Could not connect: Connection refused

(qemu-system-x86_64:7189): Gtk-WARNING **: cannot open display: 

with virt-manager

libvirt URI : qemu:///system

When I want to finish installation :

Impossible de terminer l'installation : « internal error: process exited while connecting to monitor: 2016-01-16T15:47:09.003883Z qemu-system-x86_64: -chardev pty,id=charserial0: Failed to create chardev
 »

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 89, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/create.py", line 1969, in do_install
    guest.start_install(meter=meter)
  File "/usr/share/virt-manager/virtinst/guest.py", line 442, in start_install
    noboot)
  File "/usr/share/virt-manager/virtinst/guest.py", line 506, in _create_guest
    dom = self.conn.createLinux(start_xml or final_xml, 0)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3585, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error: process exited while connecting to monitor: 2016-01-16T15:47:09.003883Z qemu-system-x86_64: -chardev pty,id=charserial0: Failed to create chardev

What is chardev ? Connecting to monitor : a problem of display ?

KVM configuration

I wil ltry to say here all needed informations :

I'm running openSUSE Leap 42.1 64 bits

My proc is an Intel i7 3610QM 2.3Ghz so it allow virtualisation.
That's confirmed when I run % egrep '(vmx|svm)' /proc/cpuinfo, I get vmx.

SO I ran modprobe kvm-intel (Do I need to run it only once or each time I start a session ?).

Do I need to do modprobe vhost-net ?

  • /etc/libvirt/qemu.conf by default : all commented
  • /etc/libvirt/libvirt.conf by default : all commented
  • /etc/libvirt/libvirtd.conf : unix_sock_group = "libvirt" + unix_sock_rw_perms = "0770" + auth_unix_rw = "none"

I added my user and qemu user in libvirt group :

usermod -a -G libvirt qemu
usermod -a -G libvirt shark

I Changed the configuration in /etc/libvirt/libvirtd.conf as above.

And then : rclibvirtd restart

And I think I have to configure my VNC access in /etc/libvirt/qemu.conf but I don't know how.

Question

How can I configure my environnement and KVM to run my VMs ?
As I said :

No matter for me to use virsh or qemu-kvm, virtlib or qemu, CLI or
GUI, I just want my VMs to run

PS : It is the first time I tried virtualization on linux, be indulgent. I'm new in the StackEchange Community so maybe I made mistake by redacting this question, be indulgent. I'm french so I'm not so fluent in English, be indulgent. So please BE indulgent 🙂


Update (21/01/2016) :
I also try to install a VM with the GUI of vm-install in virt-manager and install it in the default storage pool /var/lib/libvirt/images/default

Impossible de terminer l'installation : « missing target information for device /var/lib/libvirt/images/default/generic.qcow2 »

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 89, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/create.py", line 1969, in do_install
    guest.start_install(meter=meter)
  File "/usr/share/virt-manager/virtinst/guest.py", line 442, in start_install
    noboot)
  File "/usr/share/virt-manager/virtinst/guest.py", line 506, in _create_guest
    dom = self.conn.createLinux(start_xml or final_xml, 0)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3585, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: missing target information for device /var/lib/libvirt/images/default/generic.qcow2

Update (10/02/2016) :
It's seems I regressed, now I just can't connect to QEMU/KVM (qemu:///system) with virt-manager, I get an error message :

Impossible de se connecter Ă  libvirt.
internal error: Cannot find suitable emulator for x86_64

And it seem's my QEMU is too new :

systemctl status libvirtd
libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled)
   Active: active (running) since mer. 2016-02-10 18:37:24 CET; 52min ago
     Docs: man:libvirtd(8)
           http://libvirt.org
 Main PID: 1940 (libvirtd)
   CGroup: /system.slice/libvirtd.service
           └─1940 /usr/sbin/libvirtd --listen

févr. 10 19:23:52 linux-7o7a.site libvirtd[1940]: unsupported configuration: QEMU 2.3.1 is too new for help parsing
févr. 10 19:23:52 linux-7o7a.site libvirtd[1940]: Failed to probe capabilities for /usr/bin/qemu-system-i386: unsupported configuration: QEMU 2.3.1 is too new for help parsing
févr. 10 19:23:53 linux-7o7a.site libvirtd[1940]: unsupported configuration: QEMU 2.3.1 is too new for help parsing
févr. 10 19:23:53 linux-7o7a.site libvirtd[1940]: Failed to probe capabilities for /usr/bin/qemu-kvm: unsupported configuration: QEMU 2.3.1 is too new for help parsing
févr. 10 19:23:53 linux-7o7a.site libvirtd[1940]: unsupported configuration: QEMU 2.3.1 is too new for help parsing
févr. 10 19:23:53 linux-7o7a.site libvirtd[1940]: Failed to probe capabilities for /usr/bin/qemu-system-x86_64: unsupported configuration: QEMU 2.3.1 is too new for help parsing
févr. 10 19:23:53 linux-7o7a.site libvirtd[1940]: unsupported configuration: QEMU 2.3.1 is too new for help parsing
févr. 10 19:23:53 linux-7o7a.site libvirtd[1940]: Failed to probe capabilities for /usr/bin/qemu-kvm: unsupported configuration: QEMU 2.3.1 is too new for help parsing
févr. 10 19:23:53 linux-7o7a.site libvirtd[1940]: invalid argument: could not find capabilities for arch=x86_64 domaintype=qemu 
févr. 10 19:23:53 linux-7o7a.site libvirtd[1940]: internal error: Cannot find suitable emulator for x86_64

And :

sudo qemu-system-x86_64
Warning: default mac address being used, creating potential for address conflict
Unable to init server: Impossible de se connecter : Connexion refusée

(qemu-system-x86_64:5610): Gtk-WARNING **: cannot open display: 

Best Answer

for me it was a corrupt installation of brlapi.

To debug it I killed libvirt, the backend for Virtual Machine Manager and Gnome Boxes with

sudo systemctl stop libvirtd

and then ran it in the terminal with

sudo libvirtd

The first error hinted that

internal error: Child process (LC_ALL=C PATH=/sbin:/bin:/usr/sbin:/usr/bin HOME=/root USER=Douglas LOGNAME=adams /bin/qemu-system-alpha -help) unexpected exit status 127: /bin/qemu-system-alpha: error while loading shared libraries: libbrlapi.so.0.6: cannot open shared object file: No such file or directory

Then to find what provides libbrlapi, I ran

$ dnf provides --refresh "libbrlapi.so*"
brlapi-0.6.3-10.fc23.x86_64 : Application Programming Interface for BRLTTY

Afterwhich, a quick reinstall fixed my issue

sudo dnf reinstall brlapi

This was likely caused by some core tinkering I had done to compile brillo, php and app engine.

Hope this helps!

Related Question