From f34eb45a4020cc860389c15bab3aa399c789e31e Mon Sep 17 00:00:00 2001 From: Alberto Faria Date: Mon, 11 Dec 2023 16:57:50 +0000 Subject: [PATCH] Suppress virsh "Authorization not available." warnings Signed-off-by: Alberto Faria --- src/commands/create/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/commands/create/mod.rs b/src/commands/create/mod.rs index 2da2782..5891848 100644 --- a/src/commands/create/mod.rs +++ b/src/commands/create/mod.rs @@ -444,6 +444,19 @@ fn set_up_extra_container_mounts_and_devices(spec: &mut oci_spec::runtime::Spec) add_bind_mount(spec, path); } + // If virsh runs with a tty and finds an executable at /usr/bin/pkttyagent, it will attempt to + // run it even if polkit auth is disabled, resulting in "Authorization not available. Check if + // polkit service is running or see debug message for more information." messages. + spec.mounts_push( + oci_spec::runtime::MountBuilder::default() + .typ("bind") + .source("/dev/null") + .destination("/usr/bin/pkttyagent") + .options(["bind".to_string(), "rprivate".to_string(), "ro".to_string()]) + .build() + .unwrap(), + ); + add_bind_mount(spec, "/dev/kvm"); add_char_dev(spec, "/dev/kvm")?;