Month: June 2013

Fixing the VPN on Ubuntu 13.04

None my VPNs have worked since I installed Ubuntu 13.04.  Something is missing for some reason.  I found a couple posts that gave some clues, so I thought I would take notes as I walked through it.

The Symptoms

First, when I try to connect, I got an error message about VPN secrets: “VPN Connection Failed: The VPN connection ‘<connection name>’ failed because there were no valid VPN secrets.”

VPN Failed Error Message

Then, when I tried to configure it, I got this message:  “Could not edit connection: Could not find VPN plugin service for ‘org.freedesktop.NetworkManager.pptp’.”

VPN Connection Edit Error Message


I found someone who did some troubleshooting on the Arch Linux Forums.  I thought it would be a good attempt to try to figure out if the same thing was happening to me.

First, just out of curiousity, I wanted to see what process instance and what parameters were being used for Network Manager.  Here’s the process:

skp@pecan:~$ ps -ef | grep -i networkmanager
root 1157 1 0 Jun02 ? 00:00:05 NetworkManager
root 1847 1157 0 Jun02 ? 00:00:00 /sbin/dhclient -d -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /run/sendsigs.omit.d/ -lf /var/lib/NetworkManager/ -cf /var/lib/NetworkManager/dhclient-wlan0.conf wlan0
nobody 2010 1157 0 Jun02 ? 00:00:01 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/NetworkManager/ --listen-address= --conf-file=/var/run/NetworkManager/dnsmasq.conf --cache-size=0 --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d
skp 14082 11788 0 08:44 pts/1 00:00:00 grep --color=auto -i networkmanager

Then, I stopped the service with “service network-manager stop”:

skp@pecan:~$ sudo service network-manager stop
network-manager stop/waiting
skp@pecan:~$ ps -ef | grep -i networkmanager
nobody 2010 1 0 Jun02 ? 00:00:01 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/NetworkManager/ --listen-address= --conf-file=/var/run/NetworkManager/dnsmasq.conf --cache-size=0 --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d
skp 14217 11788 0 08:52 pts/1 00:00:00 grep --color=auto -i networkmanager

Then, I found the UUID of my VPN connection with this command:

skp@pecan:~$ sudo cat /etc/NetworkManager/system-connections/<Wireless SID redacted> | grep uuid
<em id="__mceDel">uuid=1a31c85c-2808-4bae-8651-2c618f8972e8

Finally, I started Network Manager with debugging enabled like this:

NM_SERIAL_DEBUG=3 NetworkManager --no-daemon 2>&1 | tee /tmp/nmserial.txt

When I try to connect to the VPN, I get this in the debug log:

NetworkManager[14317]: <info> Starting VPN service 'pptp'...
NetworkManager[14317]: <info> VPN service 'pptp' started (org.freedesktop.NetworkManager.pptp), PID 15299
NetworkManager[14317]: <info> VPN service 'pptp' appeared; activating connections
NetworkManager[14317]: <error> [1370269072.212221] [nm-vpn-connection.c:1374] get_secrets_cb(): Failed to request VPN secrets #2: (6) No agents were available for this request.
NetworkManager[14317]: <info> Policy set '<Wireless SID redacted>' (wlan0) as default for IPv4 routing and DNS.
NetworkManager[14317]: <info> VPN service 'pptp' disappeared


I copied the /etc/NetworkManager/VPN directory when I restored my backups.  Looking back, I shouldn’t have done that.

So, I decided to see what package those files belong to:

skp@pecan:/etc/NetworkManager/VPN$ dpkg -S /etc/NetworkManager/VPN/
network-manager-pptp: /etc/NetworkManager/VPN/

To get all of the files, I did this:

skp@pecan:/etc/NetworkManager/VPN$ for f in `ls /etc/NetworkManager/VPN/*`; do dpkg -S $f ; done
network-manager-iodine: /etc/NetworkManager/VPN/
network-manager-openconnect: /etc/NetworkManager/VPN/
network-manager-openvpn: /etc/NetworkManager/VPN/
network-manager-pptp: /etc/NetworkManager/VPN/
network-manager-strongswan: /etc/NetworkManager/VPN/
network-manager-vpnc: /etc/NetworkManager/VPN/

So, I deleted (or moved) those files and reinstalled the packages:

skp@pecan:/etc/NetworkManager/VPN$ mkdir $HOME/Downloads/VPN
skp@pecan:/etc/NetworkManager/VPN$ sudo mv /etc/NetworkManager/VPN/* $HOME/Downloads/VPN/
[sudo] password for skp:</pre>
skp@pecan:~$ sudo apt-get install --reinstall network-manager-iodine network-manager-openconnect network-manager-openvpn network-manager-pptp network-manager-strongswan network-manager-vpnc
[sudo] password for skp:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
 kde-l10n-engb wine-gecko1.9:i386
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 6 reinstalled, 0 to remove and 0 not upgraded.
Need to get 22.6 kB/120 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 raring/main network-manager-pptp amd64 [22.6 kB]
Fetched 22.6 kB in 0s (78.3 kB/s)
(Reading database ... 266755 files and directories currently installed.)
Preparing to replace network-manager-iodine 0.0.3-1ubuntu2 (using .../network-manager-iodine_0.0.3-1ubuntu2_amd64.deb) ...
Unpacking replacement network-manager-iodine ...
Preparing to replace network-manager-openconnect (using .../network-manager-openconnect_0.9.6.0-0ubuntu2_amd64.deb) ...
Unpacking replacement network-manager-openconnect ...
Preparing to replace network-manager-openvpn (using .../network-manager-openvpn_0.9.6.0-0ubuntu3_amd64.deb) ...
Unpacking replacement network-manager-openvpn ...
Preparing to replace network-manager-pptp (using .../network-manager-pptp_0.9.6.0-0ubuntu2_amd64.deb) ...
Unpacking replacement network-manager-pptp ...
Preparing to replace network-manager-vpnc (using .../network-manager-vpnc_0.9.6.0-0ubuntu2_amd64.deb) ...
Unpacking replacement network-manager-vpnc ...
Preparing to replace network-manager-strongswan 1.3.0-0ubuntu1 (using .../network-manager-strongswan_1.3.0-0ubuntu1_amd64.deb) ...
Unpacking replacement network-manager-strongswan ...
Setting up network-manager-iodine (0.0.3-1ubuntu2) ...
Setting up network-manager-openconnect ( ...
Setting up network-manager-openvpn ( ...
Setting up network-manager-pptp ( ...
Setting up network-manager-vpnc ( ...
Setting up network-manager-strongswan (1.3.0-0ubuntu1) ...

That didn’t seem to do the trick.  The VPN directory was still empty and the VPN would not connect.

Completely Removing

So, I used the purge command to completely remove the VPN packages:

sudo apt-get purge network-manager-iodine \
network-manager-openconnect network-manager-openvpn network-manager-pptp network-manager-strongswan network-manager-vpnc

Then, I had to reinstall the packages back:

sudo apt-get install  network-manager-iodine network-manager-openconnect \
network-manager-openconnect-gnome network-manager-openvpn \
network-manager-openvpn-gnome network-manager-strongswan \
network-manager-vpnc network-manager-vpnc-gnome

After that it worked!

What Was the Difference?

I compared the files and they were identical.  The one thing that I noticed was different was the permissions on the files:

skp@pecan:~$ ls -l /etc/NetworkManager/VPN/
total 24
-rw-r--r-- 1 root root 203 Apr 10 08:06
-rw-r--r-- 1 root root 252 Apr 10 08:00
-rw-r--r-- 1 root root 264 Apr 10 10:13
-rw-r--r-- 1 root root 248 Feb 26 04:26
-rw-r--r-- 1 root root 223 Jun 29 2012
-rw-r--r-- 1 root root 248 Apr 10 10:08
skp@pecan:~$ ls -l ~/Downloads/VPN
total 72
-rw-r--r-- 1 root root 203 Apr 10 08:06
-rw------- 1 root root 252 May 27 17:30
-rw-r--r-- 1 root root 264 Apr 10 10:13
-rw------- 1 root root 248 May 27 17:30
-rw-r--r-- 1 root root 223 Jun 29 2012
-rw------- 1 root root 248 May 27 17:30


First, when restoring network connections from a backup, only restore the /etc/NetworkManager/system-connections directory.  The VPN directory gets installed with the VPN packages.

Second, the fix was to completely remove the packages.  I had to use the purge command.  The reinstall option didn’t recreate the files that I was missing.

Finally, my problem was the permissions in the /etc/NetworkManager/VPN/* directory.