Unable connect to a wireless network when configured to automatically connect using wireguard configuration

I have a problem with connecting to the wireless network that is configured to automatically connect to VPN. I get an error “A secondary connection of the base connection failed”.

The only workaround I found is to disable the setting to automatically connect to VPN, connect manually to the wireless network, and then connect manually to VPN.
Network manager somehow can not do it automatically. The VPN protocol is Wireguard.

I found similar issue but the solution there didn’t help.
Something similar was already asked on Manjaro forum but no solution was found.

Interesting thing I found in journalctl:

$ journalctl -u NetworkManager
Jul 14 18:28:31 user-laptop NetworkManager[625]: <info>  [1657831506.3072] policy: set 'WLANEG' (wlp8s0) as default for IPv4 routing and DNS
Jul 14 18:28:31 user-laptop NetworkManager[625]: <warn>  [1657831506.3140] policy: secondary connection 'myvpn-wg' auto-activation failed: The connection is not a VPN.
Jul 14 18:28:31 user-laptop NetworkManager[625]: <info>  [1657831506.3140] device (wlp8s0): state change: secondaries -> failed (reason 'secondary-connection-failed', sys-iface-state: 'managed')
Jul 14 18:28:31 user-laptop NetworkManager[625]: <info>  [1657831506.3142] manager: NetworkManager state is now DISCONNECTED
Jul 14 18:28:31 user-laptop NetworkManager[625]: <warn>  [1657831506.3144] device (wlp8s0): Activation: failed for connection 'WLANEG'

I wonder why NetworkManager doesn’t recognize my connection as a VPN? I couldn’t find such issue on the internet.

Manjaro KDE 2022-07-12
KDE Plasma Version: 5.24.6
NetworkManager: 1.38.2-1
Kernel: 5.15.53-1

Why I don't use a VPN app instead

My current ISP blocks some VPN servers, therefore I don’t use a VPN app. Instead I use a Wireguard configuration file to connect to certain servers that aren’t blocked. I must say that with a VPN app I had no issues with autoconnect. Only problem is that it searches really long time for a server that isn’t blocked.

I changed the topic title to reflect the real issue - wireguard configuration

This issue reflects precisely your description - wireguard and plasma-nm

1 Like

Thanks for the edit and thanks for finding that issue!
That’s indeed exactly the same problem I’ve faced.
So the problem is that wireguard is supported natively in NetworkManager, therefore it’s not recognized as a VPN and for this reason can’t be set as a secondary connection.

The solution that I found from that same topic is to enable autoconnect for the wireguard connection and decrease the priority of the wireless connection:
$ nmcli connection modify myvpn-wg connection.autoconnect yes
$ nmcli connection modify WLANEG connection.autoconnect-priority 1

Thanks again for helping me out!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.