1

I'm trying to set up two different machines with the same VPN client configuration. Both machines run Ubuntu 20.04, one is without X (Machine B).

Here my NetworkManager configuration file that works on machine A:

[connection]
id=myVPN
uuid=blabla-blabla-blabla
type=vpn
autoconnect=false
permissions=user:mark:;

[vpn]
IKE DH Group=dh2
IPSec ID=myID
IPSec gateway=myGateway
IPSec secret-flags=1
Local Port=0
NAT Traversal Mode=natt
Perfect Forward Secrecy=server
Vendor=cisco
Xauth password-flags=1
Xauth username=myUser
ipsec-secret-type=save
xauth-password-type=save
service-type=org.freedesktop.NetworkManager.vpnc

[ipv4]
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto

[proxy]

I copied this file to machine B and issued:

$ sudo nmcli connection import type vpn file myVPN.nmconnection
Error: failed to find VPN plugin for vpn

I checked for packages on both machines:

Machine A

$ dpkg -l | grep network-manager
ii  network-manager                                   1.22.10-1ubuntu2.2                              amd64        network management framework (daemon and userspace tools)
ii  network-manager-config-connectivity-ubuntu        1.22.10-1ubuntu2.2                              all          NetworkManager configuration to enable connectivity checking
ii  network-manager-gnome                             1.8.24-1ubuntu3                                 amd64        network management framework (GNOME frontend)
ii  network-manager-openvpn                           1.8.12-1                                        amd64        network management framework (OpenVPN plugin core)
ii  network-manager-openvpn-gnome                     1.8.12-1                                        amd64        network management framework (OpenVPN plugin GNOME GUI)
ii  network-manager-pptp                              1.2.8-2                                         amd64        network management framework (PPTP plugin core)
ii  network-manager-pptp-gnome                        1.2.8-2                                         amd64        network management framework (PPTP plugin GNOME GUI)
ii  network-manager-vpnc                              1.2.6-2                                        amd64        network management framework (VPNC plugin core)
ii  network-manager-vpnc-gnome                        1.2.6-2                                        amd64        network management framework (VPNC plugin GNOME GUI)

Machine B

$ dpkg -l | grep network-manager
ii  network-manager                            1.22.10-1ubuntu2.2                    amd64        network management framework (daemon and userspace tools)
ii  network-manager-config-connectivity-ubuntu 1.22.10-1ubuntu2.2                    all          NetworkManager configuration to enable connectivity checking
ii  network-manager-openvpn                    1.8.12-1                              amd64        network management framework (OpenVPN plugin core)
ii  network-manager-pptp                       1.2.8-2                               amd64        network management framework (PPTP plugin core)
ii  network-manager-vpnc                       1.2.6-2                                        amd64        network management framework (VPNC plugin core)

As you can see, they are identical except the GUI packages that I don't need on the headless machine.

Is there any other packages (not from network-manager-*) that I need to install on Machine B?

UPDATE

Things getting worst. On Machine A, where the connection above lives and runs fine I issued the following commands:

$ nmcli connection export myVPN ~/export-myVPN
$ nmcli connection import type vpn file ~/export-myVPN
Error: failed to find VPN plugin for vpn

Wow! It cannot import the file it has just exported on the same machine!

The help says:

$ nmcli connection import --help
Usage: nmcli connection import { ARGUMENTS | help }

ARGUMENTS := [--temporary] type <type> file <file to import>

Import an external/foreign configuration as a NetworkManager connection profile.
The type of the input file is specified by type option.
Only VPN configurations are supported at the moment. The configuration
is imported by NetworkManager VPN plugins.

So I also tried with type VPN with no chance. I don't want to believe I must install Gnome only to configure the VPN using the GUI.

UPDATE 2

I spent several hours but I was not able to import the file even on the same machine that exported it (with full Gnome installed).

So I did the following - ugly - workaround:

  1. install gnome-session gdm3 network-manager-gnome
  2. from the GUI frontend import the very same file I was trying to import using nmcli
  3. remove the above packages
  4. run the new VPN connection using nmcli
6
  • org.freedesktop... this is gnome data bus, install openvpn-gnome even though you have no desktop or remove this line.
    – Yvain
    Oct 10, 2021 at 9:57
  • @Yvain the package openvpn-gnome does not exist. If you meant network-manager-openvpn-gnome it does not solve the problem
    – Mark
    Oct 10, 2021 at 10:22
  • @Yvain You suggest to remove the line: is not mandatory to set the service-type then?
    – Mark
    Oct 10, 2021 at 10:23
  • Since the service-type is refered as a gnome data bus object, it means that you need gnome if using this line. My guess would have been to remove the line and see what it says. Otherwise, when installing network-manager-openvpn-gnome, does it install gnome itself ? The package on its own would be useless but I doubt linux aptitude would leave you with a broken package so then it must have installed it.
    – Yvain
    Oct 10, 2021 at 12:35
  • network manager is part of gnome, installing gnome doesn't mean installing gnome desktop. I duckduckgoed mmcli vpn and found this link: developer-old.gnome.org/NetworkManager/stable/… The point is not about reading the article but just showing that NetworkManager is a gnome application, with a cli interface in case you have no desktop. Please install gnome.
    – Yvain
    Oct 10, 2021 at 12:39

1 Answer 1

1

Not sure about 20.04, but on 22.04 the type seems to be openvpn not vpn.

e.g. nmcli connection import type openvpn file ~/export-myVPN works for me, but using vpn does not.

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.