wslg icon indicating copy to clipboard operation
wslg copied to clipboard

Manual GUI shutdown/restart support

Open shebiki opened this issue 4 years ago • 16 comments

It'd be helpful to have a way to shutdown or restart the GUI support without having to resort to a full wsl.exe --shutdown.

For those of us affected by bugs such as #179, #294, and #207 it would be great to have an interim workaround that didn't involve shutting down all of our WSL terminals and docker containers.

shebiki avatar Aug 27 '21 14:08 shebiki

While not a solution to this issue, a workaround I have been using has been to enter the relevant system distro with wsl --system, and then kill -9 the /usr/bin/weston process, allowing WSLGd to restart it. This method has restored normal GUI functionality for me for both #179 and #207.

cerebrate avatar Aug 28 '21 14:08 cerebrate

Thanks! I needed to restart the GUI components earlier and these steps did the trick. I didn't know there was a way to get into the system distro, had missed the --system flag in the help output and assumed it was hidden due to wsl --list --all not showing it.

This workaround is exactly what I was looking for to ease development while the team work out the remaining kinks.

shebiki avatar Aug 30 '21 14:08 shebiki

Personally, for development, I enabled "allow_zap" feature in shell to terminate weston by key-combination (L-CTRL, L-ALT and BACKSPACE), so we can expose this via .wslgconfig.

@shebiki, if you are experiencing https://github.com/microsoft/wslg/issues/294, would you please add some details on that issue? we would like to know more on how we can reproduce the issue, thanks!

hideyukn88 avatar Aug 30 '21 15:08 hideyukn88

The allow_zap feature sounds like it would be just right. Would you default that to enabled or would it be an opt-in feature?

I'm definitely experiencing my Linux apps just being unresponsive, not painting well (seems to be related to maximizing them) and all just closing at once. I'll spend some time and see if I can spot any specifics. It often happens after lunch so I'm assuming it's sleep related. Will attach whatever I find the the appropriate ticket.

shebiki avatar Aug 30 '21 20:08 shebiki

@shebiki,

Would you default that to enabled or would it be an opt-in feature?

It's opt in feature, please refer "WESTON_RDPRAIL_SHELL_ALLOW_ZAP" at Wiki, https://github.com/microsoft/wslg/wiki/WSLg-Configuration-Options-for-Debugging, thanks!

hideyukn88 avatar Sep 13 '21 19:09 hideyukn88

I am trying to enable this feature but without much success.

I created the file C:\Users\{USERNAME}\.wslgconfig with the content:

[system-distro-env]
WESTON_RDPRAIL_SHELL_ALLOW_ZAP=true

but I am not sure how to invoke the key combination. Is it a global hotkey like Ctrl-Alt-Del? I tried but nothing happens.

I also noticed that there are two locations for the wslgconfig, one is in the C:\Users the other is in C:\ProgramData. Should I create the wslgconfig in the ProgramData folder?

Jerry-Ma avatar May 26 '22 13:05 Jerry-Ma

I enabled the feature but when pressing Left-Ctrl + Left-Atl + Backspace nothing happens.

RiccardoManzan avatar Jul 07 '22 09:07 RiccardoManzan

@RiccardoManzan, would you run below command to make sure the feature (allow_zap) is enabled (1) ?

hideyukn@HIDEYUKN-SL:~$ grep zap /mnt/wslg/weston.log
[11:37:35.593] RDPRAIL-shell: allow-zap:1

And Left-Ctrl + Left-Atl + Backspace must be pressed while any Linux GUI application is at foreground with input focus on Windows desktop, regardless the Linux GUI applications are functioning or not, thus inputs will be sent to Linux container.

Thanks!

hideyukn88 avatar Jul 08 '22 18:07 hideyukn88

It looks like i was inserting wslg options in .wslconfig but those should go in a .wslgconfig file. Actually that G is not so visible, i suggest to add a note here specifying that this file is a separed file than .wslconfig.

RiccardoManzan avatar Aug 09 '22 10:08 RiccardoManzan

And Left-Ctrl + Left-Atl + Backspace must be pressed while any Linux GUI application is at foreground with input focus on Windows desktop, regardless the Linux GUI applications are functioning or not, thus inputs will be sent to Linux container.

And that's the problem. When it crashes for me, it crashes so that it doesn't open the window. There's just icon in the taskbar, but no window to take focus and do the zap. So kind of enabling zap does not help at all.

Some wsl --restart-wslg or something would be needed IMHO.

bestis avatar Jul 03 '23 08:07 bestis

@bestis, would you please share log files from /mnt/wslg/*.log and do you see any core dumps at /mnt/wslg/dumps? thanks!

hideyukn88 avatar Jul 05 '23 20:07 hideyukn88

@hideyukn88, I'll try to remember look mode closely next time it happens. But I can tell that at least it was running, as I needed to kill it, to restart it, so I doubt core dumps. I have kind of feeling that hibernate might be one cause for it. Could probably try to reproduce it with hibernate also tomorrow.

bestis avatar Jul 05 '23 20:07 bestis

Tested today to hibernate and after it it still worked. So didn't manage to reproduce it. Here's the logs: logs.zip No core dumps.

I'll try to remember looking logs more in detail next time it happens, don't know does those have anything meaningful.

bestis avatar Jul 06 '23 06:07 bestis

It's been 4 years, has there been any progress? I guess the answer is No. OK, thanks, I will move back to linux then.

acampove avatar Sep 04 '24 23:09 acampove

For newcomers, in summary:

  1. Create .wslgconfig in %APPDATA%:
[system-distro-env]
WESTON_RDPRAIL_SHELL_ALLOW_ZAP=true
  1. Restart WSL.
  2. Use LCTRL+LALT+BACKSPACE to kill wslg.

devkinetic avatar Jan 07 '25 19:01 devkinetic

@devkinetic

  1. Create .wslgconfig in %APPDATA%:

Again, it's not %APPDATA%, but %USERPROFILE%.

Zevan770 avatar Sep 21 '25 13:09 Zevan770