Why virsh commands are failing with error "Failed to connect socket to libvirt-sock No such file or directory"

Solution Verified - Updated -


  • All virsh commands executed by the user other than root is failing with the error below.
error: failed to connect to the hypervisor
error: Failed to connect socket to '/home/test_user/.cache/libvirt/libvirt-sock': No such file or directory
  • The same virsh command will work if the user runs the command again within 30 seconds.


  • Red Hat Enterprise Linux 7.7.

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content