microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
10.08k stars 304 forks source link

Manual GUI shutdown/restart support #426

Open shebiki opened 3 years ago

shebiki commented 3 years ago

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.

cerebrate commented 3 years ago

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.

shebiki commented 3 years ago

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.

hideyukn88 commented 3 years ago

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!

shebiki commented 3 years ago

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.

hideyukn88 commented 3 years ago

@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!

Jerry-Ma commented 2 years ago

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?

RiccardoManzan commented 2 years ago

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

hideyukn88 commented 2 years ago

@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!

RiccardoManzan commented 2 years ago

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.

bestis commented 1 year ago

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.

hideyukn88 commented 1 year ago

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

bestis commented 1 year ago

@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 commented 1 year ago

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.

acampove commented 2 weeks ago

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.