Polkit agent + libvirt group (fixes virt-manager connection failure) #4

Merged
yuri merged 7 commits from fix/polkit-agent-libvirt into main 2026-10-27 15:28:59 +01:00
Owner

virt-manager on niri failed: no polkit agent in a bare compositor session.

  • polkit-gnome agent installed + XDG-autostarted for compositor sessions
  • niri module enables libvirtd and adds the user to the libvirt group (no password prompt for qemu:///system; applies after re-login)

Immediate manual fix for the current VM: sudo usermod -aG libvirt yuri && re-login

virt-manager on niri failed: no polkit agent in a bare compositor session. - polkit-gnome agent installed + XDG-autostarted for compositor sessions - niri module enables libvirtd and adds the user to the libvirt group (no password prompt for qemu:///system; applies after re-login) Immediate manual fix for the current VM: sudo usermod -aG libvirt yuri && re-login
yuri added 1 commit 2026-10-27 14:01:32 +01:00
virt-manager on niri/Noctalia failed with 'authentication unavailable:
no polkit agent available to authenticate action org.libvirt.unix.manage'
- bare compositors ship no polkit agent, unlike GNOME/KDE.

Two fixes:
- install_session_prereqs installs polkit-gnome and wires its agent
  .desktop into /etc/xdg/autostart (paths overridable for testing).
- niri module optionally installs the qemu/libvirt stack, enables
  libvirtd, and adds the user to the libvirt group: members manage
  qemu:///system with no polkit prompt at all (the real fix; applies
  after re-login).
yuri added 1 commit 2026-10-27 14:07:50 +01:00
VM run failed: 'No match for argument: polkit-gnome'. polkit-gnome is
orphaned in Fedora (EPEL9 only). polkit-kde 6.6.4 is in F44 and ships its
agent's /etc/xdg/autostart .desktop itself, so the manual symlink wiring
is gone too — installing the package is the whole fix.
yuri added 1 commit 2026-10-27 14:19:27 +01:00
A clean-snapshot run showed qemu/virt-manager installed without choosing
it: PR #4 had embedded the install in the niri module. Removed from there
(zero virt packages in a plain niri run, harness-verified) and moved into
install_category_pkgs Virtualisation: picking qemu/virt-manager there now
also enables libvirtd and adds the user to the libvirt group.
yuri added 1 commit 2026-10-27 14:37:43 +01:00
The VM error persisted with polkit-kde installed: the package's autostart
.desktop carries OnlyShowIn=KDE;, so XDG autostart (which niri honors via
xdg-desktop-autostart.target) skips the agent in a niri session. Package
present, agent never running — exactly the observed behavior.

install_session_prereqs now rewrites the .desktop without the OnlyShowIn
line in place (idempotent: only rewrites when the line is present).
yuri added 1 commit 2026-10-27 14:51:46 +01:00
Second VM failure: Fedora's polkit-kde .desktop carries
X-systemd-skip=true (and OnlyShowIn on some versions), so niri's
xdg-desktop-autostart.target skips the agent regardless — package
installed, agent dead, same error.

Stop fighting .desktop semantics: install a polkit-agent.service USER
unit (WantedBy=graphical-session.target, which niri/Hyprland/Mango all
bring up) with the Fedora kf6 binary path, pre-linked into
graphical-session.target.wants. Idempotent on both file and symlink.
yuri added 1 commit 2026-10-27 15:14:24 +01:00
The error CHANGED on the VM: 'no polkit agent' -> 'access denied by
policy' — the agent unit works; polkit now denies because the user is
not in the libvirt group (fresh run without picking QEMU from the menu,
or no re-login after the pick).

install_session_prereqs now adds the user to the libvirt group whenever
libvirt is installed (idempotent via id -nG check), decoupled from the
advanced-menu choice. Applies after re-login.
yuri added 1 commit 2026-10-27 15:19:09 +01:00
usermod used $USER directly; under sudo $USER can be root. All other
user-scoped calls already use ${SUDO_USER:-$USER} — aligned. No hardcoded
usernames anywhere in the repo (verified by grep; only the dotfiles repo
URL, which is overridable via DOTFILES_REPO).
yuri merged commit 847e76614a into main 2026-10-27 15:28:59 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: yuri/fedora#4