Open me-and opened 1 year ago
Per https://github.com/mintty/wsltty/issues/342#issuecomment-1741984440 it looks like it's a change in an undocumented interface.
I got the same problem with Ubuntu.
I'm suddenly having the same issue on my work PC, however just trying to start WSL normally causes the error.
m:\>wsl
Disken 'C:\wsl\arch\ext4.vhdx' kunne ikke tilsluttes WSL2: The process cannot access the file because it is being used by another process.
Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_SHARING_VIOLATION
Version info:
c:\>wsl --version
WSL-version: 2.0.9.0
Kerneversion: 5.15.133.1-1
WSLg-version: 1.0.59
MSRDC-version: 1.2.4677
Direct3D-version: 1.611.1-81528511
DXCore-version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows-version: 10.0.19045.3570
I tried looking up file handles with the Resource Monitor and Process Explorer, but I can't find anything using the file.
I've had a few successes with launching WSL through cmd.exe
and the Arch.exe
that came with my installer, and it seems like waiting a few minutes after running wsl --shutdown
can help. Still haven't been able to launch it through WSLtty, though.
Same issue as the above user "Ricaz" with the same version after a Windows update of "Windows Subsystem for Linux" last night:
WSL-version: 2.0.9.0
Emitted mintty.exe with a -log option and get:
note: wsl.exe output: Failed to attach disk 'C:\Users\MYUSERNAME\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx' to WSL2: The process cannot access the file because it is being used by another process. Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_SHARING_VIOLATION
I'm able to invoke wsl.exe via the cmd prompt without issue.
Same issue here after windows update today.
wsl --version WSL version: 2.0.9.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19045.3693
wsl --list Windows Subsystem for Linux Distributions: Ubuntu-18.04 (Default)
.\mintty.exe --version pop up dialog indicates 3.6.4 @2023
So, after replacing the wsltty binaries with version 3.7.0 (from 3.6.4) and getting a similar yet different error:
ERROR: GetVmId:318: CreateLxProcess: The process cannot access the file because it is being used by another process.
I downgraded by Ubuntu container to wsl version 1 with:
wsl --list --verbose
wsl --set-version [Ubuntu name] 1
This may cause other unknown issues, but it seems to have solve this particular issue. Another thread alludes to WSL version 2 compatibility issues. Apparently wslbridge2.exe is hooking into undocumented API calls within WSL version 2 (likely using LoadLibrary and GetProcAddress) and Microsoft is changing API points and behaviour under the hood. Who knows what is happening here -- I certainly do not.
I became desperate and started looking around for an alternative to WSL Terminal. Windows Terminal from the app store works very nicely. You can set it to launch your WSL VM by default in the settings. The colors look right in vim. The font it uses by default looks great to me. Supports hot keys for tabbing. The interface seems simpler and cleaner than ConEmu. I like it so far.
I became desperate and started looking around for an alternative to WSL Terminal. Windows Terminal from the app store works very nicely. You can set it to launch your WSL VM by default in the settings. The colors look right in vim. The font it uses by default looks great to me. Supports hot keys for tabbing. The interface seems simpler and cleaner than ConEmu. I like it so far.
I ended up doing the same. It has a lot of annoying Windows hotkeys by default, but after removing most of them, it works okay.
Only thing is it feels really heavy and laggy, where mintty is super responsive and light.
When it just worked out of the box, I became a bit suspicious that Microsoft might intentionally be blocking alternatives..
I have the same issue as described with wsltty 3.7.0, WSL 2.0.9.2 on Windows 10.0.19044.3570
And I don't want to switch away from wsltty 😿
wslbridge2 has been updated to handle the API change. wsltty is not yet updated but just replacing the wslbridge2.exe with the nightly cygwin build will fix the issue.
See discussion here https://github.com/mintty/wsltty/issues/343
Works again with wsltty-3.7.0.2
What happened to me was that I accidentally double-clicked the VHD file and Windows mounted it automatically. I detached it via Computer Management > Disk Management and there's an offline VHD disk attached. I believe I marked it as offline at first too via dispark where I usually do compact disk.
Windows Version
Microsoft Windows [Version 10.0.22631.2338]
WSL Version
2.0.0.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.123.1-microsoft-standard-WSL2
Distro Version
Debian trixie
Other Software
WSLtty 3.6.1.2
Repro Steps
Since a recent Windows or WSL update[^1], attempting to use WSL via WSLtty fails.
Repro steps:
C:\Users\adinwoodie\AppData\Local\wsltty\bin\mintty.exe --WSL="Debian" --configdir="C:\Users\adinwoodie\AppData\Roaming\wsltty" -~ -
from the Run dialog[^1]: This was working fine yesterday, 25 September 2023, and is failing today, 26 September 2023, although I hadn't booted my computer for approximately three weeks prior to 25 September, so there were a relatively large number of updates to install; the full list of installed updates for me per Windows Update is at mintty/wsltty#342.
Expected Behavior
I get a WSLtty terminal I can use to access my Debian WSL installation.
Actual Behavior
The WSLtty window appears for a fraction of a second, then disappears.
Diagnostic Logs
Running WSLtty as
C:\Users\adinwoodie\AppData\Local\wsltty\bin\mintty.exe --WSL="Debian" --configdir="C:\Users\adinwoodie\AppData\Roaming\wsltty" -~ -h always -
– i.e. with the window set to not automatically close – produces a window with the following error message:I'll send the WSL logs in by email shortly.