protonscr

Bruteforce kill all proton wineservers option (to be called on steam exit)

protonopen
ValveSoftware/Proton#114 · opened 2018-08-22 by Houkime · updated 2020-06-27 · 12 comments · github
3 matching comments, n / p to jump
HHoukime 2018-08-22 github

As of now misbehaving winebottles under proton might be tricky to shutdown clean.
Even exiting steam client doesn't clean up running wineservers and tasks.
Thus there needs to be a hard option to kill all bottles on steamexit and also preferrably from CLI for steam-unrelated proton usage.

Ddaniel-j 2018-08-22 github

wineserver -k is the command to kill current wineprefix.

HHoukime 2018-08-22 github

I tried it before writing this issue.
Plain wineserver -k doesn't work for proton because it uses a separate prefix from system-wide wine.
To use wineserver -k on non-default prefix you need to specify exact prefix proton uses which is a long name which you need to actually find first because it is generated.
Also they can be multiple.

HHoukime 2018-08-22 github

Besides, It would be just nice of steam not to leave running wineservers on exit even if wineserver -k were working out of the box.

Ffrostworx 2020-02-18 github

ancient issue, but still open.
I use
PFX=$(lsof | grep compatdata | grep 'pfx$' | awk '{print $NF}')
WINEPREFIX=$PFX wineserver -k
to "gracefully" stop the currently running proton game

Jjoeknock90 2020-02-23 github

@frostworx You rock. This works perfectly every time for me. I threw this in a bash script and bound it to a key combination. Whenever a proton game locks up this kills it immediately for me and I can start it right back up.

Thanks!

Ffrostworx 2020-02-23 github

hehe, great to hear someone has some use for it! thank you for the friendly feedback! :)

Llucifertdark 2020-02-23 github

Neat! Thanks frostworx, this will come in very handy. :)

Ffrostworx 2020-02-23 github

thank you for your feedback as well! :)

UUnaccounted4 2020-03-11 github

Thank you!

I have a script that nukes all misbehaving WINE apps and it was missing the Proton ones.

For reference:

#! /bin/bash
wineserver -k
find $HOME/.PlayOnLinux/wineprefix/* -maxdepth 0 -exec /bin/bash -c 'export WINEPREFIX="{}"; /usr/bin/wineserver -k' \;
PFX=$(lsof | grep compatdata | grep 'pfx$' | awk '{print $NF}')
WINEPREFIX=$PFX wineserver -k
exit 0
Ffrostworx 2020-03-12 github

nice!
I have the command in a script which is mapped to a amazon-dash button.
so when the steamvr dashboard doesn't work again I can still "exit" the game and continue with another vr game easily ;)
https://github.com/ValveSoftware/SteamVR-for-Linux/issues/255#issuecomment-579315972

Sshoober420 2020-04-18 github

@Houkime
Completely agree. Steam must close all Proton processes on exit, since it’s part of Steam itself.

Honestly, I feel Steam should force kill all Proton processes on each game exit or crash. So each new launch of a game is a fresh clean slate. Running another game from the same old Proton processes that crashed from another game sounds a little mucky and whacky.

When I run wineserver -k, I get command not found: wineserver.

I’m not surprised, because I don’t have Wine or Winetricks installed on my system, only Proton through Steam. This means those above scripts have no effect on my Proton processes. I scavenged the internet for alternatives and came up with this script that does indeed kill all Proton processes without Wine or Winetricks being installed.

https://gist.github.com/shoober420/e795942fd4e36a6b1d9d4b88e288a832

ls -l /proc/*/exe 2>/dev/null | grep -E 'wine(64)?-preloader|wineserver' | perl -pe 's;^.*/proc/(\d+)/exe.*$;$1;g;' | xargs -n 1 kill | killall -s9 winedevice.exe tee
Wwraith3690 2020-06-27 github

sweet thnx so much and I agree this is needed!! on a side note I have discovered (at least for me) that if I close steam before I close a game that leaves wine processes open they seem to close properly

Launch options