2

I have this problem: I've set up a script to run on logout, and the script doesn't run.

The script is supposed to solve this problem: On shutdown, I get the message: "A stop job is running for session (number) of user (name)". This takes 90 seconds to time out, and I have no option of killing it. I don't want shutdown to take an extra 90 seconds.

Snippet of a screenshot of my shutdown log with the message.

This appears to be caused by ProtonVPN. If I follow this debugging guide, I can see a log message suggesting that the offending process is openvpn:

Sep 26 18:25:44 ... systemd[1]: session-1.scope: Stopping timed out. Killing.
Sep 26 18:25:44 ... systemd[1]: session-1.scope: Killing process 16246 (openvpn) with signal SIGKILL.

If I disconnect from ProtonVPN before shutting down, the problem is gone:

$ sudo protonvpn d

NB: I have added this application to my sudoers so I can sudo it without having to enter my password. This works fine for my startup script, at least.

What I want to do: Set up a script that disconnects from VPN (by running sudo protonvpn d) automatically upon logout.

So I've written a script containing this (and nothing else):

sudo protonvpn d > ~/protonvpn.txt

I pipe the output into a file purely in order to verify that the script gets run. I've set execution permissions on the script file so it can run:

-rwxrwxr-x 1 spectrum spectrum  35 Sep 24 18:48 shutdown.sh*

I can run the script manually from the command line and it generates the file ~/protonvpn.txt.

I've set up the script in System Settings -> Starup and Shutdown -> Autostart to run on logout. A symlink to the script appears in ~/.config/plasma-workspace/shutdown/. But when I log out, the file ~/protonvpn.txt does not get generated. And if I shut down while having VPN connected, I still get the 90 second timeout.

Am I doing something wrong? Why is my script not running?

Alternatively, can you give me any other advice on how to disconnect from VPN or otherwise fix the slow shutdown?

Thanks in advance!

5
  • I know that manually disconnecting from VPN from the command line can fix the problem. I don't know what details I CAN give about the running process. What kind of details are you expecting? Sep 26, 2020 at 13:36
  • What is the process? -- details like that
    – Nmath
    Sep 26, 2020 at 13:38
  • The shutdown screen says: "A stop job is running for session (number) of user (name)". I literally don't have more details than that. And I haven't found any way to debug it. Sep 26, 2020 at 13:40
  • Thanks. I've added some lines. Apparently the offending process is "openvpn". Sep 26, 2020 at 16:47

1 Answer 1

0

It turns out I need to use full paths in my script:

#!/bin/bash
sudo /usr/local/bin/protonvpn d

... or, if I want the text file output:

#!/bin/bash
sudo /usr/local/bin/protonvpn d > /home/$USER/protonvpn.txt

Now it seems to work.

Credit to koffeinfriedhof at forum.kde.org for this solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.