linux-cli-community
linux-cli-community copied to clipboard
[BUG] Running with systemd user service results into `There is no stored session. Please, login first.`
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
-
protonvpn-cli login username
-
cd ~/.config/systemd/user/
(mkdir
it if it doesn't exist) - Create a
protonvpn-user.service
with your favourite text editor. -
systemctl --user daemon-reload
-
systemctl --user enable protonvpn-user.service
-
reboot
-
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.
Workaround: ExecStartPre=sleep 60
before ExecStart
.
Hey @Mikaela
The official CLI does not support auto-connect at the given moment. Any custom implementation should done so at own risk.