libvirt-sock: Connection refused

Getting an error when trying to manage my VMs through CLI or GUI.

virsh list --all

gives this:

Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused

It used to work just fine, no idea why or how libvirt broke. Libvirt can’t connect to either XEN or KVM

I’ve noticed that if I boot without the XEN hypervisor libvirt works well with KVM, also the default virbr0 is initiated, unlike when booting with the hypervisor.
Perhaps the issue is in the grub menu entry?

Looking forward to your ideas!

I’ve never considered trying what you want to do, and a quick Google search doesn’t return any results as well.

The problem is that the Xen hypervisor which requires a custom compiled kernel and the KVM hypervisor which is built into the Linux kernel are fundamentally incompatible, so when libvirt starts up and somehow is configured to access both “servers” will be guaranteed to throw an error every time. This isn’t a problem with other libvirt-supported technologies so practically every other combination is possible and configurable.

I’d recommend generally that you just choose Xen or KVM, and stick with that decision.
Dual-boot two instances of openSUSE, one running the Xen kernel and the other the normal Linux kernel (which supports KVM).


Thanks for your reply, I generally don’t use KVM, so if I understood you correctly I should remove KVM? Thing is that it somehow just broke one day :slight_smile: What would be the best way of performing a clean re-install of XEN?
Perhaps I should mention that I recently installed VirtualBox, which i have to use for work, could that have been an issue?

I haven’t tried to run Virtualbox and Xen on the same machine, but it’s also not likely advisable

In general, as a Type 1 hypervisor, Xen isn’t compatible with any other virtualization but should be OK with “isolation” technologies like Docker and LXC.
Type 2 hypervisor technologies, which in general is everything that’s not Xen should generally play well installed on the same machine although you should never run more than one at once (again, isolation technologies can be run along side, or in virtualized Guests).

I don’t know if trying to remove Xen is worthwhile, just don’t boot to that kernel.
I haven’t tried to “fix” how virtualization is installed on a machine for many years, that is contrary to my personal mantra to do everything possible to make my HostOS as rock solidly reliable as possible.
But, short of a re-install which probably would be recommended if this is a brand new install,
For KVM, if you installed using YaST, then you can try listing your KVM packages and then force re-installing them

zypper se -i kvm
zypper in -f *packages *

Or, if you never used YaST in the first place, then you can try removing (uninstalling) KVM and re-installing.

zypper rm '*kvm*'


Thanks a lot, seems like the issue is Vagrant/VirtualBox since before I never had any issues, will see what I end up with.