Skip to content

Commit

Permalink
Suppress virsh "Authorization not available." warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Alberto Faria <[email protected]>
  • Loading branch information
albertofaria committed Mar 15, 2024
1 parent dac14ae commit f34eb45
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/commands/create/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")?;

Expand Down

0 comments on commit f34eb45

Please sign in to comment.