[virt-manager PATCH] Add /usr/sbin to search path for non-root user

Charles Arnold carnold at suse.com
Fri Oct 23 21:20:33 UTC 2020


On a fresh install where no previous connection has been made a
non-root user starting virt-manager won't find the installed libvirtd
because the location is not in the user path.

Signed-off-by: Charles Arnold <carnold at suse.com>
---
 virtManager/lib/connectauth.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/virtManager/lib/connectauth.py b/virtManager/lib/connectauth.py
index cc83e469..71e1b21f 100644
--- a/virtManager/lib/connectauth.py
+++ b/virtManager/lib/connectauth.py
@@ -204,7 +204,8 @@ def connect_error(conn, errmsg, tb, warnconsole):
 ##################################
 
 def setup_first_uri(config, tryuri):
-    libvirtd_installed = bool(shutil.which("libvirtd"))
+    # Add /usr/sbin to the path in case non-root user launches virt-manager
+    libvirtd_installed = bool(shutil.which("libvirtd", path=os.environ['PATH'] + os.pathsep + "/usr/sbin"))
     if config.CLITestOptions.fake_no_libvirtd:
         libvirtd_installed = False
 
-- 
2.26.2





More information about the virt-tools-list mailing list