wslg
wslg copied to clipboard
After each reboot [WARN: COPY-MODE] happens, many program fails to start
Windows build number:
10.0.22621.1194
Your Distribution version:
22.04
Your WSL versions:
WSL version: 1.1.0.0 Kernel version: 5.15.83.1 WSLg version: 1.0.48 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22621.1194
Steps to reproduce:
- Turn on computer.
- Open Windows Terminal
- type
geditand enter, notice [WARN: COPY-MODE], in title. GUI is slow. At lease gedit opens, many other programs fail to start bcz of this.
WSL logs:
WSL LOG by powershell script: WslLogs-2023-02-01_23-05-52.zip
Logs from /mnt/wslg: pulseaudio.log stderr.log weston.log wlog.log
Output of WSL Debug Console Window: WSL_Debug_console_output.txt
WSL dumps:
/mnt/wslg/dumps is empty.
Expected behavior:
Gui applications run flawlessly, without [WARN: COPY-MODE], and without lag.
Actual behavior:
Apps like gedit run with [WARN: COPY-MODE] in title. and gui is laggy, like any change, animations etc... Some programs outright fail to start.
Only workaround I discovered is to run wsl --shutdown several times and test if gedit is running okey, after trying 3-4 times, it fixes itself. But we need to careful not to close all terminal of ubuntu, if distro gets shut down after idle period, problem reappears.
AND 100% of the time when computer boots up it starts in wrong mode.
This is happening for couple of months, with several of latest wsl versions.
@sarim, thanks for reporting the issue, while [WARN: COPY-MODE] is not expected, but it should not prevent application from starting up, would you please share what apps are failing to start? thanks!
Thanks for reporting this @sarim. I see that you have a custom command line that disable cgroup_v1 in .wslconfig:
kernelCommandLine=cgroup_no_v1=all
This is probably the issue. Can you try removing that line, and then run wsl --shutdown and start wsl again and see if the issue is resolved ?
I don't have the command line option but still get the WARN: COPY-MODE message.
@sarim, thanks for reporting the issue, while [WARN: COPY-MODE] is not expected, but it should not prevent application from starting up, would you please share what apps are failing to start? thanks!
@hideyukn88 I don't remember exact apps now. But issue was with electron apps, those run with --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WaylandWindowDecorations. The hard crash issue kinda solved with electrons latest versions. But the glaring problem with [WARN: COPY-MODE] is, in this mode contents on display doesn't update correctly. For example in github-desktop, I'm seeing one file, now I click another file, the content still shows previous file, or the content showing is glitchy etc.. Whatevs, I don't think its necessary to try to fix things in [WARN: COPY-MODE]. I just don't want to run things in [WARN: COPY-MODE] . I want to run things in normal mode.
Thanks for reporting this @sarim. I see that you have a custom command line that disable cgroup_v1 in .wslconfig:
kernelCommandLine=cgroup_no_v1=allThis is probably the issue. Can you try removing that line, and then run wsl --shutdown and start wsl again and see if the issue is resolved ?
I've tried with that on and off. It doesn't matter. The root of the issue I think is this line.
rdp_allocate_shared_memory: Failed to open "/mnt/shared_memory/{ba3a781f-4787-440d-b2e6-82f295c7b564}" with error: Input/output error
In /mnt/wslg/weston.log. When this error shows up in weston.log, GUI applications open with [WARN: COPY-MODE].
@OneBlue I remember seeing this allocate shared memory issue in wsl/wslg issues too. It seems like a known and widely affected problem, not something only me is encountering. Was it properly debugged why allocating fails? Any Root issue to track it? Maybe a quick workaround could be weston should try to allocate it couple of times if it fails first time?
Since a couple of days I also have the same problem of windows showing [WARN: COPY-MODE] and I also see the error
rdp_allocate_shared_memory: Failed to open "/mnt/shared_memory/{02...d0c}" with error: Input/output error
in the /mnt/wslg/weston.log
I don't have any custom command line set up in .wslconfig
Is there a way to disable or customize/shorten the [WARN: COPY-MODE] header? It makes it hard to distinguish multiple open IDE windows to see which project is opened in which of the windows..
@tkonsta When you see WARN: COPY-MODE, run wsl --shutdown from powershell/cmd. Then open wsl again. For me it fixes the issue for that session.
I have this in my bashrc
if grep -q "rdp_allocate_shared_memory: Failed to open .* with error: Input/output error" "/mnt/wslg/weston.log"; then
echo -e "\n\033[1;31mAttention: WSLG Weston log file contains an error regarding shared memory allocation\033[0m\n"
fi
So whenever it shows the error, I do wsl --shutdown. And that fixes it for the session.
The frequency of this happening decreased significantly since I opened the issue, but the problem still definitely remains.
@tkonsta, @sarim, have you tired pre-release version of WSL which can be installed by wsl --update --pre-release? thanks!
I didn't try the update to the pre-release version yet and would prefer to wait for my productive work environment until WSL version 2 is officially released as stable.
However today I updated my Windows Nvidia GPU driver and after having installed the latest version with the "clean install" flag, the problem seems gone now. Could be a coincidence and I just hit one of the working attempts now, so I will keep an eye on how this evolves with the next restarts of WSL2.
@tkonsta, thanks for update, NVIDIA GPU driver is very unlikely the cause of this issue, but most likely, during that update, it might involve the restart of WSL and new instance of WSL didn't hit this issue, thanks!
@hideyukn88 Yes, I always keep updated with latest pre-release version. As per my normal workflow, I boot up my computer and shutdown before going to sleep, and I keep my wsl terminal always open. WSL has once per day chance of showing this bug. As I said, the frequency decreased over time with updates, but within last few days, with wsl v2.0.0 and v2.0.1, It happened once. So the issue remains but decreased.
@tkonsta, thanks for update, NVIDIA GPU driver is very unlikely the cause of this issue, but most likely, during that update, it might involve the restart of WSL and new instance of WSL didn't hit this issue, thanks!
You were totally right with that assumption, @hideyukn88 . It was just a single lucky restart attempt after installing the driver. Since then I didn't have one fine working WSL2 in about 10 restart attempts so far.
But at least thanks to the script in .bashrc, which was suggested by @sarim , now I can directly see that I will get the [WARN: COPY-MODE] headers and can decide to try some more restarts to get rid of it.
This seems related to #179, where the same underlying error is causing trouble, but the focus of the other ticket is different.
Also in #426 there are some workarounds mentioned on how to restart Weston without the need to shutdown the whole wsl distro (deep links: https://github.com/microsoft/wslg/issues/426#issuecomment-907635787 and https://github.com/microsoft/wslg/issues/426#issuecomment-908442965 )
I'm with latest pre-release of wsl as always. But problem seemed to came back with a vengeance for the last month. Always everyday It happens. Thanks to my script in https://github.com/microsoft/wslg/issues/972#issuecomment-1737468490 I always gets notified and do wsl --shutdown to fix it. I don't think it's even related to wsl/wslg version update, Rather a windows update. Because AFAIR it started happening after a windows update.
WSL version: 2.2.4.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.22621.3672
I also run into this issue almost every day
WSL version: 2.3.11.0 Kernel version: 6.6.36.3-1 WSLg version: 1.0.63 MSRDC version: 1.2.5326 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.26100.1-240331-1435.ge-release Windows version: 10.0.26100.1150
Yes, It's been a constant problem last couple of months. Always have to do wsl --shutdown.
I've been hitting this issue semi-regularly. Fairly annoying, but I found something less disruptive than wsl --shutdown:
wsl --system /bin/bash -c 'pgrep weston | xargs kill -9'
This only kills the GUI side of things, rather than taking down the whole WSL instance. I still need to restart the GUI programs, but they all start properly after running that command.
I didn't comment in here but in recent month it has been constant, each time when wsl first starts this happens. Even when wsl gets auto shutdown due to no linux program / terminal being open, then started again, this happens most of the time. It feels like this not only relates to WSL/WSLg but also related to windows itself, because seems like it started happening more with some windows updates.
Since this hasn't been solved in years, I'm guessing the underlying bug is hard to pin down/fix? So about a workaround inside WSLg official weston? Like if weston encounters this it'll retry after 100ms. 3 retry then fall back to this copy-mode?
Also related new, possible DUP https://github.com/microsoft/wslg/issues/1278
@jaybosamiya From the WIKI remember you can restart WSLg with Left-Ctrl + Left-Alt + Backspace.
To enable it, in PowerShell run notepad.exe $Env:USERPROFILE\.wslgconfig
and add this content:
[system-distro-env]
WESTON_RDPRAIL_SHELL_ALLOW_ZAP=true
After wsl.exe --shutdown you should be able to restart WSLg manually.