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

Troubleshooting

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:

[sourcecode]

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/network-manager.dhclient-wlan0.pid -lf /var/lib/NetworkManager/dhclient-a01df2ba-ec6b-4524-bf12-00ca1a01b65b-wlan0.lease -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/dnsmasq.pid –listen-address=127.0.1.1 –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

[/sourcecode]

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

[sourcecode]

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/dnsmasq.pid –listen-address=127.0.1.1 –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

[/sourcecode]

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

[sourcecode]

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

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

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

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

[sourcecode]

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
[/sourcecode]

Reinstalling

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:

[sourcecode]

skp@pecan:/etc/NetworkManager/VPN$ dpkg -S /etc/NetworkManager/VPN/nm-pptp-service.name
network-manager-pptp: /etc/NetworkManager/VPN/nm-pptp-service.name
[/sourcecode]

To get all of the files, I did this:

[sourcecode]

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

[/sourcecode]

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

[sourcecode]

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 http://us.archive.ubuntu.com/ubuntu/ raring/main network-manager-pptp amd64 0.9.6.0-0ubuntu2 [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 0.9.6.0-0ubuntu2 (using …/network-manager-openconnect_0.9.6.0-0ubuntu2_amd64.deb) …
Unpacking replacement network-manager-openconnect …
Preparing to replace network-manager-openvpn 0.9.6.0-0ubuntu3 (using …/network-manager-openvpn_0.9.6.0-0ubuntu3_amd64.deb) …
Unpacking replacement network-manager-openvpn …
Preparing to replace network-manager-pptp 0.9.6.0-0ubuntu2 (using …/network-manager-pptp_0.9.6.0-0ubuntu2_amd64.deb) …
Unpacking replacement network-manager-pptp …
Preparing to replace network-manager-vpnc 0.9.6.0-0ubuntu2 (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 (0.9.6.0-0ubuntu2) …
Setting up network-manager-openvpn (0.9.6.0-0ubuntu3) …
Setting up network-manager-pptp (0.9.6.0-0ubuntu2) …
Setting up network-manager-vpnc (0.9.6.0-0ubuntu2) …
Setting up network-manager-strongswan (1.3.0-0ubuntu1) …
[/sourcecode]

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:

[sourcecode]sudo apt-get purge network-manager-iodine \
network-manager-openconnect network-manager-openvpn network-manager-pptp network-manager-strongswan network-manager-vpnc
[/sourcecode]

Then, I had to reinstall the packages back:

[sourcecode]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[/sourcecode]

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:

[sourcecode]</pre>
skp@pecan:~$ ls -l /etc/NetworkManager/VPN/
total 24
-rw-r–r– 1 root root 203 Apr 10 08:06 nm-iodine-service.name
-rw-r–r– 1 root root 252 Apr 10 08:00 nm-openconnect-service.name
-rw-r–r– 1 root root 264 Apr 10 10:13 nm-openvpn-service.name
-rw-r–r– 1 root root 248 Feb 26 04:26 nm-pptp-service.name
-rw-r–r– 1 root root 223 Jun 29 2012 nm-strongswan-service.name
-rw-r–r– 1 root root 248 Apr 10 10:08 nm-vpnc-service.name
skp@pecan:~$ ls -l ~/Downloads/VPN
total 72
-rw-r–r– 1 root root 203 Apr 10 08:06 nm-iodine-service.name
-rw——- 1 root root 252 May 27 17:30 nm-openconnect-service.name
-rw-r–r– 1 root root 264 Apr 10 10:13 nm-openvpn-service.name
-rw——- 1 root root 248 May 27 17:30 nm-pptp-service.name
-rw-r–r– 1 root root 223 Jun 29 2012 nm-strongswan-service.name
-rw——- 1 root root 248 May 27 17:30 nm-vpnc-service.name
[/sourcecode]

Conclusion

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.

Resources