error: failed to connect to the hypervisor
If this error happens even after starting the libvirtd service, it should be the permission issue.
This can be resolved by adding the user to kvm and libvirt groups.
#usermod -aG kvm USER #usermod -aG libvirt USER
Where USER need to be replaced with the name of the user which tried to execute the virsh commands.