Problems encountered Starting a VM under Mint with KVM&QEMU

So ive been trying to run a windows vm with KVM and QEMU under linux Mint tesa 19.1. After a bit of trouble managed to VFIO one of my two similar GPUs. But now i have the problem that the virt-manager program cant start because libvirtd isnt running.

Ive run this
sudo apt install qemu-kvm qemu-utils seabios ovmf hugepages cpu-checker
and this
sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager qemu virt-viewer spice-vdagent

but when i start virt-manager, even with sudo, it says the libvirtd isnt online.

Starting the service manualy with
sudo service libvirtd start
seems to just start it and kill it.

I have no ideea what the heck is wrong and how i can fix it.
I used this guide here to VFIO one of two similar GPUs i have

Im not sure if this broke anything, but i simply have no ideea what to do next. This is transforming into a major pain in the arse. Getting a VM to run.

Try using systemd to start the service. Run sudo systemctl start libvirtd then if it works run sudo systemctl enable libvirtd to make it start at boot.

sudo systemctl status libvirtd to check the status of libvirt

Thats just it, when or if i start it manually like that, it starts “dead”, so when i “ping” ist Status, it Shows as started and closed with the time stamp of when i tried to start it.

Is there a way i can Diagnose why in gods Name this is Happening ?
I think a
journalctl -u libvirtd.service
would Show me what is going on, (if you know of other way to Diagnose shit up, do share - im basically a Linux noob, switched to Linux for couple of weeks from Windows 10) unfortunatly i cant SSH into my Server, since the goddamn vodafone external IP changes constantly (another pain in my fkn arse)

I also wanted to VFIO a pci express bound USB 3.0 Controller, but somehow it didnt work ( i used the same method i used to vfio one of two similar gpus). The USB Controllers still apear bound to xhci Driver or something.

Could that be what cause the libvirt to not be able to maintain running Status ?

I basically needed to vfio one gpu, which it worked, two usb 3.0 pci express Controllers, and one of two similar on board built 10 gbit Networks, but i dont think, thatll work, since their in the same iommu Group. So ill have to do a Network like in most of of the tutorials is shwon, … by making a Bridge or something.

Anyway, without getting the libvirt to run, all of it will have been for nothing, since i cant start a vm without a running libvirt, right ?

like @TheCakeIsNaOH said:
sudo systemctl status libvirtd and then ready why it failed to start.
If you cant find a good error, try starting it again. to make it print the errors again. Or like you said; Look at the journal.

You want to get the VM running before you start adding stuff to it, So that you know what you changed and what you need to look at.
Instead of having ten different theories, like now.

And you dont need to stub usb controllers, and well you cant if they share an iommu group with other stuff (unless you want to patch the kernel or pass it all trough).
I still passed trough some of my usb root hub controllers trough the virt-manager GUI, Without touching anything else.
It works great, And just to be clear this is not the same as passing trough a single usb keyboard or mouse, i passed one USB controller, that is in a group with other stuff. Without passing them.
I did this using the GUI in virt-manager, Passing the PCI host device not a USB host device.

And the only reason i would stub a NIC is if i wanted to isolate it from the host.
I personally made a bridge on one of my nics. This allowes me to move stuff between the host and VM without being limited by the speed of my phyiscal NIC.

i didnt even start creatin the vm, since when i start virt-manager, it says the libvirtd isnt running, so i cant create shit.
Will try once at home, and update this thread with new info.

Yah, basically, thats what i want to do, pass the whole PCI host USB 3.0 Controller.
I have a PCI express Card with 4 usb 3.0 ports, and each port has ist own Controller. Previously i used esxi to run 2 Windows VMs, and i gave 2 Controllers to each Windows vm.

And i had a usb 3.0 hub connected to These usb Controllers, so basically everything i plugged on the usb hub, appeared instantly on the Windows VM. Ist what im trying to do here, and i though i had to VFIO the usb 3.0 Controllers like i did with the gpu. Guess i can take their ids out from the file which vfio-ed the gpu.

here is what i got:

I tried to do this
https://wiki.libvirt.org/page/The_daemon_cannot_be_started

You need to uncomment this line

log_outputs=“3:syslog:libvirtd”

started then the demon
and checked
/var/log/syslog and found:

Jul 2 17:20:45 EpycServer libvirtd: 24033: info : libvirt version: 4.0.0, package: 1ubuntu8.11 (Christian Ehrhardt [email protected] Mon, 27 May 2019 11:52:07 +0200)
Jul 2 17:20:45 EpycServer libvirtd: 24033: info : hostname: EpycServer
Jul 2 17:20:45 EpycServer libvirtd: 24033: error : virFirewallValidateBackend:193 : direct firewall backend requested, but /sbin/ebtables is not available: No such file or directory
Jul 2 17:20:45 EpycServer libvirtd: 24033: error : virFirewallApply:916 : internal error: Failed to initialize a valid firewall backend
Jul 2 17:20:45 EpycServer libvirtd: 24033: error : virGetUserID:1041 : invalid argument: Failed to parse user ‘libvirt-qemu’
Jul 2 17:20:45 EpycServer libvirtd: 24033: error : virStateInitialize:775 : Initialization of QEMU state driver failed: invalid argument: Failed to parse user ‘libvirt-qemu’
Jul 2 17:20:45 EpycServer libvirtd: 24033: error : daemonRunStateInit:849 : Driver state initialization failed

WTH is this ?

So i did
sudo apt-get update -y
sudo apt-get install -y ebtables

Fixed the first part of the error

Regarding this, it seems libvirt creates a user name. and i remebner looking up how to delete it.
i manage to make this user dissaper by removing a line from
/etc/passwd file
now i dont know how i can make the line appear there again.

Damn !

cant you just add the user again? make sure it is a system user (no shell access) and not a regular user.
On arch linux this would be:

useradd -r -u -s /usr/bin/nologin libvirt-qemu

btw the -u means add the user group libvirt-qemu and add the user to it.

And you might want to add yourself to libvirt-qemu:
gpasswd -a bytales libvirt-qemu

try starting virt-manager as sudo.
I seem to recollect libvirt being kind of a D… bag.

so this would work on ubuntu as well ?

useradd -r -u -s /usr/bin/nologin libvirt-qemu
This bzythe way returns an error
useradd: invalid user ID ‘-s’

and i would need to add this ass well?

gpasswd -a bytales libvirt-qemu

i dont want to mess shit up, i dont know how to undo this CLI commands

How would i know this user is tied to the libvirt program, to me it seems this command would add an arbitrary user named libvirt-qemu that has nothing to do with libvirt

Could i install shit up, and run stuff, that created this username or user group in the first place ?

running a sudo doesnt fix the problem, i need to get the libvirtd running. it had 2 things preventing it from running, the firewall network thingz, which got solved by installing ebtables *whateva da faq that is, dont know, but it fixed it), and the second thing is the fact that no libvirt-qemu user exists, which im still pondering how to fix

i would not say that the user account you deleted was tied to the program, Neither that the new one will be.

However the program is trying to run something as the user libvirt-qemu.
And it can not because you deleted that user, Resulting in the program not starting. And you also did it in a very dirty way that may cause further issues.

Yes you could try to just remove libvirtd, reinstall and see if you can find the user in /etc/passwd
Like you said, You have not yet configured anything. so there won’t be a loss.

About the useradd, I might have messed up the format when i added the -u, the rest was copy pasted from the arch wiki and should work.

If not google: Linux mint add system-user
(a system user is a user without shell access (aka terminal aka bash)
Or if that doesn’t work, google: Ubuntu add system-user. Mint is a Ubuntu fork.

then check if the the libvirt-qemu group exsists:
cat /etc/group
(don’t add users by writing to this file, Linux wont be aware).

for me on arch the group is just called libvirt.

PS: you could add some tags to this thread to attract more helpers and speed this up, My suggestions are:
passtrough vfio kvm helpdesk

sudo apt-get install --reinstall libvirt-bin didnt fix the user thingy. I guess i have to either add the user myself manually, or maybe try performing an uninstall, then an install again.

Could reinstall Linux, but thats a bit to radical, i would say.

I also noticed i have another Problem.
Sometimes, my mouse and Keyboard freezes, and after 30 seconds, im am taken to the Login Screen again, where i Need to Input my user Password.

How in gods Name do i Diagnose this, to see what the hell is wrong ?

adding a user is something i consider easy.
If you are starting over again by reinstalling i might recommend using a distro with a complete guide.
It would soften the learning curve as you will have less issues getting it up and running.
And getting it to work will feel quite rewarding.

the popos guide is the only one I have seen with the two identical gpus. but it is not yet complete, And lacking some stuff about pinning memory on numanodes but that might not be relevant for you.

I think I would start with why your gui is crashing. look at the system logs after you log back in after a crash.
https://forums.linuxmint.com/viewtopic.php?f=42&t=223066

Then if you need help with the errors. keep posting them here :slight_smile:

Regarding the GUI crush, what you recommended, does it still apply, if i changed base mint kernel to latest ubuntu 5.1.15 kernel ?

Also Kind of offTopic:
What Kind of Forum is this ? Since i see all sorts of categories here, ist like an open market, and theres also a Linux Category, and thats where i am right now !

I have a bit of experience with configurin VMs becuase i tried unraid, couple of months back, and prox mox. and ended up using ESXI, because i wanted to have GPU passthrough. Doing it natively from Linux, i havent tried it yet.

Planning on doing it via virt-manager. The programs seems pretty straighforward in regards to configuring a VM, and there are plenty tutorials on Internet.

Need to get this libvirt going though.

Interesting with Linux, i think theres a log for everything, so if there are any Problems, allmost all can be diagnosed and fixed, with the proper knowledge.

But ist all new to me, been using Windows since Windows 98 when i first started using PC. Theres a lot of stuff i Need to get used to, and for some stuff, i cant leave Windows totally behind, which is why i Need to install one in a VM still.
For instance, Destiny 2, AutoCAD, Excell with XLP precision, Photoshop, CorelDRAW, this stuff doesnt exist on Linux.

I don’t know how a changing kernels will affect your GUI as i don’t know why your GUI is crashing, And tbh i don’t know if ubuntu, mint or debian patch their kernels, Wich could break things.

But generally the amd gpus like newer kernels. And you are thinking of going from not bleeding to even older, But hey more stability!

Welcome to the community forum of https://www.level1techs.com/
Most people end up here after watching their clips on youtube, Like this one:

PS: they have multiple youtube channels.

It generally seem to attract people with and interest in virtualisation, containerisation, servers, hardware, linux and more. Some are professionals and some are amateurs with an interest like myself.

The forum might seem abit dead now since more people are not interacting in this post, But if you add some more tags to the topic, You will attract alot more people.
I only noticed this post becose i get notifications for the Linux tag on this post.

I also keep a windows wm for gaming or patching my phone, Like you i run it trough qemu with virt-manager on a threadripper 2920x.

And if you like photoshop you should try GIMP, it runs on linux and it is free :grinning:

It sounds to me like you prefer learning the same way as i do, just jumping in, getting your hands dirty?
And then read the documentation later to understand better what you just did. It is why i sugested that you start with a guide.
Also proxmox is linux with qemu. And now you are trying to use linux mint with qemu, You merely replaced proxmox with virt-manager.

My Mainboard has a built in gpu ASmedia AST2000 or something, after installing mint, i get Video Output only through this Video Card. If i try to install amd Drivers, mint goes into fall back mode. But after i updated to new kernel, i simply receive Output on the Monitors connected to the AMD Video Cards. Without ever needing to install amd Drivers. That is something i learned the hard way.

Will Keep posted regarding libvirt issue.

1 Like

i managed to fix the libvirt starting, i did
sudo apt-remove libvirtbin libvirt-daemon-system
and then reinstalled them
now libvirt is running proeprly

i checked my existing users and groups, and all the users and groups were allready there, so adding them would have probablz not fixed the problem

Surprisingly now i can start virt-manager without using sudo, it doesnt show virtlib error