[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cannot run virt-manager as my user
From: |
Ruijie Yu |
Subject: |
Re: Cannot run virt-manager as my user |
Date: |
Mon, 29 May 2023 12:40:33 +0800 |
On May 29, 2023, at 10:49, Robby Zambito <contact@robbyzambito.me> wrote:
>
> Hi,
>
> I am trying to set up virt-manager on my system in order to set up some
> virtual machines. I added the libvirtd service to my system by adding
> the following service to my system configuration:
>
> ```
> (service libvirt-service-type)
> ```
>
> and I've added myself to the libvirt group.
>
> I can see the service running when I do:
>
> ```
> robby@lambda ~$ sudo herd status libvirtd
> Status of libvirtd:
> It is running since 10:34:29 PM (5 minutes ago).
> Running value is 256.
> It is enabled.
> Provides (libvirtd).
> Requires ().
> Will be respawned.
> ```
>
> I can see the libvirt-sock file that I should be able to use:
>
> ```
> robby@lambda ~$ groups
> users libvirt netdev audio video dialout wheel
> robby@lambda ~$ ll /var/run/libvirt/libvirt-sock
> srwxrwx--- 1 root libvirt 0 May 28 22:34 /var/run/libvirt/libvirt-sock
> ```
>
> But I cannot use virt-manager or virsh as my user. I see the following
> behavior using virsh:
>
> ```
> robby@lambda ~$ virsh -c qemu:///system
> error: failed to connect to the hypervisor
> error: internal error: Unable to get system bus connection: Could not
> connect: No such file or directory
> robby@lambda ~$ sudo virsh -c qemu:///system
> Welcome to virsh, the virtualization interactive terminal.
>
> Type: 'help' for help with commands
> 'quit' to quit
>
> virsh #
> ```
>
> So I can use virsh while running as root - but I should also be able to
> use it when running as my user...
>
> When I try to connect using virt-manager, I see the following similar error:
>
> ```
> Unable to connect to libvirt qemu:///system.
>
> internal error: Unable to get system bus connection: Could not connect: No
> such file or directory
>
> Libvirt URI is: qemu:///system
>
> Traceback (most recent call last):
> File
> "/gnu/store/sa4wwfmvlrry69gyilhb961gpbbamayf-virt-manager-4.1.0/share/virt-manager/virtManager/connection.py",
> line 923, in _do_open
> self._backend.open(cb, data)
> File
> "/gnu/store/sa4wwfmvlrry69gyilhb961gpbbamayf-virt-manager-4.1.0/share/virt-manager/virtinst/connection.py",
> line 171, in open
> conn = libvirt.openAuth(self._open_uri,
> File
> "/gnu/store/nb6yaafwa44jqfg9s5fbr5nbsa46panm-python-libvirt-8.6.0/lib/python3.10/site-packages/libvirt.py",
> line 147, in openAuth
> raise libvirtError('virConnectOpenAuth() failed')
> libvirt.libvirtError: internal error: Unable to get system bus
> connection: Could not connect: No such file or directory
> ```
>
> Since this seems to be an issue relating to dbus, here are the following
> services I have running related to that:
>
> At a system level:
> ```
> (service dbus-root-service-type)
> (service elogind-service-type)
> ```
>
> As my user:
> ```
> (service home-dbus-service-type)
> ```
>
> Maybe there is some conflict between running dbus as my user and as
> root?
>
> Any advice for getting virt-manager working would be greatly
> appreciated!
>
> Thanks,
> Robby
>
Does it work on a new tty, or if you explicitly run `sg libvirt …`? If so, the
only thing you need is a new terminal window with you on the libvirt group. If
that doesn’t work, try rebooting as well.