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:

<p>skp@pecan:~$ ps -ef | grep -i networkmanager<br />
root 1157 1 0 Jun02 ? 00:00:05 NetworkManager<br />
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<br />
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<br />
skp 14082 11788 0 08:44 pts/1 00:00:00 grep --color=auto -i networkmanager</p>

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

<p>skp@pecan:~$ sudo service network-manager stop<br />
network-manager stop/waiting<br />
skp@pecan:~$ ps -ef | grep -i networkmanager<br />
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<br />
skp 14217 11788 0 08:52 pts/1 00:00:00 grep --color=auto -i networkmanager</p>

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

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

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

<br />
NM_SERIAL_DEBUG=3 NetworkManager --no-daemon 2&gt;&amp;1 | tee /tmp/nmserial.txt<br />

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

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


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:

<p>skp@pecan:/etc/NetworkManager/VPN$ dpkg -S /etc/NetworkManager/VPN/<br />
network-manager-pptp: /etc/NetworkManager/VPN/<br />

To get all of the files, I did this:

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

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

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

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 \<br />
network-manager-openconnect network-manager-openvpn network-manager-pptp network-manager-strongswan network-manager-vpnc<br />

Then, I had to reinstall the packages back:

sudo apt-get install  network-manager-iodine network-manager-openconnect \<br />
network-manager-openconnect-gnome network-manager-openvpn \<br />
network-manager-openvpn-gnome network-manager-strongswan \<br />
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:

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


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.