https://bugs.winehq.org/show_bug.cgi?id=56797
Bug ID: 56797 Summary: winedevice.exe stalls systemd shutdown/reboot Product: Wine Version: 9.9 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: cromachina@gmail.com Distribution: ---
After running random applications in Wine (and subsequently closing them), I've observed system shutdown being stalled by a systemd message: "A stop job is running for User Manager for UID 1000", which goes on for about 2 minutes before forcefully terminating. Upon further investigation, the reason always seems to be 'winedevice.exe', which seems to be not gracefully handling SIGTERM. After systemd's timeout, it just sends SIGKILL instead and continues to shutdown/reboot.
It seems like the correct behavior should be: either systemd asking Wine services to terminate gracefully should just work without issue or stalls, or Wine should provide a systemd service that handles calling a shutdown routine (like calling `wineserver -k` at the right moment).
For some reason, I could not get `wineserver -k` to work at the right time with a systemd service, however I instead created a service that calls `pkill -9 .exe`, which does work. I'm using NixOS, so I configured the service like so:
systemd.services."wine-shutdown" = { enable = true; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; ExecStop = "${pkgs.procps}/bin/pkill -9 .exe"; }; before = [ "shutdown.target" "reboot.target" "halt.target" ]; wantedBy = [ "multi-user.target" ]; };
I'm not sure if the programs that were previously ran make a difference, except that they had ran at all, but I often use Paint Tool SAI and consistently encounter this shutdown stall situation after using it, so it can be used as a reference point: https://www.systemax.jp/en/sai/devdept.html
Various reports I've seen across the net exhibiting similar behavior: https://unix.stackexchange.com/questions/720725/process-winedevice-exe-delay... https://forum.endeavouros.com/t/problem-wine-stop-shutdown-or-reboot/32223/1... https://discussion.fedoraproject.org/t/wine-process-delaying-shutdown/68130 https://forum.winehq.org/viewtopic.php?t=38189