(libvirt/virsh) Start machine from comandline without root

I recently switched from Ubuntu to Manjaro and there seems to be some minor permissions-issue I can’t figure out how to fix. On Ubuntu I used a bash-script to start and stop multiple machines by calling “virsh start MyMachine”. This doesn’t work on Manjaro because it looks like I’m missing some rights to list and start those machines (starting via libvirt-manager works fine as an unprivileged user).

Running “virsh list --all” returns no machines and "virsh start " returns an error: failed to get domain ‘MyMachine’ - both commands work when running with sudo.

I’m already member of the kvm and libvirt group. So any idea what I’m missing here? What additional permissions do I need to set, to use the virsh-command? Or are there any other (scriptable) ways to start my virtual machines without superuser-rights?

$ groups
sys network power libvirt-qemu libvirt lp kvm wheel gedinixan

Virsh wants to connect to your user session but your VMs are probably running in the system session.
It might work if you set this environment variable.


Perfect, thank you - that solved it! For future reference: There is one / missing. So it should be:


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.