linux-cli-community icon indicating copy to clipboard operation
linux-cli-community copied to clipboard

[BUG] Running with systemd user service results into `There is no stored session. Please, login first.`

Open Mikaela opened this issue 3 years ago • 2 comments

Describe the bug

When starting ProtonVPN from systemd user service on login, it fails to start due to There is no stored session. Please, login first.

To Reproduce

  1. protonvpn-cli login username
  2. cd ~/.config/systemd/user/ (mkdir it if it doesn't exist)
  3. Create a protonvpn-user.service with your favourite text editor.
  4. systemctl --user daemon-reload
  5. systemctl --user enable protonvpn-user.service
  6. reboot
  7. systemctl --user status protonvpn-user.service
[Unit]
Description=ProtonVPN connection
After=network-online.target dbus.socket
Wants=network-online.target dbus.socket

[Service]
Type=forking
ExecStart=protonvpn-cli connect --p2p

[Install]
WantedBy=default.target

Expected behavior

I expect that ProtonVPN starts on login and connects to a server.

Error Messages/Program Output/Log Messages (~/.pvpn-cli/pvpn-cli.log)

● protonvpn-user.service - ProtonVPN connection
     Loaded: loaded (/home/mikaela/.config/systemd/user/protonvpn-user.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Fri 2021-02-26 16:12:35 EET; 13min ago
        CPU: 540ms

Feb 26 16:12:29 ZALDARYN systemd[1541]: Starting ProtonVPN connection...
Feb 26 16:12:35 ZALDARYN protonvpn-cli[1553]: There is no stored session. Please, login first.
Feb 26 16:12:35 ZALDARYN systemd[1541]: protonvpn-user.service: Control process exited, code=exited, status=1/FAILURE
Feb 26 16:12:35 ZALDARYN systemd[1541]: protonvpn-user.service: Failed with result 'exit-code'.
Feb 26 16:12:35 ZALDARYN systemd[1541]: Failed to start ProtonVPN connection.

Desktop (please complete the following information):

  • OS: Fedora 33
  • Python Version: Python 3.9.1
  • ProtonVPN-CLI Version: ProtonVPN CLI v3.3.1 (protonvpn-nm-lib v0.4.2; proton-client v0.3.0)

Additional context

After login I can run systemctl --user start protonvpn-cli or protonvpn c and it will work. protonvpn login username informs me that I am already logged in.

There is no full disc encryption (no home directory encryption, no partition encryption). This is a shared family system, so I don't wish to use a system-wide service as the other users aren't supposed to get connected to a VPN.

Mikaela avatar Feb 26 '21 14:02 Mikaela

Workaround: ExecStartPre=sleep 60 before ExecStart.

Mikaela avatar Feb 27 '21 07:02 Mikaela

Hey @Mikaela

The official CLI does not support auto-connect at the given moment. Any custom implementation should done so at own risk.

calexandru2018 avatar Feb 27 '21 09:02 calexandru2018