5

When trying to connect to a VPN using openvpn through NetworkManager, it fails with

Apr 17 02:03:17 GAMINGSTATION NetworkManager[1922]: <info>  
[1523923397.5294] audit: op="connection-activate" 
uuid="186c555a-dd51-4dc1-97c9-70d93c30713d" name="kit" 
pid=1976 uid=1000 result="fail" reason="Could not find source connection."

However, when using openvpn directly, the connection works.

I found multiple threads suggesting that NetworkManager needs to manage the default network device, but that is the case:

$ nmcli device status
DEVICE       TYPE          STATE                   CONNECTION 
br0          bridge        connected               br0        
enp3s0       ethernet      connected               enp3s0     
lo           loopback       not managed            --  

What could be the issue here?

Note: This question looks very similar to Trouble connecting to VPN using network-manager, while command line works, however that question does not have any useful answers.

  • 2
    +1 for the nmcli device status command. turned out an unmanaged default interface was the issue in my case. – myrdd Oct 1 '18 at 19:39
5

I got this bug even weirder.

$ nmcli c up VPN

Error: Connection activation failed: Could not find source connection.

$ nm-applet # click icon, VPN, VPN

WORKS!

I learned that Network manager first check if it "owns the default route" before it allows VPNs.

Any route will work: You can satisfy it with default route to 127.0.0.1. You can give it default ipv4 route when your vpn gateway is ipv6. It does not care about these little details :)

  • I do the same with nmcli, then I try the nm-applet and neither work despite the fact that they worked before reboot. – jeremiah Oct 26 '18 at 21:54
  • I have the same issue but I could not understand the proposed solution. Sorry for my ignorance about networking but could you give more details about the steps need to be applied for the solution? – Sercan May 3 at 9:40
  • 1
    @Sercan If you enable manual IP configuration (disables DHCP) you can enter a custom gateway IP too. Just use 127.0.0.1 as gateway. Screenshot: fs.fnkr.net/aac1425357b04c11b024 If your VPN is IPv6 it should look similar (except that IPv6 has a black hole subnet that you can use instead of the loopback interface: 100::/64 (100::1 instead of 127.0.0.1/::1). – fnkr May 12 at 11:44
2

I had a long fight for this but this how I managed to find a workaround the issue in Ubuntu 18 using network-manager and GUI:

Download GUI packages

$ sudo apt-get install network-manager-openvpn network-manager-openvpn-gnome

Network manager change [ifupdown] managed=true

$ sudo nano /etc/NetworkManager/NetworkManager.conf
.
.
[ifupdown]
managed=true
.
.

Import config.ovpn from GUI

(Settings -> Network -> VPN -> +)

Check imported connection id from from the connection file that was created automatically. (The file should be named config and id should also be config but they can be something else)

$ sudo grep /etc/NetworkManager/system-connections/config | grep "^id"

Change rendered to NetworkManager and add the new connection id inside the ethernets

$ sudo nano /etc/netplan/01-netcfg.yaml

network:
  version: 2
  rendered: NetworkManager
  ethernets:
    enp0s25:
      dhcp4: yes
    config:
      dhcp4: yes

Apply changes

$ sudo netplan apply

Restart network-manager

$ sudo service network-manager restart

Open the connection either from the GUI or using nmcli

$ nmcli connection up config
  • 1
    It's "renderer" not "rendered" – Jairo Apr 2 at 22:04
0

I had the same issue after upgrading from Ubuntu MATE 16.04 to 18.04. Seems that the upgrading doesn't work perfectly for Network Manager. Initially I had no NM Icon in the panel. After fixing that with installing the nm-applet back to the panel, nothing seemed to work (other than the default NIC connection to my LAN).

Then after digging through other user's posts, I found that the VPN connections I had needed to be upgraded with the OpenSSL updates, which meant I had to pull out the cert,key & ca files from the .p12 I was previously using as the password in the OpenVPN thing in Network Manager wouldn't work anymore. After doing that, it seemed to work but would show no activity on trying to connect, etc.

What got this all going for me was when I set my wired ethernet to "managed" with this:

sudo vi /etc/NetworkManager/NetworkManager.conf

Then change the line managed=false to managed=true

That still didn't do it, but then I turned off IPV6 in the Network Manager settings for the wired connection.

Still no luck, but then it all started to work once I went into the wired connection IPv4 settings and set a default route in there manually (my connection was set to "Manual" and not DHCP). I did all of this on my laptop as well, but since it used a DHCP connection it seems to not require this because it worked without issue right from installation.

Once the default route was set, I then just restarted Network Manager:

 sudo service network-manager restart

Then it worked. And it worked BOTH on CLI and in the NM Applet.

New contributor
k0d3g3ar is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.