10
9
Fork
You've already forked linux-app
14

Deactivate doesn't work for CLI #467

Closed
opened 2022年03月22日 11:22:37 +01:00 by paulmelis · 6 comments
paulmelis commented 2022年03月22日 11:22:37 +01:00 (Migrated from github.com)
Copy link

Installation

From this repo, per instructions in readme

Version

45c58ec010

OS/Distribution

Arch Linux

Logs

(venv) melis@juggle 11:15:~/c/python-eduvpn-client$ eduvpn-cli activate
INFO:eduvpn.remote:Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal
INFO:eduvpn.storage:updating token for https://surf.eduvpn.nl/
INFO:eduvpn.nm:calling action with CLI mainloop
INFO:eduvpn.nm:activate_connection uuid: c13b19c5-3dbf-485b-b353-8a9be1d55caa connection: <NM.RemoteConnection object at 0x7fb6800df340 (NMRemoteConnection at 0x5620032f4710)>
INFO:eduvpn.nm:activate_connection_async result: <NM.VpnConnection object at 0x7fb67dde9cc0 (NMVpnConnection at 0x56200327d240)>
INFO:eduvpn.nm:Quiting main loop, thanks!
(venv) melis@juggle 11:15:~/c/python-eduvpn-client$ eduvpn-cli status
# Global configuration
uuid: c13b19c5-3dbf-485b-b353-8a9be1d55caa
auth_url: https://surf.eduvpn.nl/
VPN connection active: False
VPN NM status is: None
Active VPN connection is EduVPN: False
## Previous connection properties
 ** CURRENT ACTIVE CONFIGURATION **
auth_url https://surf.eduvpn.nl/
api_url: https://surf.eduvpn.nl/portal/api.php/v3
display_name: SURF BV
support_contact: ['https://support.ia.surf.nl/']
profile_id: medewerkers
token_endpoint: https://surf.eduvpn.nl/portal/oauth.php/token
authorization_endpoint: https://surf.eduvpn.nl/portal/_oauth/authorize
con_type: INSTITUTE
country_id: None
token.token_type: bearer
token.expires_in: 3600
token.expires_at: 1647947540.9699554
(venv) melis@juggle 11:20:~/c/python-eduvpn-client$ eduvpn-cli deactivate
INFO:eduvpn.nm:calling action with CLI mainloop
<hangs and VPN stays active>
<after pressing Ctl-C:>
^CTraceback (most recent call last):
 File "/home/melis/c/python-eduvpn-client/venv/bin/eduvpn-cli", line 33, in <module>
 sys.exit(load_entry_point('eduvpn-client==2.2.1', 'console_scripts', 'eduvpn-cli')())
 File "/home/melis/c/python-eduvpn-client/eduvpn/cli.py", line 139, in eduvpn
 parse_eduvpn(argv[1:])
 File "/home/melis/c/python-eduvpn-client/eduvpn/cli.py", line 105, in parse_eduvpn
 parsed.func(parsed)
 File "/home/melis/c/python-eduvpn-client/eduvpn/cli.py", line 34, in deactivate
 actions.deactivate()
 File "/home/melis/c/python-eduvpn-client/eduvpn/actions.py", line 137, in deactivate
 deactivate_connection_with_mainloop(get_uuid())
 File "/home/melis/c/python-eduvpn-client/eduvpn/nm.py", line 439, in deactivate_connection_with_mainloop
 action_with_mainloop(action=lambda callback: deactivate_connection(get_client(), uuid, callback))
 File "/home/melis/c/python-eduvpn-client/eduvpn/nm.py", line 426, in action_with_mainloop
 main_loop.run()
 File "/home/melis/c/python-eduvpn-client/venv/lib/python3.10/site-packages/gi/overrides/GLib.py", line 495, in run
 with register_sigint_fallback(self.quit):
 File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
 next(self.gen)
 File "/home/melis/c/python-eduvpn-client/venv/lib/python3.10/site-packages/gi/_ossighelper.py", line 237, in register_sigint_fallback
 signal.default_int_handler(signal.SIGINT, None)
KeyboardInterrupt

When using eduvpn-gui to do the same steps I get this error (and the VPN connection stays active):

(venv) melis@juggle 11:18:~/c/python-eduvpn-client$ eduvpn-gui 
2022年03月22日 11:18:41,211 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty
2022年03月22日 11:18:41,211 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty
2022年03月22日 11:18:41,212 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty
2022年03月22日 11:18:41,226 - init-server-db - INFO - eduvpn.remote - remote.py:23 - Requesting https://disco.eduvpn.org/v2/server_list.json
2022年03月22日 11:18:41,368 - init-server-db - INFO - eduvpn.remote - remote.py:37 - Retrieving signature https://disco.eduvpn.org/v2/server_list.json.minisig
2022年03月22日 11:18:41,479 - init-server-db - INFO - eduvpn.remote - remote.py:44 - verifying signature of https://disco.eduvpn.org/v2/server_list.json
2022年03月22日 11:18:41,480 - init-server-db - INFO - eduvpn.remote - remote.py:23 - Requesting https://disco.eduvpn.org/v2/organization_list.json
2022年03月22日 11:18:41,659 - init-server-db - INFO - eduvpn.remote - remote.py:37 - Retrieving signature https://disco.eduvpn.org/v2/organization_list.json.minisig
2022年03月22日 11:18:41,777 - init-server-db - INFO - eduvpn.remote - remote.py:44 - verifying signature of https://disco.eduvpn.org/v2/organization_list.json
2022年03月22日 11:18:42,845 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty
2022年03月22日 11:18:42,845 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty
2022年03月22日 11:18:42,846 - oauth-refresh - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal
2022年03月22日 11:18:43,002 - load-server-info - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal
2022年03月22日 11:18:43,129 - configure-connection - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal
2022年03月22日 11:18:43,362 - MainThread - INFO - eduvpn.nm - nm.py:265 - writing ovpn configuration to Network Manager
2022年03月22日 11:18:43,362 - MainThread - INFO - eduvpn.nm - nm.py:188 - Writing configuration to /tmp/tmpbfeg_wqz/eduVPN.ovpn
2022年03月22日 11:18:43,558 - MainThread - INFO - eduvpn.nm - nm.py:221 - Updating existing connection with new configuration
2022年03月22日 11:18:43,580 - MainThread - INFO - eduvpn.interface.event - event.py:187 - Finished saving network manager config: <Gio.Task object at 0x7fcbe37ad300 (GTask at 0x55cd21e02100)>
2022年03月22日 11:18:43,583 - MainThread - INFO - eduvpn.nm - nm.py:354 - setting default gateway: False
2022年03月22日 11:18:43,601 - MainThread - INFO - eduvpn.nm - nm.py:286 - activate_connection uuid: c13b19c5-3dbf-485b-b353-8a9be1d55caa connection: <NM.RemoteConnection object at 0x7fcbe37ac740 (NMRemoteConnection at 0x55cd21d011f0)>
2022年03月22日 11:18:43,675 - MainThread - INFO - eduvpn.nm - nm.py:301 - activate_connection_async result: <NM.VpnConnection object at 0x7fcbe045fa40 (NMVpnConnection at 0x55cd21f81370)>
<deactivate in GUI with the 0/1 switch>
2022年03月22日 11:18:53,305 - stop-connection - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal
Traceback (most recent call last):
 File "/home/melis/c/python-eduvpn-client/eduvpn/ui/ui.py", line 616, in on_switch_connection_state
 self.app.interface_transition('deactivate_connection')
 File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 172, in interface_transition
 self._base_transition(
 File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 133, in _base_transition
 state_machine.transition(
 File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 174, in transition
 new_state = transition_func(*args, **kwargs)
 File "/home/melis/c/python-eduvpn-client/eduvpn/interface/state.py", line 364, in deactivate_connection
 app.network_transition('disconnect')
 File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 148, in network_transition
 self._base_transition(
 File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 133, in _base_transition
 state_machine.transition(
 File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 176, in transition
 with self.trigger_callbacks(old_state, new_state):
 File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
 next(self.gen)
 File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 188, in trigger_callbacks
 self._call_edge_callbacks(ENTER, old_state, new_state)
 File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 262, in _call_edge_callbacks
 callback(old_state, new_state)
 File "/home/melis/c/python-eduvpn-client/eduvpn/ui/app.py", line 153, in enter_DisconnectedState
 self.connection_notification.hide()
 File "/home/melis/c/python-eduvpn-client/eduvpn/notify.py", line 32, in hide
 self.notification.close() # type: ignore
gi.repository.GLib.GError: notification-daemon-error-quark: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._notification_2ddaemon_2derror_2dquark.Code100: 0 is not a valid notification ID (100)

I see no messages in the journalctl output when I run the deactivate command, seems to get stuck before doing anything.

# Installation From this repo, per instructions in readme # Version 45c58ec0108bd2dfc11d082fce38c2239a1c220e # OS/Distribution Arch Linux # Logs ``` (venv) melis@juggle 11:15:~/c/python-eduvpn-client$ eduvpn-cli activate INFO:eduvpn.remote:Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal INFO:eduvpn.storage:updating token for https://surf.eduvpn.nl/ INFO:eduvpn.nm:calling action with CLI mainloop INFO:eduvpn.nm:activate_connection uuid: c13b19c5-3dbf-485b-b353-8a9be1d55caa connection: <NM.RemoteConnection object at 0x7fb6800df340 (NMRemoteConnection at 0x5620032f4710)> INFO:eduvpn.nm:activate_connection_async result: <NM.VpnConnection object at 0x7fb67dde9cc0 (NMVpnConnection at 0x56200327d240)> INFO:eduvpn.nm:Quiting main loop, thanks! (venv) melis@juggle 11:15:~/c/python-eduvpn-client$ eduvpn-cli status # Global configuration uuid: c13b19c5-3dbf-485b-b353-8a9be1d55caa auth_url: https://surf.eduvpn.nl/ VPN connection active: False VPN NM status is: None Active VPN connection is EduVPN: False ## Previous connection properties ** CURRENT ACTIVE CONFIGURATION ** auth_url https://surf.eduvpn.nl/ api_url: https://surf.eduvpn.nl/portal/api.php/v3 display_name: SURF BV support_contact: ['https://support.ia.surf.nl/'] profile_id: medewerkers token_endpoint: https://surf.eduvpn.nl/portal/oauth.php/token authorization_endpoint: https://surf.eduvpn.nl/portal/_oauth/authorize con_type: INSTITUTE country_id: None token.token_type: bearer token.expires_in: 3600 token.expires_at: 1647947540.9699554 (venv) melis@juggle 11:20:~/c/python-eduvpn-client$ eduvpn-cli deactivate INFO:eduvpn.nm:calling action with CLI mainloop <hangs and VPN stays active> <after pressing Ctl-C:> ^CTraceback (most recent call last): File "/home/melis/c/python-eduvpn-client/venv/bin/eduvpn-cli", line 33, in <module> sys.exit(load_entry_point('eduvpn-client==2.2.1', 'console_scripts', 'eduvpn-cli')()) File "/home/melis/c/python-eduvpn-client/eduvpn/cli.py", line 139, in eduvpn parse_eduvpn(argv[1:]) File "/home/melis/c/python-eduvpn-client/eduvpn/cli.py", line 105, in parse_eduvpn parsed.func(parsed) File "/home/melis/c/python-eduvpn-client/eduvpn/cli.py", line 34, in deactivate actions.deactivate() File "/home/melis/c/python-eduvpn-client/eduvpn/actions.py", line 137, in deactivate deactivate_connection_with_mainloop(get_uuid()) File "/home/melis/c/python-eduvpn-client/eduvpn/nm.py", line 439, in deactivate_connection_with_mainloop action_with_mainloop(action=lambda callback: deactivate_connection(get_client(), uuid, callback)) File "/home/melis/c/python-eduvpn-client/eduvpn/nm.py", line 426, in action_with_mainloop main_loop.run() File "/home/melis/c/python-eduvpn-client/venv/lib/python3.10/site-packages/gi/overrides/GLib.py", line 495, in run with register_sigint_fallback(self.quit): File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__ next(self.gen) File "/home/melis/c/python-eduvpn-client/venv/lib/python3.10/site-packages/gi/_ossighelper.py", line 237, in register_sigint_fallback signal.default_int_handler(signal.SIGINT, None) KeyboardInterrupt ``` When using eduvpn-gui to do the same steps I get this error (and the VPN connection stays active): ``` (venv) melis@juggle 11:18:~/c/python-eduvpn-client$ eduvpn-gui 2022年03月22日 11:18:41,211 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty 2022年03月22日 11:18:41,211 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty 2022年03月22日 11:18:41,212 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty 2022年03月22日 11:18:41,226 - init-server-db - INFO - eduvpn.remote - remote.py:23 - Requesting https://disco.eduvpn.org/v2/server_list.json 2022年03月22日 11:18:41,368 - init-server-db - INFO - eduvpn.remote - remote.py:37 - Retrieving signature https://disco.eduvpn.org/v2/server_list.json.minisig 2022年03月22日 11:18:41,479 - init-server-db - INFO - eduvpn.remote - remote.py:44 - verifying signature of https://disco.eduvpn.org/v2/server_list.json 2022年03月22日 11:18:41,480 - init-server-db - INFO - eduvpn.remote - remote.py:23 - Requesting https://disco.eduvpn.org/v2/organization_list.json 2022年03月22日 11:18:41,659 - init-server-db - INFO - eduvpn.remote - remote.py:37 - Retrieving signature https://disco.eduvpn.org/v2/organization_list.json.minisig 2022年03月22日 11:18:41,777 - init-server-db - INFO - eduvpn.remote - remote.py:44 - verifying signature of https://disco.eduvpn.org/v2/organization_list.json 2022年03月22日 11:18:42,845 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty 2022年03月22日 11:18:42,845 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty 2022年03月22日 11:18:42,846 - oauth-refresh - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal 2022年03月22日 11:18:43,002 - load-server-info - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal 2022年03月22日 11:18:43,129 - configure-connection - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal 2022年03月22日 11:18:43,362 - MainThread - INFO - eduvpn.nm - nm.py:265 - writing ovpn configuration to Network Manager 2022年03月22日 11:18:43,362 - MainThread - INFO - eduvpn.nm - nm.py:188 - Writing configuration to /tmp/tmpbfeg_wqz/eduVPN.ovpn 2022年03月22日 11:18:43,558 - MainThread - INFO - eduvpn.nm - nm.py:221 - Updating existing connection with new configuration 2022年03月22日 11:18:43,580 - MainThread - INFO - eduvpn.interface.event - event.py:187 - Finished saving network manager config: <Gio.Task object at 0x7fcbe37ad300 (GTask at 0x55cd21e02100)> 2022年03月22日 11:18:43,583 - MainThread - INFO - eduvpn.nm - nm.py:354 - setting default gateway: False 2022年03月22日 11:18:43,601 - MainThread - INFO - eduvpn.nm - nm.py:286 - activate_connection uuid: c13b19c5-3dbf-485b-b353-8a9be1d55caa connection: <NM.RemoteConnection object at 0x7fcbe37ac740 (NMRemoteConnection at 0x55cd21d011f0)> 2022年03月22日 11:18:43,675 - MainThread - INFO - eduvpn.nm - nm.py:301 - activate_connection_async result: <NM.VpnConnection object at 0x7fcbe045fa40 (NMVpnConnection at 0x55cd21f81370)> <deactivate in GUI with the 0/1 switch> 2022年03月22日 11:18:53,305 - stop-connection - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal Traceback (most recent call last): File "/home/melis/c/python-eduvpn-client/eduvpn/ui/ui.py", line 616, in on_switch_connection_state self.app.interface_transition('deactivate_connection') File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 172, in interface_transition self._base_transition( File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 133, in _base_transition state_machine.transition( File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 174, in transition new_state = transition_func(*args, **kwargs) File "/home/melis/c/python-eduvpn-client/eduvpn/interface/state.py", line 364, in deactivate_connection app.network_transition('disconnect') File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 148, in network_transition self._base_transition( File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 133, in _base_transition state_machine.transition( File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 176, in transition with self.trigger_callbacks(old_state, new_state): File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__ next(self.gen) File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 188, in trigger_callbacks self._call_edge_callbacks(ENTER, old_state, new_state) File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 262, in _call_edge_callbacks callback(old_state, new_state) File "/home/melis/c/python-eduvpn-client/eduvpn/ui/app.py", line 153, in enter_DisconnectedState self.connection_notification.hide() File "/home/melis/c/python-eduvpn-client/eduvpn/notify.py", line 32, in hide self.notification.close() # type: ignore gi.repository.GLib.GError: notification-daemon-error-quark: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._notification_2ddaemon_2derror_2dquark.Code100: 0 is not a valid notification ID (100) ``` I see no messages in the journalctl output when I run the deactivate command, seems to get stuck before doing anything.
hurngchunlee commented 2022年03月22日 11:58:44 +01:00 (Migrated from github.com)
Copy link

Hi, I also run into the same issue when I don't make the eduVPN the default route in the NetworkManager configuration (i.e. having never-default=true).

After checking the code, I suspect that it is probably due to the fact that the deactivate uses get_primary_connection() of the NetworkManager to get the connection (see https://github.com/eduvpn/python-eduvpn-client/blob/master/eduvpn/nm.py#L310).

According to this document, the get_primary_connection doesn't return the VPN connection if it doesn't have the default route.

Hi, I also run into the same issue when I don't make the eduVPN the default route in the NetworkManager configuration (i.e. having `never-default=true`). After checking the code, I suspect that it is probably due to the fact that the `deactivate` uses `get_primary_connection()` of the NetworkManager to get the connection (see https://github.com/eduvpn/python-eduvpn-client/blob/master/eduvpn/nm.py#L310). According to [this document](https://valadoc.org/libnm/NM.Client.get_primary_connection.html), the `get_primary_connection` doesn't return the VPN connection if it doesn't have the default route.
alvra commented 2022年03月22日 15:53:28 +01:00 (Migrated from github.com)
Copy link

Looks like these are actually all separate issues around deactivation:

  • deactivating in the cli; the app hangs
  • deactivating in the gui; notification id error
  • deactivating with other connections defined in NM doesn't do anything; this is a duplicate of #464

I can't speak on the cli, but for the gui issue we'll probably need more details on your unique setup and how to reproduce this. Can you create a separate issue and add this information?

Looks like these are actually all separate issues around deactivation: - deactivating in the cli; the app hangs - deactivating in the gui; notification id error - deactivating with other connections defined in NM doesn't do anything; this is a duplicate of #464 I can't speak on the cli, but for the gui issue we'll probably need more details on your unique setup and how to reproduce this. Can you create a separate issue and add this information?
paulmelis commented 2022年03月22日 17:01:47 +01:00 (Migrated from github.com)
Copy link

I can't speak on the cli, but for the gui issue we'll probably need more details on your unique setup and how to reproduce this. Can you create a separate issue and add this information?

Done, see #467

> I can't speak on the cli, but for the gui issue we'll probably need more details on your unique setup and how to reproduce this. Can you create a separate issue and add this information? Done, see #467
gijzelaerr commented 2022年04月22日 15:59:05 +02:00 (Migrated from github.com)
Copy link

@paulmelis you are linking to this issue, you probably meant #469

@paulmelis you are linking to this issue, you probably meant #469
paulmelis commented 2022年04月26日 09:09:11 +02:00 (Migrated from github.com)
Copy link

@paulmelis you are linking to this issue, you probably meant #469

Ah, yes, my bad, sorry

> @paulmelis you are linking to this issue, you probably meant #469 Ah, yes, my bad, sorry
jwijenbergh commented 2023年03月06日 15:40:46 +01:00 (Migrated from github.com)
Copy link
Fixed in version 4, install instructions https://python-eduvpn-client.readthedocs.io/en/latest/installation.html
Sign in to join this conversation.
No Branch/Tag specified
master
upstream-deb
openvpn-persistent
1.x
4.7.2
4.7.1
4.7.0
4.6.0
4.5.1
4.5.0
4.4.99.0
4.4.0
4.3.1
4.3.0
4.2.99.1
4.2.99.0
4.2.1
4.2.0
4.1.99.0
4.1.3
4.1.2
4.1.1
4.1.0
3.1.1
4.0.1
4.0.0
pr-3.3.1
pr-3.3.0
pr-3.2.0
3.1.0
3.0.0
2.2.1
2.2.0
2.1.0
2.0.0
1.1
1.0.3
1.0.2
1.0.1
1.0rc17
1.0rc16
1.0rc15
1.0rc14
1.0rc13
1.0rc12
1.0rc11
1.0rc10
1.0rc9
1.0rc8
1.0rc7
1.0rc6
1.0rc5
1.0rc4
1.0rc3
1.0rc2
1.0rc1
0.8
0.7.2
0.7.1
0.7
0.6.1
0.6
0.5.1
0.5
0.3
0.2.1
0.2
0.1.1
0.1
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
eduVPN/linux-app#467
Reference in a new issue
eduVPN/linux-app
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?