Rafficer / linux-cli-community

Linux command-line client for ProtonVPN. Written in Python.
https://protonvpn.com
GNU General Public License v3.0
1.31k stars 198 forks source link

Can't automatically connect at startup #301

Open troubledguy opened 3 years ago

troubledguy commented 3 years ago

Whenever I restart my computer, I check my vpn status to see that I am not connected despite having enabled autoconnect.

Steps to reproduce the behavior:

  1. Follow the guide to install protonvpn-cli from pypi
  2. Init profile (free version)
  3. follow guide on https://github.com/ProtonVPN/linux-cli-community/blob/master/USAGE.md#installing-from-pypi to enable autoconnect (change "user" to OpenVPN username)
  4. Restart ubuntu
  5. check protonvpn status using "protonvpn status" in terminal
  6. not connected

Error: Running "sudo systemctl status protonvpn-autoconnect.service" in the terminal, it poops out the following message:

protonvpn-autoconnect.service - ProtonVPN-CLI auto-connect Loaded: loaded (/etc/systemd/system/protonvpn-autoconnect.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2021-04-08 16:20:38 BST; 13min ago

Apr 08 16:20:38 Computerbox protonvpn[587]: File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/connection.py", line 15, in Apr 08 16:20:38 Computerbox protonvpn[587]: from .logger import logger Apr 08 16:20:38 Computerbox protonvpn[587]: File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/logger.py", line 40, in Apr 08 16:20:38 Computerbox protonvpn[587]: logger = get_logger() Apr 08 16:20:38 Computerbox protonvpn[587]: File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/logger.py", line 20, in get_logger Apr 08 16:20:38 Computerbox protonvpn[587]: os.mkdir(CONFIG_DIR) Apr 08 16:20:38 Computerbox protonvpn[587]: FileNotFoundError: [Errno 2] No such file or directory: '~[My openvpn username]/.pvpn-cli' Apr 08 16:20:38 Computerbox systemd[1]: protonvpn-autoconnect.service: Control process exited, code=exited, status=1/FAILURE Apr 08 16:20:38 Computerbox systemd[1]: protonvpn-autoconnect.service: Failed with result 'exit-code'. Apr 08 16:20:38 Computerbox systemd[1]: Failed to start ProtonVPN-CLI auto-connect.

However, I am able to manually connect using protonvpn-cli commands with no issue apart from not being able to connect automatically at boot.

Desktop (please complete the following information):

Additional context I did install some protonvpn packages to connect directly to vpn. Although it didn't have autoconnect so I installed protonvpn-cli yesterday. I am also running this on a VM version of ubuntu.

asorel1942 commented 3 years ago

I'm having the same isue.

TommyTran732 commented 3 years ago

I don't know if this works on any other desktop environments, but if you are using GNOME just put this in ~/.config/autostart/ProtonVPN-Reconnect.desktop:

[Desktop Entry] Name=ProtonVPN-Reconnect Comment=Automatically reconnect to ProtonVPN at startup Exec=/usr/bin/protonvpn-cli reconnect Terminal=false Type=Application X-GNOME-Autostart-enabled=true

That said, I use the official packages and not from PyPI

basings commented 2 years ago

thank you @tommytran732 I did this on arch kde and it works!

for anyone to copy paste nano ~/.config/autostart/ProtonVPN-Reconnect.desktop