Page 1 of 1
[Solved] virsh list --all as non-root
Posted: 2022-06-19 21:45
by abu_bua
On debian system (sid) I cannot access
virsh commands without root access.
In contrast when typing
I got the correct list of machines.
I already added the user to the
libvirt group, but nothing changes.
Re: No
Posted: 2022-06-19 22:04
by CwF
Code: Select all
$ virsh -c qemu:///system
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # list --all
Id Name State
-----------------------------------------
single line;
Code: Select all
:~$ virsh -c qemu:///system list --all
Re: No
Posted: 2022-06-19 23:20
by abu_bua
Thanks, that works. I thought that the default connection is always the qemu:///system even for the user.
Re: virsh list --all as non-root
Posted: 2022-06-19 23:26
by CwF
abu_bua wrote: ↑2022-06-19 23:20
I thought that the default connection is always the qemu:///system even for the user.
It can be, I can't remember off hand. I usually reach in, so it's an ip, so I don't set it to local.
Re: virsh list --all as non-root
Posted: 2022-06-20 15:25
by CwF
Alright, in etc/libvirt/libvirt.conf
uncomment
Re: virsh list --all as non-root
Posted: 2022-06-23 13:10
by abu_bua
CwF wrote: ↑2022-06-20 15:25
Alright, in etc/libvirt/libvirt.conf
uncomment
Thank you for showing the setting in the config file. Unfortunately this does not work for me - even after reboot or reloading the daemon. It seems something get wrong with my setup/installation. I think I have to read the whole documentation for qemu/virlib.
Re: virsh list --all as non-root
Posted: 2022-06-23 23:19
by CwF
abu_bua wrote: ↑2022-06-23 13:10
Unfortunately this does not work for me - even after reboot or reloading the daemon. It seems something get wrong with my setup/installation.
I thought about it, and I can't say for sure I've ever tried to make that work. You covered the basics, libvirt group and the uncomment uri declare, that should be it. You could try adding a polkit pkla rule, I'm unclear on that need with virsh.
Or make an alias, launcher, button, scripts, etc that simply includes the local uri. With those tweaks you should be able to eliminate the extra typing. When automating things I like verbosity. I use virsh in those and rarely on the command line. The same uri declare works for virt-viewer.
Re: virsh list --all as non-root
Posted: 2022-12-02 22:29
by abu_bua
Solution:
All you have to do is
Code: Select all
cp /etc/libvirt/libvirt.conf ~/.config/libvirt/
and set here the variables.
Re: virsh list --all as non-root
Posted: 2024-04-12 17:10
by mule_ear
I create an account just to say thanks. That worked:
I copied `libvirt.conf`
cp /etc/libvirt/libvirt.conf ~/.config/libvirt/
then uncommented
uri_default = "qemu:///system"
That was driving me nuts. Yeah I can use
sudo as a workaround, but that's not how I want to do it.
Re: virsh list --all as non-root
Posted: 2024-04-13 07:30
by Aki
EDIT Sat Apr 13 09:30:38 CEST 2024: marked as "Solved".
Re: [Solved] virsh list --all as non-root
Posted: 2024-04-13 09:18
by barlafuss
interesting, thanks