zeauw
March 11, 2026, 4:46pm
1
I’m new in NixOS. I want to set up openvpn with network manager. Here is part of my config:
{ pkgs, ... }:
{
networking.networkmanager = {
enable = true;
plugins = with pkgs; [
networkmanager-openvpn
networkmanager-strongswan
networkmanager-openconnect
];
};
}
After sudo nixos-rebuild boot --flake .#my-device and reboot, I’m trying to import openvpn file:
nmcli connection import type openvpn file ./lab.ovpn
But it shows:
Error: failed to load VPN plugin: unknown VPN plugin "org.freedesktop.NetworkManager.openvpn".
I’m wondering why this happened and how I can set up openvpn correctly.
Is your user in the networkmanager group? Usually, this is required.
zeauw
March 12, 2026, 3:10am
3
Of course the user is in networkmanager group:
> id zeauw
uid=1000(zeauw) gid=986(zeauw) groups=986(zeauw),1(wheel),57(networkmanager),67(libvirtd),301(qemu-libvirtd),302(kvm)
I also tried import it with sudo. But it still failed.
And I can confirm that the plugins were installed well:
> ls /run/current-system/sw/lib/NetworkManager/VPN/
nm-openconnect-service.name nm-openvpn-service.name nm-strongswan-service.name
zeauw
March 12, 2026, 4:07am
4
I’ve solved the problem. The actual problem is I configured the following preservation:
# NetworkManager
"/etc/NetworkManager"
"/var/lib/NetworkManager"
But it prevents the system creating /etc/NetworkManager/VPN due to this will be created before persistent volume was mounted. So I modify the preservation configuration:
# NetworkManager
"/etc/NetworkManager/system-connections"
"/var/lib/NetworkManager"
And it works well now.