10

I have been following this link https://help.ubuntu.com/community/KVM/Installation to install KVM on Ubuntu 18.04.1 LTS. But I cannot start it properly and encounter the following errors.

$ virsh list --all
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': 
       No such file or directory

The directory /var/run/libvirt/libvirt-sock indeed does not contain libvirt-sock

$ ls /var/run/libvirt
network  storage  virtlockd-sock  virtlogd-sock

What are the solutions to this issue? and how can I install KVM properly? Many Thanks

K_inverse
  • 203

1 Answers1

8

The sockets are a special type of file that should get created when the libvirt daemon starts. My guess is, libvirtd is not running - to start it, try:

systemctl start libvirtd

To check it's status, try:

systemctl status libvirtd

It may also not be enabled, therefore would not run by default on reboot - you can fix this with:

systemctl enable libvirtd
cleary
  • 674
  • Thanks. Checking the status systemctl status libvirtd gives three errors. 1. Failed to parse user 'libvirt-qemu' 2. Initialization of QEMU state driver failed 3. Driver state initialization failed. The errors are still here even after enable – K_inverse Sep 06 '18 at 08:35
  • 2
    Ok, so there's a bit of info on your error in this bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=768000 - the washup, make sure the libvirt-daemon-system pkg is installed. It should have installed automatically, but it is not explicitly a dependency (just a recommends). You can check that with apt depends virt-manager – cleary Sep 06 '18 at 23:42
  • I have libvirt-daemon-system installed. But still don't know what is the issue – K_inverse Sep 07 '18 at 03:43
  • I guess at this point you're just going to need to create the user yourself, and apply membership appropriately. It's covered in this post in the bug I linked earlier: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=768000#10 – cleary Sep 07 '18 at 04:50
  • I tried to follow the link to create users and add groups, but the errors are still here. – K_inverse Sep 10 '18 at 09:02
  • Did you try to start the libvirtd service again? – cleary Sep 10 '18 at 23:19
  • In case it helps anyone else, I needed to install libvirt-daemon-kvm (on Fedora 33) after virt-manager quit connecting on me. Thanks for the help. – user8675309 Dec 11 '20 at 16:21