Workaround "Shutdown cancelled by ..."


I try to get a workaround for the “Some apps cancel shutdown and reboot”
As its always the same programs that prevent my shutdown (qtorrent, ts3 & mozilla vpn) i thought i could just make a script to kill these apps first and initiate the normal save shutdown (the one that stops if something is not saved) afterwards.

I tried to kill them with a script i add to “~/.bash_logout” and/or “/etc/bash.bash_logout”. But it looks like this is executed too late as i still get the error. I think it should be executed before Logout?

I tried to do that via systemd but as I don’t really understand what I’m doing I have no idea how i should do that or if there even is a target for logout? And the few Tutorials i found online and understood did not really help.

Right now i just execute a script that kills all these programs and shut down afterwards by hand, which is just a dirty “fix” imo.

I’m not sure if I’m right here but maybe someone can help me.
Thanks in advance already.

Operating System: Manjaro Linux
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2
Kernel Version: 5.10.49-1-MANJARO (64-bit)
Graphics Platform: X11
Processors: 24 × AMD Ryzen 9 3900X 12-Core Processor
Memory: 31,4 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1070/PCIe/SSE2

in plasma config we can add scripts at shutdown

(menu traduction to english ) start/stop → automatic start → add → disconnect script
script (link) added in ~/.config/plasma-workspace/shutdown/

script without sudo :wink:

with systemd , one example

with systemd, script can run as root

I went with the systemd way, and if i trust the log the script was also successful.
But its still does not solve the problem, as to even get to shutdown these programs need to be stopped already, see this post:

The .service file I made:

Description=Kill TS3, BitTorrent, VPN and Dolphin before shutdown

ExecStart=/bin/ start


I tried something like but apparently that does not exist.

You can redo the shutdown action it will not bother you twice in theory. When it happens to me on a reboot (TeamSpeak) I reclick reboot and it executes.
You may report this behavior as an issue to the respective apps, maybe ask for a setting to disable that?

I have the same problem for teamspeak, qtorrent and mozzillavpn. Each of them prevents it, so i need to press shutdown 4 times and that is getting very annoying. I will try to write the devs of the programs and ask about that when i find the time.

Now that I think abut it, for TeamSpeak there is no reason for that. But for the VPN, or the torrent client, there might be some, for example the VPN can do some stuff in the system when you enable it, and not shutting it down properly might mess the system (good example with NordVPN with the killswitch setting, if not shutdown properly you have no network on reboot, you need to start VPN and enable the killswitch, then shutdown the VPN cleanly to reset the system), same might go for the torrent client, maybe it is a security about the file transfer to not corrupt downloads?.

Anyway I didn’t know that it would trigger each app independently one by one doing what I suggested, so it is not useful.

Thats why i wanted execute a script to send a terminate signal to each of these. My guess was that sending a terminate signal should result in more or less proper exiting. The few times i tried to execute it by hand i noticed no problems for how much that may be worth…