Sometimes it happens that a Wine application crashes (slowing down the system and making it almost unusable).
In most cases I'm able to kill the program with xkill
, but sometime I've to restart as Ubuntu seems not to respond very well (the only thing that works is ALT+F2, the launcher; xkill
doesn't).
I've tried to use wineboot -r
or -f
but they don't seem to work very well..
If something is unclear, let me know I'll try to explain better :)

- 424

- 687
5 Answers
You can safely kill wine sessions either via ALT+F2 or via a terminal by typing
wineserver -k
If it is really doesnt want to shutdown then you can force it via
wineserver -k9

- 172,746
killall nameofexefile.exe
just like linux processes

- 117,780

- 532
-
-
-
2So wineserver -k will kill all wine processes... it's what I meant... I don't use killall
.exe as often I don't know the exact name of the file (and when the system goes crazy I won't know in any case) – Hadden Jul 10 '11 at 00:49 -
ahhh right then in that case wineserver -k will probably do the job. Just be careful you don't have any other wine processes open, that includes programs in PlayOnLinux and Crossover too. – Conor Rynne Jul 10 '11 at 10:41
Well, as a wine programmer, I often will munge up the whole damn thing, so I use my super special killwine script. This is a hard death (wineserver -k
is the nice way to do it and always preferred).
#!/bin/bash
wine_cellar="${HOME}/.local/share/wine"
if (($#)); then
if [[ -e "${wine_cellar}/$1" ]]; then
WINEPREFIX="${wine_cellar}/$1"
shift
elif [[ "${1:0:1}" != "-" ]]; then
echo "ERROR: Didn't understand argument '$1'?" >&2;
exit 1
fi
fi
if ((${#WINEPREFIX})); then
pids=$(
grep -l "WINEPREFIX=${WINEPREFIX}$" $(
ls -l /proc/*/exe 2>/dev/null |
grep -E 'wine(64)?-preloader|wineserver' |
perl -pe 's;^.*/proc/(\d+)/exe.*$;/proc/$1/environ;g;'
) 2> /dev/null |
perl -pe 's;^/proc/(\d+)/environ.*$;$1;g;'
)
else
pids=$(
ls -l /proc/*/exe 2>/dev/null |
grep -E 'wine(64)?-preloader|wineserver' |
perl -pe 's;^.*/proc/(\d+)/exe.*$;$1;g;'
)
fi
if ((${#pids})); then
set -x
kill $* $pids
fi
This assumes that you're wine prefixes are under ~/.local/share/wine
. Usage examples are:
killwine # Just kill all instances of wine
killwine -9 # Hard kill them all
killwine lotro # Only kill wine under ${HOME}/.local/share/wine/lotro
killwine -INT lotro # Same as above, but use SIGINT
WINEPREFIX=/tmp/crap killwine # Kill only the instance under /tmp/crap
sudo reboot # Pretend you're running windows.
I don't know, but I don't think you'll often end up with various processes hung in memory (what this script takes care of) on a normal or even normal+staging release, but I do quite a lot because of hacking the server and ntdll.
EDIT: This script will only work on a Linux-based OS and assumes that the proc file system is mounted on /proc, etc.

- 197,895
- 55
- 485
- 740

- 206
-
-
Ahh, thanks! I seem to have lost my copy of this script and now I have it again! I should mention that this will only work on a Linux-based OS, as it digs through /proc. – Daniel Santos Jan 05 '17 at 04:55
My version:
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
It kills all wine processes. Thanks to this post https://askubuntu.com/a/732320/605355
-
lol, that's a snippet from my script! :) They just changed it to pipe to xargs instead of a bash sub-shell -- that's good because it will also work with /bin/sh. I've still had some processes not die though, when they hang prior to finishing the process init stuff in ntdll. Maybe I should try to submit my script, or some incarnation of it to mainline. EDIT: Oh, I see, that's your modified version :) – Daniel Santos Feb 17 '18 at 12:11
I was just about to have the same problem.
This command in terminal helped me. Press Ctrl + Alt + t and then write the following:
ps -x | grep "Your program name" | awk '{print $1}' | xargs kill
Your program name should be written without quotes,
It helped me solving oblivion.exe:
ps -x | grep Oblivion | awk '{print $1}' | xargs kill

- 111
- 3
winedevice.exe
running after I execute these commands. – Dan Dascalescu May 09 '21 at 00:13