Bug 333569

Summary: OpenVPN connection is not started when in use with consolekit
Product: [Plasma] plasma-nm Reporter: Felix Tiede <kde>
Component: generalAssignee: Lamarque V. Souza <lamarque>
Status: RESOLVED FIXED    
Severity: normal CC: abulak, jgrulich, johu, lamarque, stupor_scurvy343
Priority: NOR    
Version: 0.9.3.3   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: /etc/init.d/NetworkManager restart (--log-level=INFO)

Description Felix Tiede 2014-04-18 07:30:03 UTC
When using consolekit upon hitting "Connect" of an OpenVPN connection consolekit just logs a failed attempt on reading an already finished task's environ from /proc filesystem and nothing more happens, esp. not connecting to the OpenVPN server.

The very same connection works fine using networkmanagement applet.

Reproducible: Always

Steps to Reproduce:
1. Replace working networkmanagement applet with plasma-nm using consolekit and not systemd
2. Connect to any network
3. Hit "Connect" on a previously working OpenVPN connection
Actual Results:  
Consolekit reports a failed attempt on reading /proc/<pid>/environ. Nothing more happens.

Expected Results:  
Starting of OpenVPN connection.
Comment 1 Jan Grulich 2014-04-22 11:52:09 UTC
That's weird, because there is probably no difference between the old networkmanagement applet and plasma-nm. Both of them use same DBus calls.
Comment 2 abulak 2014-04-22 12:14:14 UTC
Well I can't connect/disconnect via plasmoid at all.
Clicking Connect on a network produces

in .xsession-errors:

NetworkManagerQt "plasma-desktop" ( 3383 ) QDBusPendingReply<QDBusObjectPath> NetworkManager::NetworkManagerPrivate::activateConnection(const QString&, const QString&, const QString&) : Activating connection "/org/freedesktop/NetworkManager/Settings/23" on interface "/org/freedesktop/NetworkManager/Devices/1" with extra "/org/freedesktop/NetworkManager/AccessPoint/1

in /var/log/messages:

console-kit-daemon[2686]: WARNING: Couldn't read /proc/3380/environ: Failed to open file '/proc/3380/environ': No such file or directory
Comment 3 Jan Grulich 2014-04-22 12:25:12 UTC
This doesn't look like a problem in plasma-nm, we just use NetworkManager over DBus. Do you have NetworkManager compiled with consoleKit? I think there is probably such option for that.
Comment 4 abulak 2014-04-22 12:37:37 UTC
Yes I do.

old kde-misc/networkmanagement copes with connections, so if (as You say) plasma-nm uses the same dbus calls, I perceive there is something wrong with 
plasma-nm <--> consolekit glue.
Comment 5 Jan Grulich 2014-04-22 13:45:27 UTC
There is no plasma-nm/networkmanagement <--> consoleKit glue, both talk directly to NetworkManager over DBus, so I'm afraid that the problem is not in plasma-nm. Are you sure you have everything installed properly? Also you can't have installed both applets together.
Comment 6 Felix Tiede 2014-04-22 14:15:15 UTC
I have networkmanager with consolekit support and tried after removal of networkmanagement - Gentoo didn't let me install plasma-nm while networkmanagement was still installed.

I haven't tried any connection except OpenVPN as the Wifi-Link used for VPN was system-wide and started automatically by networkmanager without user interaction.
Comment 7 abulak 2014-04-22 14:24:33 UTC
Felix, have You tried connecting to any non-system-wide network around (or even disconnecting from already connected)?

I am also on Gentoo;
Comment 8 Felix Tiede 2014-04-22 14:40:16 UTC
(In reply to comment #7)
> Felix, have You tried connecting to any non-system-wide network around (or
> even disconnecting from already connected)?

Tried disconnecting VPN - no.
Tried disconnecting underlying Wifi - no.
Tried connecting to previously unseen but open Wifi - no.

All with the same message:
console-kit-daemon[6235]: WARNING: Couldn't read /proc/4933/environ: Failed to open file '/proc/4933/environ': No such file or directory

All I did in this case was replacing networkmanagement with plasma-nm and restarting plasma-desktop. Connecting to the currently running Wifi network worked flawlessly from networkmanagement.
Only thing I've noticed so far is an error about Avahi being unavailable during plasma-desktop restart. And yes, avahi-d* is not (system-)started on this box.
Comment 9 Lamarque V. Souza 2014-04-23 13:33:14 UTC
Hi,

I use Gentoo too but I do not have this problem.  Can you send me NetworkManager's log messages? They are in /var/log/daemong.log.

Please send me the version numbers of networkmanager, networkmanager-openvpn and libnm-qt you are using too.
Comment 10 Lamarque V. Souza 2014-04-23 13:37:59 UTC
(In reply to comment #8)
> All I did in this case was replacing networkmanagement with plasma-nm and
> restarting plasma-desktop. Connecting to the currently running Wifi network
> worked flawlessly from networkmanagement.

You also need to restart kded4 when switching between plasma-nm and networkmamangent and vice versa. Please check which network module kded4 is currently using in systemsettings -> Startup and Shutdown -> Service Manager. There should be a module called "Plasma Networkmanagement module" with "running" status in the lower section of the window (Startup Services).
Comment 11 abulak 2014-04-23 13:55:01 UTC
I have rebooted every networkmanagement <--> plasma-nm change;

net-misc/networkmanager-0.9.8.8
net-misc/networkmanager-openvpn-0.9.8.4
net-libs/libnm-qt-0.9.8.1

I turned on debug option in consolekit, it says:
console-kit-daemon[2629]: DEBUG: CkManager: get session for unix process: 3280
console-kit-daemon[2629]: DEBUG: uid = 103
console-kit-daemon[2629]: DEBUG: pid = 2537
console-kit-daemon[2629]: WARNING: Couldn't read /proc/3280/environ: Failed to open file '/proc/3280/environ': No such file or directory
console-kit-daemon[2629]: DEBUG: CkManager: unable to lookup session for unix process: 3280

However I can see that it contacts kded4 a few times and it does get session;

Upon click Connect/Disconnect NetworkManager doesn't produce any log entries (--log-level=INFO). Which part of NetworkManager log are You interested in?
Comment 12 abulak 2014-04-23 13:56:07 UTC
Created attachment 86230 [details]
/etc/init.d/NetworkManager restart (--log-level=INFO)
Comment 13 Lamarque V. Souza 2014-04-23 15:05:49 UTC
There is no mention of vpn connection attempt in your log. Can you send me the log right after you have tried to activate an openvpn connection?
Comment 14 abulak 2014-04-24 08:09:32 UTC
as I said in the second comment of this bug I can't connect at all;
Moreover comment 8th suggests that this is not VPN related at all.

NM perfectly connects when there is a "connect automatically" network around. Any connect/disconnect action from the new plasmoid has no result.

Btw, do You use systemd?
Comment 15 Lamarque V. Souza 2014-04-24 11:49:44 UTC
No, I do not use systemd. You seem to have permission problems with polkit. What's the output of the command below:

emerge --nodeps -pv polkit polkit-qt consolekit
Comment 16 abulak 2014-04-24 11:53:24 UTC
These are the packages that would be merged, in order:

[ebuild   R    ] sys-auth/polkit                                       [0.112-r1]                    USE="-examples -gtk introspection kde nls pam (-selinux) -systemd" 0 kB
[ebuild   R    ] sys-auth/polkit-qt                                    [0.103.0]                     USE="-debug -examples" 0 kB
[ebuild   R    ] sys-auth/consolekit                                   [0.4.6]                       USE="acl -debug -doc pam (policykit) (-selinux) -systemd-units {-test}" 0 kB
Comment 17 Jan Grulich 2014-06-18 13:43:01 UTC
You can try to activate it using nmcli, it should show you some error if you don't have sufficient permissions. Unfortunately plasma-nm for kde 4 doesn't show you such information, but we added this at least to Plasma Next version.
Comment 18 abulak 2014-06-18 13:45:21 UTC
>  activate it using nmcli,

how should I do it?
Comment 19 Jan Grulich 2014-06-18 13:53:30 UTC
Use "nmcli connection up your_vpn_connection", you can also use tab to invoke autocompletion.
Comment 20 Lamarque V. Souza 2014-06-22 13:23:14 UTC
Also you may try this checklist to see you have missed something in your consolekit configuration:

https://forums.gentoo.org/viewtopic-t-858965.html
Comment 21 abulak 2014-06-24 10:54:41 UTC
I can use nmcli to connect and disconnect with no problems
Comment 22 Jan Grulich 2015-07-28 14:49:31 UTC
Is this issue still reproducible with the latest plasma-nm version?
Comment 23 abulak 2015-07-28 16:25:44 UTC
Currently I use plasma-nm-5.3.2 and have no problems at all