enter image description here

I'm running Ubuntu 12.04.2 32 bits.

The error doesn't show up if I start gksudo virt-manager.

  • libvirt-bin is installed.
  • I don't know how to check for the daemon.
  • I am a member of libvirtd.

Output of ps ax | grep libvirt:

9225 ? Sl 0:04 /usr/sbin/libvirtd -d
9302 ? S 0:00 /usr/sbin/dnsmasq -u libvirt-dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/default.pid --conf-file= --except-interface lo --listen-address --dhcp-range, --dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases --dhcp-lease-max=253 --dhcp-no-override`

Output of ls -l /var/run/libvirt/libvirt-sock:

srwxrwx--- 1 root libvirtd 0 Set 13 15:04 /var/run/libvirt/libvirt-sock

Output of getent group libvirtd:


Detailed error message

Unable to connect to libvirt.   
Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied

Verify that:
 - The 'libvirt-bin' package is installed
 - The 'libvirtd' daemon has been started
 - You are member of the 'libvirtd' group

Libvirt URI is: qemu:///system

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 1185, in _open_thread
    self.vmm = self._try_open()
  File "/usr/share/virt-manager/virtManager/connection.py", line 1167, in _try_open
  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 102, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
  • The error doesn't show up if I start gksudo virt-manager Sep 13, 2013 at 18:52
  • What are the contents of your /etc/libvirt/libvirtd.conf file? Sep 13, 2013 at 19:41
  • 1
    Not the perfect place, but if you're on arch like I am and installed qemu and virt-manager, try running sudo systemctl start libvirtd and optionally sudo systemctl enable libvirtd if you want it to start at startup.
    – ave
    Apr 30, 2017 at 23:15
  • 2
    Add itself to the group libvirt (and reboot): sudo usermod -a -G libvirt <loginname> Aug 6, 2020 at 8:50

19 Answers 19


Rebooting the system where virt-manager is installed solved the issue.

  • 64
    not a typical Linux solution!
    – Sadegh
    Feb 3, 2017 at 9:55
  • 1
    On 16.04 its libvirt-bin .service not libvirtd .service if you wonder. So the daemon is there.
    – Bulat M.
    Mar 11, 2017 at 4:30
  • 4
    Usually just logout/login should be enough in this case to make the group membership changes propagate into current session, but for me personally there's not much difference between relogin and reboot (causes very similar disruption, the reboot takes just about 7s longer), so I rather used reboot "just in case".
    – Ped7g
    Feb 12, 2018 at 12:58
  • 3
    "did you try turning it off and then on again?" Aug 27, 2019 at 2:41
  • 1
    Got this bug with Ubuntu 20.04 (problem with socket is still here). This answer from @Flatron describes the no-reboot solution.
    – dess
    Aug 12, 2020 at 1:31

After installing KVM, run this command then that error will not occur again.

sudo virt-manager
  • whoa!!! What is this, How did this work? Feb 10, 2016 at 6:07
  • 1
    Should be the acepted answer.
    – Magno C
    Mar 13, 2016 at 21:23
  • 2
    It works but needed root to use. I want to use it from normal user. What can i do for it? Apr 29, 2017 at 20:37
  • 12
    As @andrew-grasso states, you need to logout/login for the group membership changes to apply. Using sudo is not recommended. Jun 8, 2017 at 14:34
  • 1
    link to ask fedora is dead now :( Sep 15, 2020 at 20:29

An alternative to reboot/logout is to run the following commands from a terminal:

newgrp libvirt

The newgrp command allows the user to join the libvirt group without logout, for processes that are started in the same shell after newgrp. Of course this only works if the libvirt installer put you in the libvirt group, which you can check with:

getent group libvirt
  • 1
    this works. why isn't this ran by the libvirt/virt-manager post-install script is beyond me Jul 25, 2022 at 15:23
  • This is the best answer. Until the next reboot, when it will work automatically if you are in the group.
    – DiDiev
    Apr 17 at 19:00

For me, the error was caused because group membership changes don't apply without a logout-login (or reboot). I had just installed KVM and libvirt-bin. The installer automatically added my user to the libvirtd group, I had restarted the libvirt-bin service, but I was still getting the error.

Don't change file permissions to 777. Don't just run everything as root or sudo to avoid understanding what's wrong.

Simply logging out and back in resolved the problem by applying my new group membership.

Assuming you just installed libvirt-bin and already confirmed that your current user is a member of the libvirtd group as the error message suggests, you will need to log out and back in for the new group membership to apply.

I hope this helps someone.


I'm managing both Qemu and Virtualbox on my Ubuntu 14.02 machine, and after installing Virtualbox libvirt-bin failed to autostart. So check if libvirt-bin is running:

ps faux | grep libvirt-bin

if you don't see it in ps output - start in manually, then run virt-manager:

sudo service libvirt-bin start


On Ubuntu 16.04.3 LTS

systemctl start virtlogd.socket

was the only answer. The socket has its own daemon. That's unusual.


Logged in user has to be added to libvirt usergroup

sudo usermod -a -G libvirt $USER
  • 1
    Thanks very much.
    – Dan Ortega
    Oct 13, 2021 at 23:26

For me the case was that when using service libvirt-bin status it showed that everything was just running fine though I could not connect like:

    ● libvirt-bin.service - Virtualization daemon
       Loaded: loaded (/lib/systemd/system/libvirt-bin.service; enabled; vendor preset: enabled)
       Active: active (running) since Do 2016-09-22 13:22:16 CEST; 6min ago

In /var/run/libvirt/ there should be these two files:

srwxrwxrwx  1 root libvirtd    0 Sep 22 13:22 libvirt-sock=
srwxrwxrwx  1 root libvirtd    0 Sep 22 13:22 libvirt-sock-ro=

If the sockets are not showing, use service libvirt-bin stop; service libvirt-bin start to completely restart the process. Using service libvirt-bin restart is not sufficient and will not re-create the socket.

The libvirt-bin service can safely be stopped and will not poweroff the guests.


After installing all of the packages stated by the op, you can log out then log back in. Anything that add you to user groups you need to log out and back in to be added to the new groups. It is a minor inconvenience, less of one than rebooting.

This was flagged as not complete however this goes as a general rule for adding your user to a group. A relog is needed, that was the missing part that I did not see here.


The user in libvirt group can run virt-manager and virsh without sudo.

$ sudo gpasswd libvirt -a <username> 
$ cat <<EOF | tee -a ~/.profile
export VIRSH_DEFAULT_CONNECT_URI=qemu:///system 
$ sudo reboot
  • Good answer, just can you explain a little how works your command lines? Please edit your answer
    – damadam
    Dec 27, 2019 at 14:02
  • @damadam so first he adds <username> to the libvirt group so that that user can run virt-manager and virsh without needing to elevate privileges, then he defines the default path to connect to qemu and saves it in a file (in this case .profile) that will be sourced on startup. Then he reboots the system so that the group change will take effect.
    – joshpetit
    Jun 15, 2021 at 3:01

The problem is discussed on Launchpad and the cause of this problem can be solved by installing the xen-utils package (xen-utils-4.4 on Ubuntu 14.04). I previously was getting around this issue by virt-manager through sudo at the command line.

  • xen is similar to kvm wiki.archlinux.org/index.php/KVM, if you already have kvm installed do not install xen. It override my kvm installation and my vms stopped running. when I removed xen back vms started running. Feb 10, 2016 at 7:07

This was solution for me:

sudo apt install libvirt-daemon-system

sudo systemctl start libvirtd

restart system


Various answers allude to the fact that the problem can occur due to group permissions not getting applied to the user running Virtual Machine Manager, and, the accepted answer, noting that reboot fixed the problem, quite possibly depended on reboot to give the user the group permissions on login (though reboot could potentially start services also).

In the case of Ubuntu 20.04.1 installing QEMU/KVM with apt-get did automatically start all services, and ended up resolving strictly by finding out how to give the user running Virtual Machine Manager libvirt group access (even though /etc/group did show that the user was granted the rights).

As others mention, logout/login is usually necessary to register new group permissions, but, in the case of a GNOME graphical desktop using gdm, logout and re-login were not sufficient to grant the GUI user new libvirt group rights. In fact, logging out AND restarting gdm, stopping all instances of the GNOME shell), and, logging back in, was not enough.

In one scenario, the following was effective, and did not require rebooting after installation of libvirt:

  • loginctl terminate-user <user> where is the user logging into GNOME.
  • sudo systemctl restart gdm

The loginctl command was obtained from this answer.

The gdm restart was required because after loginctl was run, the graphical console quit without offering a login screen (leaving only a black screen). It was not determined whether loginctl always kills the graphical login mechanism, but if it does not, then the gdm restart may be superfluous (omitted).

For the record, in the case where this solution worked, libvirt/KVM was installed by installing: bridge-utils, libvirt-daemon-system, qemu-kvm, and virt-manager. This properly started the required services without manual intervention, and automatically assigned group rights to pre-existing users with sudo rights.


I had faced the same issue. try running the virt manager with sudo

sudo virt-manager

I had this same problem and in the detailed error report it talks about lack of permission to the libvirt-sock file. Changing the permission of the file /var/run/libvirt/libvirt-sock to 777 made it work for me.


As of Ubuntu 17.10, I had to also add myself to group libvirt. I had already added myself to libvirtd and did not remove myself from that group. I do not know if both are required or not.

I did this since I noticed the contents of /var/run/libvirt were owned by libvirt instead of by libvirtd.


Easy fix: Go to accounts and change your groups to both of the libvirt groups.


I simply followed this tutorial. What I was missing:

sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service

use Ubuntu Software to uninstall virtual manager, log out, log back in, install virtual manager, and run it normally without using sudo or even using the command line.

  • 2
    You could improve your answer by expanding on why these steps are necessary instead of a simply reinstalling. Or following one of the other answers. From Review
    – J. Starnes
    Dec 20, 2017 at 4:44
  • That's like getting a locksmith to come to your house and drill out the whole lock set with a hole saw. He opens the door and says, "you're in". You pay and he leaves and you have no lock. Sure, that "works"
    – doug65536
    Apr 24, 2020 at 7:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .