ProtonVPN / linux-cli

Official ProtonVPN Linux app (CLI)
https://protonvpn.com/download-linux
GNU General Public License v3.0
335 stars 43 forks source link

Cli on headless machine - NetworkManager service not running #53

Open tamet83 opened 2 years ago

tamet83 commented 2 years ago

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

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


Hi, i just tried to install and run ProtonVPN Cli on a Proxmox LXC based on Debian 10. I installed all dependencies as listed here here.

When I try to login entering the username and password i receive the following error:

org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.NetworkManager was not provided by any .service files

I confirm that I don’t have any NetworkManager service runnig and to be honest I don’t know how to set it.

Can someone help me?

Thanks

tamet83 commented 2 years ago

No one can help?

a1lu commented 2 years ago

Did you try install networkmanager and running systemctl start NetworkManager.service? (Worked for me on archlinux)

tamet83 commented 2 years ago

This is what i receive

root@Sonarr:~# systemctl start NetworkManager.service
Job for NetworkManager.service failed because the control process exited with error code.
See "systemctl status NetworkManager.service" and "journalctl -xe" for details.
root@Sonarr:~# journalctl -xe
-- -- The job identifier is 570 and the job result is failed.
Oct 16 18:38:28 Sonarr systemd[1]: NetworkManager.service: Consumed 946us CPU time.
-- Subject: Resources consumed by unit runtime
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- The unit NetworkManager.service completed and consumed the indicated resources.
Oct 16 18:38:28 Sonarr systemd[1]: NetworkManager.service: Service RestartSec=100ms expired, scheduling restart.
Oct 16 18:38:28 Sonarr systemd[1]: NetworkManager.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Automatic restarting of the unit NetworkManager.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Oct 16 18:38:28 Sonarr systemd[1]: Stopped Network Manager.
-- Subject: A stop job for unit NetworkManager.service has finished
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- A stop job for unit NetworkManager.service has finished.
-- 
-- The job identifier is 612 and the job result is done.
Oct 16 18:38:28 Sonarr systemd[1]: NetworkManager.service: Consumed 946us CPU time.
-- Subject: Resources consumed by unit runtime
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- The unit NetworkManager.service completed and consumed the indicated resources.
Oct 16 18:38:28 Sonarr systemd[1]: NetworkManager.service: Start request repeated too quickly.
Oct 16 18:38:28 Sonarr systemd[1]: NetworkManager.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- The unit NetworkManager.service has entered the 'failed' state with result 'exit-code'.
Oct 16 18:38:28 Sonarr systemd[1]: Failed to start Network Manager.
-- Subject: A start job for unit NetworkManager.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- A start job for unit NetworkManager.service has finished with a failure.
-- 
-- The job identifier is 612 and the job result is failed.
a1lu commented 2 years ago

Well, this looks like a issue with debian / network manager. As the log states you could get support at https://www.debian.org/support. (Or debian mailing list etc.)

tamet83 commented 2 years ago

Ok, I'll try to create an Ubuntu based lxc and see if it works some how. The strange thing is that the App officially supports Debian. Is the team aware that there is an issue with Network-Manager packet?

tamet83 commented 2 years ago

Ok, I tried to install protovpn on a differente template (Ubuntu 21) and i have another error now when i try to login:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/secretstorage/__init__.py", line 72, in dbus_init
    connection = open_dbus_connection()
  File "/usr/lib/python3/dist-packages/jeepney/io/blocking.py", line 243, in open_dbus_connection
    bus_addr = get_bus(bus)
  File "/usr/lib/python3/dist-packages/jeepney/bus.py", line 53, in get_bus
    return find_session_bus()
  File "/usr/lib/python3/dist-packages/jeepney/bus.py", line 42, in find_session_bus
    addr = os.environ['DBUS_SESSION_BUS_ADDRESS']
  File "/usr/lib/python3.9/os.py", line 679, in __getitem__
    raise KeyError(key) from None
KeyError: 'DBUS_SESSION_BUS_ADDRESS'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/keyring/linuxkeyring.py", line 21, in __getitem__
    stored_data = self.__keyring_backend.get_password(
  File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 78, in get_password
    collection = self.get_preferred_collection()
  File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 56, in get_preferred_collection
    bus = secretstorage.dbus_init()
  File "/usr/lib/python3/dist-packages/secretstorage/__init__.py", line 78, in dbus_init
    raise SecretServiceNotAvailableException(reason) from ex
secretstorage.exceptions.SecretServiceNotAvailableException: Environment variable DBUS_SESSION_BUS_ADDRESS is unset

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/protonvpn-cli", line 11, in <module>
    load_entry_point('protonvpn-cli==3.10.1', 'console_scripts', 'protonvpn-cli')()
  File "/usr/lib/python3/dist-packages/protonvpn_cli/main.py", line 21, in main
    ProtonVPNCLI()
  File "/usr/lib/python3/dist-packages/protonvpn_cli/cli.py", line 65, in __init__
    res = getattr(self, args.command)()
  File "/usr/lib/python3/dist-packages/protonvpn_cli/cli.py", line 162, in login
    return self.cli_wrapper.login(args.username)
  File "/usr/lib/python3/dist-packages/protonvpn_cli/cli_wrapper.py", line 63, in login
    if self.protonvpn.check_session_exists():
  File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/api.py", line 322, in check_session_exists
    return self._env.api_session.is_valid
  File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/environment.py", line 54, in api_session
    self.__api_session = APISession()
  File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/session/session.py", line 218, in __init__
    self.__keyring_load_session()
  File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/session/session.py", line 246, in __keyring_load_session
    keyring_data_user = ExecutionEnvironment().keyring[
  File "/usr/lib/python3/dist-packages/protonvpn_nm_lib/core/keyring/linuxkeyring.py", line 32, in __getitem__
    raise exceptions.KeyringError(e)
protonvpn_nm_lib.exceptions.KeyringError: Environment variable DBUS_SESSION_BUS_ADDRESS is unset

I am really confused now and don’t know what’s the problem.

a1lu commented 2 years ago
protonvpn_nm_lib.exceptions.KeyringError: Environment variable DBUS_SESSION_BUS_ADDRESS is unset

DBUS_SESSION_BUS_ADDRESS is unset.

tamet83 commented 2 years ago

How can I set it? I've no clue

Khalu commented 2 years ago

I don't know much about dbus either but I found that the dbus-launch command works for me like so eval `dbus-launch --sh-syntax --exit-with-session` Note the dbus command is wrapped in backticks, but could also be wrapped in $()

tamet83 commented 2 years ago

I opened a ticket and support told me that the actual CLI version doesn't support headless machine. So end of the story for my try with Proton VPN. I'll continue to use the old CLI version untill the end of my subscription and then I'm going to look for other solutions. Thanks anyway for your help, really appreciated.