Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't launch protonvpn-app from script #82

Open
1 task
LittleBangTheory opened this issue Nov 11, 2024 · 1 comment
Open
1 task

Can't launch protonvpn-app from script #82

LittleBangTheory opened this issue Nov 11, 2024 · 1 comment

Comments

@LittleBangTheory
Copy link

We are happy to answer your questions about the code or discuss technical ideas.

Please complete the following checklist (by adding [x]):

  • [X ] I have searched open and closed issues for duplicates
  • [ X] This isn't a feature request
  • This is not a report about my app not working as expected

Environment

Issue

Hello,

For context, i have been trying to execute the protonvpn-app from a script linked to a .desktop file, to automatize the deactivation of my custom DNS when I launch the ProtonVPN, and activation when I close it.

Using the protonvpn-app command from a normal terminal works fine, but when trying in the terminal opened by Ubuntu from the .desktop file, I get this error trace :

Traceback (most recent call last):
  File "/usr/bin/protonvpn-app", line 33, in <module>
    sys.exit(load_entry_point('proton-vpn-gtk-app==4.6.0', 'console_scripts', 'protonvpn-app')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/protonvpn-app", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/proton/vpn/app/gtk/__init__.py", line 36, in <module>
    logging.config(filename="vpn-app")
  File "/usr/lib/python3/dist-packages/proton/vpn/logging/__init__.py", line 126, in config
    default_logdirpath = os.path.join(VPNExecutionEnvironment().path_cache, "logs")
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/proton/utils/metaclasses.py", line 25, in __call__
    cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/proton/utils/environment.py", line 116, in __init__
    super().__init__()
  File "/usr/lib/python3/dist-packages/proton/utils/environment.py", line 38, in __init__
    self._setup_as_regular_user()
  File "/usr/lib/python3/dist-packages/proton/utils/environment.py", line 78, in _setup_as_regular_user
    config_home, cache_home, runtime_dir = self._get_dir_paths()
                                           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/proton/utils/environment.py", line 91, in _get_dir_paths
    runtime_dir = BaseDirectory.get_runtime_dir()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/xdg/BaseDirectory.py", line 141, in get_runtime_dir
    return os.environ['XDG_RUNTIME_DIR']
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 685, in __getitem__
KeyError: 'XDG_RUNTIME_DIR'

What surprises me is that the XDG_RUNTIME_DIR is well set in the windows where I get the error, and has the same value as in any other windows, being /run/user/1000.

Also, when using env to print all the environnement variables, and trying a diff between the two outputs, the only differences where not meaningful ones, meaning LESSCLOSE, LESSOPEN, LS_COLORS, and the GNOME_TERMINAL_SCREEN that is obviously different.

Additional informations

If of any use, here is the .desktop file :

[Desktop Entry]
Type=Application
Name=VPN  
Categories=Application;Maintenance
Exec=$REDACTED_PATH/vpn.sh
Icon=/usr/share/icons/protonvpn.svg
Terminal=true

Thanks !

@maremike
Copy link

maremike commented Dec 31, 2024

I am having a similar issue. However Im trying to start the app at boot using a systemd service. I got the app to work on my debian machine, but am struggling with fedora. I used the same scripts for both.

"/etc/systemd/system/proton-vpn.service" (even if I change from fork to simple nothing changes) [Unit]

Description=ProtonVPN Client
After=network.target

[Service]
Type=fork
ExecStart=/bin/protonvpn-app
Restart=on-failure
EnvironmentFile=/etc/default/protonvpn
User=username
Group=username

[Install]
WantedBy=default.target

"/etc/default/protonvpn" XDG_RUNTIME_DIR=/run/user/1000

DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus

This worked on Debian. But on Fedora I get the following journalctl output:
"journalctl -u proton-vpn.service" Started proton-vpn.service - ProtonVPN Client. Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.590836+00:00 | proton.vpn.core.connection:459 | INFO | CONN:STATE_CHANGED | Disconnected (initial state) Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.592173+00:00 | proton.vpn.app.gtk.app:57 | INFO | APP:PROCESS_START | self= Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.645333+00:00 | proton.vpn.app.gtk.widgets.main.tray_indicator:45 | INFO | AyanaAppIndicator3 not found: Namespa> Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.648199+00:00 | proton.vpn.core.refresher.vpn_data_refresher:167 | INFO | APP.VPN_DATA_REFRESHER:ENABLE | VPN da> Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.648347+00:00 | proton.vpn.core.refresher.vpn_data_refresher:175 | INFO | Next client config refresh scheduled i> Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.648433+00:00 | proton.vpn.core.refresher.vpn_data_refresher:184 | INFO | Next server list refresh scheduled in > Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.648981+00:00 | proton.vpn.core.refresher.vpn_data_refresher:193 | INFO | Next certificate refresh scheduled in > Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.649072+00:00 | proton.vpn.core.refresher.vpn_data_refresher:202 | INFO | Next feature flags refresh scheduled i> Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.649397+00:00 | proton.vpn.session.utils:107 | INFO | API:REQUEST | '/vpn/v1/loads' Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.667475+00:00 | dbus.proxies:407 | ERROR | Introspect error on :1.16:/org/freedesktop/login1/seat/auto: dbus.exc> Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.667962+00:00 | proton.vpn.app.gtk.utils.exception_handler:257 | CRITICAL | APP:CRASH | Unexpected error. Dec 30 22:51:41 apollo protonvpn-app[11557]: Traceback (most recent call last): Dec 30 22:51:41 apollo protonvpn-app[11557]: File "/usr/lib/python3.13/site-packages/proton/vpn/app/gtk/widgets/vpn/vpn_widget.py", line 183, in _on_refresher_enabled Dec 30 22:51:41 apollo protonvpn-app[11557]: self.display(self._controller.user_tier, self._controller.server_list) Dec 30 22:51:41 apollo protonvpn-app[11557]: ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Dec 30 22:51:41 apollo protonvpn-app[11557]: File "/usr/lib/python3.13/site-packages/proton/vpn/app/gtk/widgets/vpn/vpn_widget.py", line 205, in display Dec 30 22:51:41 apollo protonvpn-app[11557]: self._controller.reconnector.enable() Dec 30 22:51:41 apollo protonvpn-app[11557]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ Dec 30 22:51:41 apollo protonvpn-app[11557]: File "/usr/lib/python3.13/site-packages/proton/vpn/app/gtk/services/reconnector/reconnector.py", line 93, in enable Dec 30 22:51:41 apollo protonvpn-app[11557]: self._session_monitor.enable() Dec 30 22:51:41 apollo protonvpn-app[11557]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ Dec 30 22:51:41 apollo protonvpn-app[11557]: File "/usr/lib/python3.13/site-packages/proton/vpn/app/gtk/services/reconnector/session_monitor.py", line 61, in enable Dec 30 22:51:41 apollo protonvpn-app[11557]: self._setup() Dec 30 22:51:41 apollo protonvpn-app[11557]: ~~~~~~~~~~~^^ Dec 30 22:51:41 apollo protonvpn-app[11557]: File "/usr/lib/python3.13/site-packages/proton/vpn/app/gtk/services/reconnector/session_monitor.py", line 102, in _setup Dec 30 22:51:41 apollo protonvpn-app[11557]: seat_properties = seat_auto_properties_proxy.GetAll(SEAT_INTERFACE) Dec 30 22:51:41 apollo protonvpn-app[11557]: File "/usr/lib64/python3.13/site-packages/dbus/proxies.py", line 72, in __call__ Dec 30 22:51:41 apollo protonvpn-app[11557]: return self._proxy_method(*args, **keywords) Dec 30 22:51:41 apollo protonvpn-app[11557]: ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ Dec 30 22:51:41 apollo protonvpn-app[11557]: File "/usr/lib64/python3.13/site-packages/dbus/proxies.py", line 141, in __call__ Dec 30 22:51:41 apollo protonvpn-app[11557]: return self._connection.call_blocking(self._named_service, Dec 30 22:51:41 apollo protonvpn-app[11557]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ Dec 30 22:51:41 apollo protonvpn-app[11557]: self._object_path, Dec 30 22:51:41 apollo protonvpn-app[11557]: ^^^^^^^^^^^^^^^^^^ Dec 30 22:51:41 apollo protonvpn-app[11557]: ...<3 lines>... Dec 30 22:51:41 apollo protonvpn-app[11557]: args, Dec 30 22:51:41 apollo protonvpn-app[11557]: ^^^^^ Dec 30 22:51:41 apollo protonvpn-app[11557]: **keywords) Dec 30 22:51:41 apollo protonvpn-app[11557]: ^^^^^^^^^^^ Dec 30 22:51:41 apollo protonvpn-app[11557]: File "/usr/lib64/python3.13/site-packages/dbus/connection.py", line 634, in call_blocking Dec 30 22:51:41 apollo protonvpn-app[11557]: reply_message = self.send_message_with_reply_and_block( Dec 30 22:51:41 apollo protonvpn-app[11557]: message, timeout) Dec 30 22:51:41 apollo protonvpn-app[11557]: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: Unknown object '/org/freedesktop/login1/seat/auto'. Dec 30 22:51:41 apollo protonvpn-app[11557]: 2024-12-30T21:51:41.677092+00:00 | proton.vpn.app.gtk.services.reconnector.reconnector:174 | INFO | Network connectivity was detect> Dec 30 22:51:43 apollo protonvpn-app[11557]: 2024-12-30T21:51:43.097837+00:00 | proton.vpn.session.utils:111 | INFO | API:RESPONSE | '/vpn/v1/loads' Dec 30 22:51:43 apollo protonvpn-app[11557]: 2024-12-30T21:51:43.309372+00:00 | proton.vpn.core.refresher.server_list_refresher:76 | INFO | Next server list refresh scheduled i> Dec 30 22:51:51 apollo systemd[1]: proton-vpn.service: Deactivated successfully.
What I think is the most interesting here is:
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: Unknown object '/org/freedesktop/login1/seat/auto'.
The protonvpn-app starts, but with an error
Something went wrong. An unexpected error occurred
. It says constantly
Loading App
on the interface.

But I can say that with the code both applications get started (though for Fedora not at boot and it doesnt work).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants