Linux In Practice
Linux In Practice

Reputation: 33

KVM - failed to connect to the hypervisor error

I am trying to run kvm, but this error occurs:

$ virsh -c qemu:///system list
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
error: failed to connect to the hypervisor

So I enter to:

cd /var/run/libvirt/

and changed privilages by:

sudo chmod -R +777 libvirt

Everything is working now, but I have concerns about security issues, as privileges for all users and groups is not the safest way to do it? What could you recommend instead?

Upvotes: 3

Views: 20623

Answers (3)

Shiv
Shiv

Reputation: 144

Same error i was getting

enter image description here

Solution this helps:-

#yum groupinstall "Virtualization Host"

#yum install qemu-kvm libvirt libvirt-python libguestfs-tools virt-install

#systemctl enable libvirtd.service

enter image description here

exit the use and re-login

Post above command executed, staring minkube i starting

enter image description here

Upvotes: 0

jeremf
jeremf

Reputation: 672

Add your user to the kvm and libvirtd groups:

sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER

After these group changes you have to logout/login the terminal you are using to have the changes taken into account. The groups you belongs to, can be check with the groups command.

Upvotes: 7

Syed Rizvi
Syed Rizvi

Reputation: 41

I think

sudo usermod -aG libvirt $USER

is the correct command

Upvotes: 3

Related Questions