Has anyone managed to make Qemu work with libvirt?

Technical issues/questions of an intermediate or advanced nature.
fulalas
DEV Team
DEV Team
Posts: 2050
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

Has anyone managed to make Qemu work with libvirt?

Post#1 by fulalas » 11 Jan 2022, 00:46

Qemu is working downloading it from here (and all the required dependencies): https://slackware.pkgs.org/current/slac ... f.txz.html

But vanilla Qemu is tough, so I'm trying to use it with libvirt, but after download all its dependencies it open with this error saying something like can't access /var/run/*** because it doesn't exit.

burdi01
Shogun
Shogun
Posts: 201
Joined: 18 Aug 2013, 12:09
Distribution: Slackware PartedMagic Xubuntu
Location: The Netherlands

Has anyone managed to make Qemu work with libvirt?

Post#2 by burdi01 » 11 Jan 2022, 15:55

Yes, I did using virt-manager > libvirt > qemu from Conraid's repository. Since then I have no need for VirtualBox on Slackware any more.
For details see my kvm-211219-packages-1cf.tar.gz list and scripts:
-- https://drive.google.com/file/d/1uENh3l ... sp=sharing
:D

fulalas
DEV Team
DEV Team
Posts: 2050
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

Has anyone managed to make Qemu work with libvirt?

Post#3 by fulalas » 12 Jan 2022, 09:12

Thanks, but it's still not working. I downloaded all the packages (plus some pythons one there are missing in your script) and ran virt-manager as sudo. The application opens and if I click on 'Create new virtual machine' (top left) I see this message:

Code: Select all

Error: No active connection to install on.
Any idea?

burdi01
Shogun
Shogun
Posts: 201
Joined: 18 Aug 2013, 12:09
Distribution: Slackware PartedMagic Xubuntu
Location: The Netherlands

Has anyone managed to make Qemu work with libvirt?

Post#4 by burdi01 » 12 Jan 2022, 10:13

Make sure the daemons are started (see the included rc.local snippet) and VirtualBox is *not* started.

Code: Select all

root@riposo:~/works# ps -ef | grep -E "virt|pcscd"
root      2226     1  0 11:01 ?        00:00:00 /usr/sbin/pcscd
root      2233     1  0 11:01 ?        00:00:00 /usr/sbin/virtlockd -d -v -f /etc/libvirt/virtlockd.conf -p /var/run/libvirt/virtlockd.pid
root      2238     1  0 11:01 ?        00:00:00 /usr/sbin/virtlogd -d -v -f /etc/libvirt/virtlogd.conf -p /var/run/libvirt/virtlogd.pid
root      2252     1  0 11:01 ?        00:00:00 /usr/sbin/libvirtd -d -l -v -f /etc/libvirt/libvirtd.conf -p /var/run/libvirt/libvirtd.pid
....
root      3385  2683  0 11:08 pts/0    00:00:00 grep -E virt|pcscd
root@riposo:~/works# 
:D

fulalas
DEV Team
DEV Team
Posts: 2050
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

Has anyone managed to make Qemu work with libvirt?

Post#5 by fulalas » 12 Jan 2022, 10:32

Code: Select all

ps -ef | grep -E "virt|pcscd"
root      5412     1  0 22:02 ?        00:00:00 /usr/sbin/pcscd
nobody    6570     1  0 22:02 ?        00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
root      6571  6570  0 22:02 ?        00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
root      8784     1  0 22:04 ?        00:00:00 /usr/sbin/virtlockd -d -v -f /etc/libvirt/virtlockd.conf -p /var/run/libvirt/virtlockd.pid
root      8789     1  0 22:04 ?        00:00:00 /usr/sbin/virtlogd -d -v -f /etc/libvirt/virtlogd.conf -p /var/run/libvirt/virtlogd.pid
root      8799     1  0 22:04 ?        00:00:00 /usr/sbin/libvirtd -d -l -v -f /etc/libvirt/libvirtd.conf -p /var/run/libvirt/libvirtd.pid
root     11891 11460  0 23:28 pts/0    00:00:00 grep -E virt|pcscd
Have you tried this in Always Fresh? Or maybe I'm missing something... What's the step by step, like for stupid users? :D

burdi01
Shogun
Shogun
Posts: 201
Joined: 18 Aug 2013, 12:09
Distribution: Slackware PartedMagic Xubuntu
Location: The Netherlands

Has anyone managed to make Qemu work with libvirt?

Post#6 by burdi01 » 12 Jan 2022, 10:51

Is your user a member of the pcscd group?

I run qemu and friends in my Slackware instances to a.o. run a Porteus livecd in a VM.

Also use e.g. this script to check for missing libraries:

Code: Select all

#!/bin/sh

# _libs : list (almost) all library usage
# =======================================
# (c) DLCB 20/1-2021

for I in /bin/* /sbin/* /usr/bin/* /usr/sbin/* /usr/libexec/* /usr/libexec/*/* \
   /lib/udev/* ; do
   echo ">>> $I" ; ldd $I 2> /dev/null
done
Something like "_libs > libs.libs ; grep found libs.libs"
:D
Last edited by burdi01 on 12 Jan 2022, 13:08, edited 1 time in total.

fulalas
DEV Team
DEV Team
Posts: 2050
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

Has anyone managed to make Qemu work with libvirt?

Post#7 by fulalas » 12 Jan 2022, 11:14

There wasn't any pcscd group in the first place. That's wht I asked for a step by step :P Probably I'm missing some steps that create groups, add permissions, etc.

That being said...

Code: Select all

groupadd pcscd
usermod -a -G pcscd root
Same error. :(

beny
Full of knowledge
Full of knowledge
Posts: 2086
Joined: 02 Jan 2011, 11:33
Location: italy

Has anyone managed to make Qemu work with libvirt?

Post#8 by beny » 12 Jan 2022, 12:35

hi, maybe i am wrong but pcscd is a smartcard reader daemon and i don't think have a group user,but...

burdi01
Shogun
Shogun
Posts: 201
Joined: 18 Aug 2013, 12:09
Distribution: Slackware PartedMagic Xubuntu
Location: The Netherlands

Has anyone managed to make Qemu work with libvirt?

Post#9 by burdi01 » 12 Jan 2022, 13:06

I run qemu and friends as root and non-root on up-to-date Slackware Current instances -- no su necessary.

Code: Select all

root@riposo:~/works# id
uid=0(root) gid=0(root) groups=0(root)

burdi01@riposo:~/works$ id
uid=1000(burdi01) gid=100(users) groups=100(users),7(lp),10(wheel),11(floppy),17(audio),18(video),19(cdrom),83(plugdev),84(power),86(netdev),93(scanner),199(vfat)
Yes, pcsc is a smartcard reader. It was listed as a dependency so I installed the pcsc-lite package. Its install script creates a uid/gid of 257/257. However no user other than <257> is member of that group. Updated my post #6 therefor.

And last but not least: is qemu/kvm virtualization enabled in your kernel?
:D

burdi01
Shogun
Shogun
Posts: 201
Joined: 18 Aug 2013, 12:09
Distribution: Slackware PartedMagic Xubuntu
Location: The Netherlands

Has anyone managed to make Qemu work with libvirt?

Post#10 by burdi01 » 13 Jan 2022, 09:53

I hope to have some time to spend in the near future. Possibly I could try to reproduce / resolve your problem then. Please specify which Porteus ISO you are running, as well as the additional xzm's etc.
:D

burdi01
Shogun
Shogun
Posts: 201
Joined: 18 Aug 2013, 12:09
Distribution: Slackware PartedMagic Xubuntu
Location: The Netherlands

Has anyone managed to make Qemu work with libvirt?

Post#11 by burdi01 » 13 Jan 2022, 13:12

One of my deliberations is that you might miss one or more python packages -- after all Porteus may be based on Slackware Current but its packages complex surely is not the same.
Luckily Porteus v5.0-rc3 sports python 3.9.6 whereas Slackware Current does now 3.9.9, so the python version should not be a problem.
:D

beny
Full of knowledge
Full of knowledge
Posts: 2086
Joined: 02 Jan 2011, 11:33
Location: italy

Has anyone managed to make Qemu work with libvirt?

Post#12 by beny » 13 Jan 2022, 19:07

hi this is the virt-manager list slackbuild:
spice-protocol
spice
spice-gtk
gtk-vnc
yajl
libvirt
libvirt-python
libvirt-glib
osinfo-db-tools
osinfo-db
libosinfo
virt-manager
and btw qemu,but i have seen the porteus kernel lack of a virt option where you start libvirtd this is in porteus 5.16 configure: CONFIG_VHOST_MENU is not set
and this is the option i think we need to work without warning:
CONFIG_VHOST_IOTLB=m
CONFIG_VHOST_RING=m
CONFIG_VHOST=m
CONFIG_VHOST_MENU=y
CONFIG_VHOST_NET=m
CONFIG_VHOST_SCSI=m
CONFIG_VHOST_VSOCK=m
CONFIG_VHOST_VDPA=m
well in porteus i have no space to build a qemu machine but fulalas start rc.libvirtd and virt-manager,the pcscd is a deps for the secure login with a smartcard device,spice need this,but i can go wrong.

fulalas
DEV Team
DEV Team
Posts: 2050
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

Has anyone managed to make Qemu work with libvirt?

Post#13 by fulalas » 13 Jan 2022, 20:59

Thank you! I'll give it a try later :)

beny
Full of knowledge
Full of knowledge
Posts: 2086
Joined: 02 Jan 2011, 11:33
Location: italy

Has anyone managed to make Qemu work with libvirt?

Post#14 by beny » 22 Jan 2022, 00:06

hi fulalas to make a virtual-machine with virtual-manager in porteus,well for me that have failed a lot of time,the hint is remove the two redirect usb in hardware list not the usb controller and the procedure goes well.

burdi01
Shogun
Shogun
Posts: 201
Joined: 18 Aug 2013, 12:09
Distribution: Slackware PartedMagic Xubuntu
Location: The Netherlands

Has anyone managed to make Qemu work with libvirt?

Post#15 by burdi01 » 12 Apr 2022, 09:48

@fulalas: By far most of the time I look at the forum in guest mode (so no login). So just today I saw that on Mar 8 you sent me a private message ...
Nothing in it seems "strange" to me and the ISO runs without any problems.

It looks like the QEMU/KVM Hypervisor is not running or you are not allowed to connect.
First of all I run as root on Slackware Current64. What is your host and userid?
Check virtmanager > File > Add Connection whether you have the QEMU/KVM Hypervisor (not the user session one): Uncheck connect via SSH, Username and Hostname blank, check Autoconnect.
Does https://libvirt.org/manpages/virtqemud.html help?
:D

Post Reply