linux-cli icon indicating copy to clipboard operation
linux-cli copied to clipboard

Unable to connect to ProtonVPN: Exception: NM.Client.activate_connection_finish() takes exactly 2 arguments and VPNConnectionStateEnum.NEEDS_CREDENTIALS - Reason: VPNConnectionReasonEnum.NOT_PROVIDED

Open mingchen opened this issue 3 years ago • 16 comments

OS: Debian 10 Buster 64bit

$ protonvpn-cli -v

ProtonVPN CLI v3.8.0 (protonvpn-nm-lib v3.3.2; proton-client v0.5.1)

Reproduce steps:

  1. Login
  2. Repeat connect and disconnect, first a few times it is ok, then it can not connect to VPN: 2.1 connect -r 2.2 disconnect 2.3 wait a while

A script to reproduce this issue.

while [ true ] ; do
  protonvpn-cli c -r 
  protonvpn-cli d
  sleep 60
done

protonvpn-cli connect report following error:

Unable to connect to ProtonVPN: ProtonVPN connection failed due to unknown reason.

Related log

$ tail ~/.cache/protonvpn/logs/protonvpn.log
18:34:13,937 — nm_client.py — INFO — connect:89 — Starting VPN connection
18:34:13,937 — nm_client.py — INFO — __get_protonvpn_connection:173 — Getting VPN from "NetworkManagerConnectionTypeEnum.ALL" connections
18:34:13,938 — nm_client.py — INFO — __get_protonvpn_connection:209 — VPN connection: <NM.RemoteConnection object at 0x7f7584bedea0 (NMRemoteConnection at 0x2e4b320)>
18:34:13,938 — nm_client_mixin.py — INFO — _start_connection_async:29 — Starting VPN connection
18:34:13,949 — nm_client_mixin.py — INFO — __dynamic_callback:90 — Callback type: "start"
18:34:13,949 — nm_client_mixin.py — ERROR — __dynamic_callback:124 — Exception: NM.Client.activate_connection_finish() takes exactly 2 arguments (1 given)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/connection_backend/nm_client/nm_client_mixin.py", line 117, in __dynamic_callback
    (callback_type_dict[callback_type]["finish_function"])(result)
TypeError: NM.Client.activate_connection_finish() takes exactly 2 arguments (1 given)
18:34:14,131 — monitor_vpn_connection_start.py — INFO — vpn_signal_handler:127 — Adding listener to active ProtonVPN JP-FREE#3 connection at /org/freedesktop/NetworkManager/ActiveConnection/40
18:34:14,148 — monitor_vpn_connection_start.py — INFO — on_vpn_state_changed:48 — State: VPNConnectionStateEnum.NEEDS_CREDENTIALS - Reason: VPNConnectionReasonEnum.NOT_PROVIDED
18:34:14,159 — monitor_vpn_connection_start.py — INFO — on_vpn_state_changed:48 — State: VPNConnectionStateEnum.FAILED - Reason: VPNConnectionReasonEnum.SECRETS_WERE_NOT_PROVIDED
18:34:14,159 — monitor_vpn_connection_start.py — ERROR — on_vpn_state_changed:102 — State: VPNConnectionStateEnum.FAILED ; ReasonVPNConnectionReasonEnum.UNKNOWN_ERROR ; Message: ProtonVPN connection failed due to unknown reason.
18:34:14,159 — monitor_vpn_connection_start.py — INFO — on_vpn_state_changed:107 — Quitting loop on failed ProtonVPN connection
18:34:14,159 — nm_client.py — INFO — connect:105 — Restoring kill switch to previous state
18:34:14,160 — killswitch.py — INFO — update_from_user_configuration_menu:95 — Update from menu killswitch action: KillswitchStatusEnum.SOFT
18:34:14,175 — killswitch.py — INFO — get_status_connectivity_check:604 — Conn check available (0) - Conn check enabled (0)
18:34:14,193 — killswitch.py — INFO — update_connection_status:531 — Tracker info: {'pvpn-killswitch': {<KillSwitchInterfaceTrackerEnum.EXISTS: 0>: False, <KillSwitchInterfaceTrackerEnum.IS_RUNNING: 1>: False}, 'pvpn-routed-killswitch': {<KillSwitchInterfaceTrackerEnum.EXISTS: 0>: False, <KillSwitchInterfaceTrackerEnum.IS_RUNNING: 1>: False}}
18:34:14,219 — killswitch.py — INFO — update_connection_status:531 — Tracker info: {'pvpn-killswitch': {<KillSwitchInterfaceTrackerEnum.EXISTS: 0>: False, <KillSwitchInterfaceTrackerEnum.IS_RUNNING: 1>: False}, 'pvpn-routed-killswitch': {<KillSwitchInterfaceTrackerEnum.EXISTS: 0>: False, <KillSwitchInterfaceTrackerEnum.IS_RUNNING: 1>: False}}
18:34:14,245 — killswitch.py — INFO — update_connection_status:531 — Tracker info: {'pvpn-killswitch': {<KillSwitchInterfaceTrackerEnum.EXISTS: 0>: False, <KillSwitchInterfaceTrackerEnum.IS_RUNNING: 1>: False}, 'pvpn-routed-killswitch': {<KillSwitchInterfaceTrackerEnum.EXISTS: 0>: False, <KillSwitchInterfaceTrackerEnum.IS_RUNNING: 1>: False}}
18:34:14,246 — nm_client.py — INFO — __get_protonvpn_connection:173 — Getting VPN from "NetworkManagerConnectionTypeEnum.ACTIVE" connections
18:34:14,246 — nm_client.py — INFO — __get_protonvpn_connection:209 — VPN connection: <NM.RemoteConnection object at 0x7f7584bedea0 (NMRemoteConnection at 0x2e4b320)>
18:34:14,246 — nm_client_mixin.py — INFO — _remove_connection_async:45 — Removing VPN connection
18:34:14,253 — nm_client_mixin.py — INFO — __dynamic_callback:90 — Callback type: "remove"
18:34:14,254 — nm_client_mixin.py — ERROR — __dynamic_callback:124 — Exception: 'remove'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/connection_backend/nm_client/nm_client_mixin.py", line 117, in __dynamic_callback
    (callback_type_dict[callback_type]["finish_function"])(result)
KeyError: 'remove'
18:34:14,257 — nm_client.py — INFO — _post_disconnect:232 — Running post disconnect.
18:34:14,257 — dbus_reconnect.py — INFO — stop_daemon_reconnector:74 — Stopping daemon reconnector
18:34:14,257 — dbus_reconnect.py — INFO — check_daemon_reconnector_status:122 — Checking daemon reconnector status
18:34:14,266 — ipv6_leak_protection.py — INFO — manage:54 — Manage IPV6: KillSwitchActionEnum.DISABLE
18:34:14,268 — ipv6_leak_protection.py — INFO — get_status_connectivity_check:260 — Conn check available (0) - Conn check enabled (0)
18:34:14,277 — ipv6_leak_protection.py — INFO — update_connection_status:219 — IPv6 status: {'pvpn-ipv6leak-protection': {<KillSwitchInterfaceTrackerEnum.EXISTS: 0>: True, <KillSwitchInterfaceTrackerEnum.IS_RUNNING: 1>: False}}
18:34:14,277 — ipv6_leak_protection.py — INFO — remove_leak_protection:108 — Removing IPv6 leak protection
18:34:14,286 — ipv6_leak_protection.py — INFO — update_connection_status:219 — IPv6 status: {'pvpn-ipv6leak-protection': {<KillSwitchInterfaceTrackerEnum.EXISTS: 0>: True, <KillSwitchInterfaceTrackerEnum.IS_RUNNING: 1>: False}}
18:34:14,364 — default_connection_metadata.py — INFO — save_connect_time:69 — Saved connected time to file

mingchen avatar Aug 13 '21 20:08 mingchen

Same on Archlinux.

Python: 3.9.6 ProtonVPN: 3.8.0

This has the added "benefit" of killing my network connection and i have to open nmtui (or similar) and reconnect. I am on a wired connection...

allora avatar Aug 16 '21 06:08 allora

Hey @mingchen

The network Manager logs would help here more.

calexandru2018 avatar Aug 16 '21 06:08 calexandru2018

fwiw this is what mine looks like:

Aug 15 23:52:13 rufus NetworkManager[95345]: <info>  [1629096733.9233] vpn-connection[0x560a8ced26f0,d28d8fc0-5be1-437d-a4f6-1c3a07807016,"ProtonVPN CH-US#1",0]: Saw the service appear; activating connection
Aug 15 23:52:13 rufus NetworkManager[95345]: <error> [1629096733.9253] vpn-connection[0x560a8ced26f0,d28d8fc0-5be1-437d-a4f6-1c3a07807016,"ProtonVPN CH-US#1",0]: Failed to request VPN secrets #3: No agents were available for this request.
Aug 15 23:52:13 rufus NetworkManager[95345]: <info>  [1629096733.9257] vpn-connection[0x560a8ced26f0,d28d8fc0-5be1-437d-a4f6-1c3a07807016,"ProtonVPN CH-US#1",0]: VPN plugin: state changed: stopped (6)```

allora avatar Aug 16 '21 06:08 allora

I have similar No agents error like allora mentioned above.

mingchen avatar Aug 16 '21 20:08 mingchen

Same issue here on Arch

protonvpn-cli --version

ProtonVPN CLI v3.8.0 (protonvpn-nm-lib v3.3.2; proton-client v0.5.1)

protonvpn.log

2021-09-18 16:40:13,953 — nm_client_mixin.py — ERROR — __dynamic_callback:124 — Exception: 'remove'
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/protonvpn_nm_lib/core/connection_backend/nm_client/nm_client_mixin.py", line 117, in __dynamic_callback
    (callback_type_dict[callback_type]["finish_function"])(result)
KeyError: 'remove'

2021-09-18 16:40:14,306 — nm_client_mixin.py — ERROR — __dynamic_callback:124 — Exception: NM.Client.add_connection_finish() takes exactly 2 arguments (1 given)
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/protonvpn_nm_lib/core/connection_backend/nm_client/nm_client_mixin.py", line 117, in __dynamic_callback
    (callback_type_dict[callback_type]["finish_function"])(result)

2021-09-18 16:40:14,320 — nm_client_mixin.py — ERROR — __dynamic_callback:124 — Exception: NM.Client.activate_connection_finish() takes exactly 2 arguments (1 given)
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/protonvpn_nm_lib/core/connection_backend/nm_client/nm_client_mixin.py", line 117, in __dynamic_callback
    (callback_type_dict[callback_type]["finish_function"])(result)
TypeError: NM.Client.activate_connection_finish() takes exactly 2 arguments (1 given)

journalctl -u NetworkManager.service

Sep 18 16:40:14 frypan NetworkManager[628]: <error> [1631950814.3353] vpn-connection[0x5596b3ee0790,927>

giraudan avatar Sep 18 '21 07:09 giraudan

So, after some fiddling, i discovered that a few things have to be true:

  1. You need network manager up and running (systemctl start/enable... I use a wired connection so i didnt have any network manager stuff initially, so my config might have been off)
  2. You need a spot for system tray things to live (note I use bspwm, so didnt have anything like this setup as i dont use it, installed stalonetray)
  3. You MUST HAVE nm-applet installed and running

It took me a reboot too, but i suspect if you have loaded things up in the right way the first time, its ok. After that, my protonvpn client ran fine (both gui and cli)

Kinda sucky that a cli client requires the nm-applet system tray app :|

allora avatar Sep 19 '21 02:09 allora

i had the same issue after upgrading from a previous version of protonvpn (to protonvpn-cli).

@allora thanks for the hint, the issue was that nm-applet wasn't running; saw the issue with unauthentication network-manager in journalctl --system -r since the protonvpn logs (in ~/.cache/protonvpn/logs/ doesn't show anything valuable at all).

btw, using nm-applet --indicator on swaywm due to this issue.

lost so much time because of a non-sense gui dependency that isn't mentioned anywhere :angry:

bugrasan avatar Dec 26 '21 00:12 bugrasan

@bugrasan agree, the documentation of all the dependencies needed for protonvpn is incredibly lacking. Recently I discovered you also need open resolve installed and configured in order for it to properly update your DNS upon connection to protonvpn, else sometimes you could connect to protonVPN and get leaky DNS...

Overall, pretty disappointed in the poor linux support. A lot of assumptions about the system are made that might not always be true.

allora avatar Dec 27 '21 23:12 allora

just for the sake of the next poor soul who will try: i also noticed that it requires 'gnome-keyring' and is not able to utilise 'kwallet'. protonvpn-cli login <username> works fine with kwallet alone, but you won't be able to connect afterwards unless you install 'gnome-keyring'

bugrasan avatar Dec 29 '21 09:12 bugrasan

the dependency web is nearly impossible to navigate for arch. I had to install several independent pypi packages, sequentially install 4 different protonvpn dependencies, nm-applet, activate NetworkManager, AND STILL DON'T have it working on Arch, why am I paying for this servicet. the community version was painful but less than this and it at least worked

/usr/lib/python3.9/site-packages/protonvpn_nm_lib/core/connection_backend/nm_client/nm_client_mixin.py:11: Warning: g_main_context_push_thread_default: assertion 'acquired_context' failed
  nm_client = NM.Client.new(None)
/usr/lib/python3.9/site-packages/protonvpn_nm_lib/core/connection_backend/nm_client/nm_client_mixin.py:11: Warning: g_main_context_pop_thread_default: assertion 'g_queue_peek_head (stack) == context' failed
  nm_client = NM.Client.new(None)

xonq avatar Jan 18 '22 16:01 xonq

Currently: Ubuntu 20 Installed nm-applet - and running. verified Network Manager - good Installed gnome-keyring

able to login from proton-cli successfully.

When app launches? The absolutely worthless and insane error message: unknown error. Holy smokes.... :(

sbsaylors avatar Jul 22 '22 21:07 sbsaylors