Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

virsh list --all as non-root

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
User avatar
abu_bua
Posts: 22
Joined: 2022-02-25 19:30
Has thanked: 13 times
Been thanked: 4 times

virsh list --all as non-root

#1 Post by abu_bua »

On debian system (sid) I cannot access virsh commands without root access.
In contrast when typing

Code: Select all

sudo virsh list --all
I got the correct list of machines.

I already added the user to the libvirt group, but nothing changes.
Last edited by abu_bua on 2022-06-19 23:23, edited 1 time in total.

CwF
Global Moderator
Global Moderator
Posts: 2625
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 190 times

Re: No

#2 Post 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

User avatar
abu_bua
Posts: 22
Joined: 2022-02-25 19:30
Has thanked: 13 times
Been thanked: 4 times

Re: No

#3 Post by abu_bua »

Thanks, that works. I thought that the default connection is always the qemu:///system even for the user.

CwF
Global Moderator
Global Moderator
Posts: 2625
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 190 times

Re: virsh list --all as non-root

#4 Post 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.

CwF
Global Moderator
Global Moderator
Posts: 2625
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 190 times

Re: virsh list --all as non-root

#5 Post by CwF »

Alright, in etc/libvirt/libvirt.conf
uncomment

Code: Select all

#uri_default = "qemu:///system"

User avatar
abu_bua
Posts: 22
Joined: 2022-02-25 19:30
Has thanked: 13 times
Been thanked: 4 times

Re: virsh list --all as non-root

#6 Post by abu_bua »

CwF wrote: 2022-06-20 15:25 Alright, in etc/libvirt/libvirt.conf
uncomment

Code: Select all

#uri_default="qemu:///system"
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.
Last edited by abu_bua on 2022-12-08 22:40, edited 1 time in total.

CwF
Global Moderator
Global Moderator
Posts: 2625
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 190 times

Re: virsh list --all as non-root

#7 Post 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.

User avatar
abu_bua
Posts: 22
Joined: 2022-02-25 19:30
Has thanked: 13 times
Been thanked: 4 times

Re: virsh list --all as non-root

#8 Post 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.

Post Reply