Linux: A stop job is running for Session c1 of user setevoy (1min 30s)

By | 05/15/2019

The issue happened on a fresh Arch Linux installation but the solution here can be used on any systemd-based distributive.

So, during restarts system hangs for 1.5 minutes with a message like:

A stop job is running for Session c1 of user setevoy (1min 30s)

To check which process(es) exactly caused this you can use journalctl with the -p5 (–priority) option:

[simterm]

$ journalctl -p5

[/simterm]

Then scroll down till the end and find messages containing “Killing”:

Feb 25 20:04:14 setevoy-arch-pc systemd[1]: session-1.scope: Stopping timed out. Killing.
Feb 25 20:04:14 setevoy-arch-pc systemd[1]: session-1.scope: Killing process 20420 (sudo) with signal SIGKILL.
Feb 25 20:04:14 setevoy-arch-pc systemd[1]: session-1.scope: Killing process 20429 (openvpn) with signal SIGKILL.
Feb 25 20:04:14 setevoy-arch-pc systemd[1]: session-1.scope: Failed with result ‘timeout’.

Next just need to find out why exactly those processes won’t stop in a normal way.

Another way is just to decrease timeouts to force stop such a process.

To do so – edit the /etc/systemd/system.conf file and set DefaultTimeoutStartSec and DefaultTimeoutStopSec options which are has 90 seconds by default:

...
DefaultTimeoutStartSec=30s
DefaultTimeoutStopSec=10s
...

Reload systemd‘s configs and on a next reboot they will be killed after 10 seconds timeout on shutdown:

[simterm]

$ sudo systemctl daemon-reload

[/simterm]

Done.