Fixing PolicyKit Authentication Prompt for NetworkManager on Debian Linux
As a Debian Linux enthusiast who prefers the lightweight XFCE desktop environment, I recently set up a virtual machine (VM) on my laptop using Virtual Machine Manager. With the aim of enabling seamless work across multiple computers, I migrated the virtual hard disk to my Proxmox Hypervisor. However, as I booted up the VM on Proxmox, I encountered an unexpected hurdle.
To my dismay, the system presented me with the following prompts when starting a VPN connection:
System policies preventing control of network connections
System policies preventing control of network connections for all users
Digging into the issue, I found that the problem can be solved with some adjustments to PolicyKit configuration. After locating the relevant file at /etc/polkit-1/rules.d/99-custom-networkmanager.rules
, I added the following rules:
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.NetworkManager.settings.modify.system" ||
action.id == "org.freedesktop.NetworkManager.vpn" ||
action.id == "org.freedesktop.NetworkManager.network-control") &&
(subject.isInGroup("netdev") || subject.isInGroup("sudo"))) {
return polkit.Result.YES;
}
});
Finally, to ensure the changes took effect, I restarted the necessary services:
systemctl restart NetworkManager
systemctl restart polkit
This adjustment should save someone some time and frustration if they encounter a similar issue.
It's worth noting that I do not utilize Gnome-Keyring, which I had removed using the command apt-get autoremove gnome-keyring
. Removing Gnome-Keyring was one of the steps in finding a solution. However, it's important to be aware that removing Gnome-Keyring also means saved passwords of VPN connections will be lost. In my case, I had to reenter those. Interestingly, my mail passwords in Thunderbird remained unaffected.