python-eduvpn-client icon indicating copy to clipboard operation
python-eduvpn-client copied to clipboard

Problems with eduvpn-client setup on NixOS

Open nictru opened this issue 1 year ago • 5 comments

Hello everyone, first of all, thanks for caring about Nix even if it is not the most widespread distro. Maybe you can help me with the problem I encountered?

Installation

Installed using the eduvpn-client nix package from the unstable channel

Version

4.2.1

OS/Distribution

NixOS 23.11

Logs

eduvpn-gui -d

2024-04-18 12:02:11,413 - MainThread - DEBUG - eduvpn.ui.app - app.py:71 - activate
2024-04-18 12:02:11,710 - <function ApplicationModelTransitions.get_previous_servers at 0x7fdbfa311580> - DEBUG - eduvpn.app - app.py:42 - Transition: NO_SERVER, old state: DEREGISTERED
2024-04-18 12:02:14,153 - MainThread - DEBUG - eduvpn.ui.ui - ui.py:1059 - activated server: <eduvpn_common.server.InstituteServer object at 0x7fdc0a3c6390>
2024-04-18 12:02:14,157 - <function ApplicationModelTransitions.loading_server at 0x7fdbfa311800> - DEBUG - eduvpn.app - app.py:66 - Transition: LOADING_SERVER, old state: NO_SERVER
2024-04-18 12:02:14,166 - <function ApplicationModelTransitions.chosen_server at 0x7fdbfa3119e0> - DEBUG - eduvpn.app - app.py:71 - Transition: CHOSEN_SERVER, old state: LOADING_SERVER
2024/04/18 12:02:14 - Go - DEBUG - Getting access token
2024/04/18 12:02:14 - Go - DEBUG - Access token is not expired, returning
2024-04-18 12:02:14,316 - <function ApplicationModelTransitions.authorized at 0x7fdbfa312160> - DEBUG - eduvpn.app - app.py:91 - Transition: AUTHORIZED, old state: CHOSEN_SERVER
2024-04-18 12:02:14,325 - <function ApplicationModelTransitions.parse_request_config at 0x7fdbfa312520> - DEBUG - eduvpn.app - app.py:102 - Transition: REQUEST_CONFIG, old state: AUTHORIZED
2024/04/18 12:02:14 - Go - DEBUG - Getting access token
2024/04/18 12:02:14 - Go - DEBUG - Access token is not expired, returning
2024/04/18 12:02:14 - Go - DEBUG - Getting access token
2024/04/18 12:02:14 - Go - DEBUG - Access token is not expired, returning
2024-04-18 12:02:15,105 - <function ApplicationModelTransitions.parse_config at 0x7fdbfa312700> - DEBUG - eduvpn.app - app.py:107 - Transition: DISCONNECTED, old state: REQUEST_CONFIG
2024/04/18 12:02:15 - Go - DEBUG - Running token callback
2024-04-18 12:02:15,113 - call-model - DEBUG - eduvpn.app - app.py:345 - Save tokens called
2024-04-18 12:02:15,132 - <function ApplicationModelTransitions.parse_connecting at 0x7fdbfa312c00> - DEBUG - eduvpn.app - app.py:130 - Transition: CONNECTING, old state: DISCONNECTED
2024-04-18 12:02:15,133 - call-model - DEBUG - eduvpn.nm - nm.py:448 - writing wireguard configuration to Network Manager
2024-04-18 12:02:15,135 - MainThread - DEBUG - eduvpn.ui.ui - ui.py:1154 - clicked on switch connection state
2024-04-18 12:02:15,136 - MainThread - DEBUG - eduvpn.nm - nm.py:362 - Adding new connection
2024-04-18 12:02:15,137 - MainThread - ERROR - /nix/store/j40yn4qpnm7ik0yah95knzrsn3jwkpzk-eduvpn-client-4.2.1/lib/python3.11/site-packages/eduvpn/utils.py - utils.py:27 - Unhandled exception
Traceback (most recent call last):
  File "/nix/store/j40yn4qpnm7ik0yah95knzrsn3jwkpzk-eduvpn-client-4.2.1/lib/python3.11/site-packages/eduvpn/nm.py", line 809, in add_connection_callback
    new_con = client.add_connection_finish(result)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gi.repository.GLib.GError: nm-connection-error-quark: connection.autoconnect-ports: unknown property (7)

sudo journalctl -u NetworkManager

Apr 18 11:03:15 nixos systemd[1]: Stopping Network Manager...
Apr 18 11:03:15 nixos NetworkManager[1085]: <warn>  [1713430995.2378] dispatcher: (10) failed (after 0.032 sec): Refusing activation, D-Bus is shutting down.
Apr 18 11:03:15 nixos systemd[1]: NetworkManager.service: Deactivated successfully.
Apr 18 11:03:15 nixos systemd[1]: Stopped Network Manager.
Apr 18 11:03:15 nixos systemd[1]: NetworkManager.service: Consumed 1.022s CPU time, received 25.1K IP traffic, sent 1008B IP traffic.

nictru avatar Apr 18 '24 10:04 nictru

Same thing happens both for WireGuard and OpenVPN connections

nictru avatar Apr 18 '24 10:04 nictru

Thanks for your issue, the reason I care about Nix(Os) is because I use it myself too :)

That is actually a quite strange error, you are on 23.11. Do you only pull the eduvpn client package from the unstable channel?

How does your NixOS networking config look like? Also which server is this, could you also test the "secure internet" server (e.g. location NL) in the app?

jwijenbergh avatar Apr 18 '24 13:04 jwijenbergh

I just tried it and can confirm that it is related to installing the nixos-unstable package on a nixos 23.11 install I get the same error, however, on a system completely on nixos-unstable it works.

benneti avatar Apr 22 '24 09:04 benneti

Yeah that's what I figured. I am guessing what happens is that because all deps are fetched using the unstable channel too, they have a mismatch with the globally installed networkmanager. You could wait for 24.05 to be released and install the client through pip for now, or put the eduvpn-common and eduvpn client in an overlay where you call the derivation from the unstable channel. Let me create an overlay

jwijenbergh avatar Apr 22 '24 09:04 jwijenbergh

This should work (replace channel if you want, I used nixos-unstable)

 nixpkgs.overlays = [
   (final: prev: {
     pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
       (python-final: python-prev: {
         eduvpn-common =
           python-final.callPackage
             "${<nixos-unstable>}/pkgs/development/python-modules/eduvpn-common/default.nix"
             { };
       })
     ];
     libeduvpn-common =
       pkgs.callPackage "${<nixos-unstable>}/pkgs/by-name/li/libeduvpn-common/package.nix"
         { };
     eduvpn-client =
       pkgs.callPackage "${<nixos-unstable>}/pkgs/by-name/ed/eduvpn-client/package.nix"
         { };
   })
 ];

jwijenbergh avatar Apr 22 '24 11:04 jwijenbergh

thank you, I was unaware of pythonPackagesExtensions which makes creating this overlay so much cleaner.

benneti avatar Apr 23 '24 07:04 benneti

Yeah indeed, it's relatively new https://github.com/NixOS/nixpkgs/pull/91850

Previously you had to do some convoluted stuff with composeManyExtensions

jwijenbergh avatar Apr 23 '24 07:04 jwijenbergh

Hey, thanks guys! This solution worked for me and 24.05 is also not too far away :)

nictru avatar Apr 24 '24 17:04 nictru