Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some files in /mnt appear only 2 bytes long => flurry of errors in /mnt/wslg/stderr.log #9261

Closed
1 of 2 tasks
colemar opened this issue Dec 2, 2022 · 12 comments
Closed
1 of 2 tasks

Comments

@colemar
Copy link

colemar commented Dec 2, 2022

Version

Windows version: 10.0.19045.2311

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.15.79.1

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

Install Ubuntu 22.04 via .appx package from https://aka.ms/wslubuntu2204 (or perhaps wsl --install Ubuntu).
Enable systemd.

root@VERDE:~# sudo apt install x11-apps
root@VERDE:~# xclock # it works

root@VERDE:~# tail -f /mnt/wslg/stderr.log
/mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe: line 1: MZ: command not found
[00:22:15.232] <5>WSLGd: Run:104: pid 591325 exited with status 127, /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe /v:022336E4-DDD9-4DF6-BDF2-4063D81F69D9 /hvsocketserviceid:401D9BBF-FACB-11E6-BD58-64006A7986D3 /silent /wslg /plugin:WSLDVC_PACKAGE /wslgsharedmemorypath:WSL\022336E4-DDD9-4DF6-BDF2-4063D81F69D9\wslg C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.3.0_x64__8wekyb3d8bbwe\wslg.rdp
/mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe: line 1: MZ: command not found
[00:22:15.250] <5>WSLGd: Run:104: pid 591327 exited with status 127, /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe /v:022336E4-DDD9-4DF6-BDF2-4063D81F69D9 /hvsocketserviceid:401D9BBF-FACB-11E6-BD58-64006A7986D3 /silent /wslg /plugin:WSLDVC_PACKAGE /wslgsharedmemorypath:WSL\022336E4-DDD9-4DF6-BDF2-4063D81F69D9\wslg C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.3.0_x64__8wekyb3d8bbwe\wslg.rdp
...

root@VERDE:~# ls -l /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe
-r-xr-xr-x 1 colem colem 2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe
root@VERDE:~# cat /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe | wc -c
2
root@VERDE:~# ls -l $(find /mnt/c/Users/colem/AppData/Local/Microsoft -type f -name '*.exe')
-rwxrwxrwx 1 colem colem    506728 Nov 28  2019 /mnt/c/Users/colem/AppData/Local/Microsoft/OneDrive/19.192.0926.0012/FileCoAuth.exe
-rwxrwxrwx 1 colem colem    364392 Nov 28  2019 /mnt/c/Users/colem/AppData/Local/Microsoft/OneDrive/19.192.0926.0012/FileSyncConfig.exe
-rwxrwxrwx 1 colem colem   2133352 Nov 28  2019 /mnt/c/Users/colem/AppData/Local/Microsoft/OneDrive/19.192.0926.0012/FileSyncHelper.exe
-rwxrwxrwx 1 colem colem  35086184 Nov 28  2019 /mnt/c/Users/colem/AppData/Local/Microsoft/OneDrive/19.192.0926.0012/OneDriveSetup.exe
-rwxrwxrwx 1 colem colem   2487144 Nov 28  2019 /mnt/c/Users/colem/AppData/Local/Microsoft/OneDrive/19.192.0926.0012/OneDriveUpdaterService.exe
-rwxrwxrwx 1 colem colem   1585000 Nov 28  2019 /mnt/c/Users/colem/AppData/Local/Microsoft/OneDrive/OneDrive.exe
-rwxrwxrwx 1 colem colem   2712936 Nov 28  2019 /mnt/c/Users/colem/AppData/Local/Microsoft/OneDrive/OneDriveStandaloneUpdater.exe
-rwxrwxrwx 1 colem colem   2585920 Nov 28 16:05 /mnt/c/Users/colem/AppData/Local/Microsoft/Teams/Update.exe
-rwxrwxrwx 1 colem colem   2585920 Nov 28 16:05 /mnt/c/Users/colem/AppData/Local/Microsoft/Teams/current/Squirrel.exe
-rwxrwxrwx 1 colem colem 140160280 Nov 28 16:05 /mnt/c/Users/colem/AppData/Local/Microsoft/Teams/current/Teams.exe
-rwxrwxrwx 1 colem colem   2585920 Nov  2 14:35 /mnt/c/Users/colem/AppData/Local/Microsoft/Teams/previous/Squirrel.exe
-rwxrwxrwx 1 colem colem 140154688 Nov  2 14:35 /mnt/c/Users/colem/AppData/Local/Microsoft/Teams/previous/Teams.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 21:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc/ubuntu2004.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 22:15 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc/ubuntu.exe
-r-xr-xr-x 1 colem colem         2 Oct  8 16:09 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/GameBarElevatedFT_Alias.exe
-r-xr-xr-x 1 colem colem         2 Nov 20 18:48 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe/python.exe
-r-xr-xr-x 1 colem colem         2 Nov 20 18:48 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe/python3.exe
-r-xr-xr-x 1 colem colem         2 Nov 20 18:48 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe/winget.exe
-r-xr-xr-x 1 colem colem         2 Jun 12  2021 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/MicrosoftEdge.exe
-r-xr-xr-x 1 colem colem         2 Nov 26 21:19 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/Microsoft.SkypeApp_kzf8qxf38zg5c/Skype.exe
-r-xr-xr-x 1 colem colem         2 Nov 28 14:11 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/Microsoft.WindowsTerminal_8wekyb3d8bbwe/wt.exe
-r-xr-xr-x 1 colem colem         2 Oct  8 16:09 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/Microsoft.XboxGamingOverlay_8wekyb3d8bbwe/GameBarElevatedFT_Alias.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/bash.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/wsl.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/wslconfig.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/wslg.exe
-r-xr-xr-x 1 colem colem         2 Apr 17  2021 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftEdge.exe
-r-xr-xr-x 1 colem colem         2 Nov 26 21:19 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/Skype.exe
-r-xr-xr-x 1 colem colem         2 Nov 20 18:48 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/TheDebianProject.DebianGNULinux_76v4gfsz19hv4/debian.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/bash.exe
-r-xr-xr-x 1 colem colem         2 Nov 20 18:48 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/debian.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/msrdc.exe
-r-xr-xr-x 1 colem colem         2 Nov 20 18:48 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/python.exe
-r-xr-xr-x 1 colem colem         2 Nov 20 18:48 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/python3.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 22:15 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/ubuntu.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 21:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/ubuntu2004.exe
-r-xr-xr-x 1 colem colem         2 Nov 20 18:48 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/winget.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/wsl.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/wslconfig.exe
-r-xr-xr-x 1 colem colem         2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/wslg.exe
-r-xr-xr-x 1 colem colem         2 Nov 28 14:11 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/wt.exe
root@VERDE:~# cat /mnt/c/Users/colem/AppData/Local/Microsoft/OneDrive/OneDrive.exe | wc -c
1585000
root@VERDE:~# cat /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftEdge.exe | wc -c
2
root@VERDE:~# wslpath -w /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/msrdc.exe
C:\Users\colem\AppData\Local\Microsoft\WindowsApps\msrdc.exe

Open elevated CMD.EXE

c:\>dir C:\Users\colem\AppData\Local\Microsoft\WindowsApps\msrdc.exe
 Volume in drive C is System
 Volume Serial Number is 16F5-BA47

 Directory of C:\Users\colem\AppData\Local\Microsoft\WindowsApps

02/12/2022  20:06                 0 msrdc.exe
               1 File(s)              0 bytes
               0 Dir(s)  168.966.791.168 bytes free

(WSL was updated to last version around time 02/12/2022  20:06)

c:\>C:\Users\colem\AppData\Local\Microsoft\WindowsApps\msrdc.exe
("Remote Desktop Usage" window appears)

c:\>attrib C:\Users\colem\AppData\Local\Microsoft\WindowsApps\msrdc.exe
The target of the symbolic link C:\Users\colem\AppData\Local\Microsoft\WindowsApps\msrdc.exe does not exist

c:\>attrib C:\Users\colem\AppData\Local\Microsoft\WindowsApps\MicrosoftEdge.exe
The target of the symbolic link C:\Users\colem\AppData\Local\Microsoft\WindowsApps\MicrosoftEdge.exe does not exist

c:\>dir C:\Users\colem\AppData\Local\Microsoft\WindowsApps\MicrosoftEdge.exe
 Volume in drive C is System
 Volume Serial Number is 16F5-BA47

 Directory of C:\Users\colem\AppData\Local\Microsoft\WindowsApps

17/04/2021  20:25                 0 MicrosoftEdge.exe
               1 File(s)              0 bytes
               0 Dir(s)  168.969.625.600 bytes free

Expected Behavior

No errors in /mnt/wslg/stderr.log.
Good symbolic links in C:\Users\colem\AppData\Local\Microsoft\WindowsApps\

Actual Behavior

See Repro Steps.

Diagnostic Logs

No response

@colemar
Copy link
Author

colemar commented Dec 2, 2022

c:\>fsutil reparsepoint query C:\Users\colem\AppData\Local\Microsoft\WindowsApps\msrdc.exe
Reparse Tag Value : 0x8000001b
Tag value: Microsoft

Reparse Data Length: 0x1f0
Reparse Data:
0000:  03 00 00 00 4d 00 69 00  63 00 72 00 6f 00 73 00  ....M.i.c.r.o.s.
0010:  6f 00 66 00 74 00 43 00  6f 00 72 00 70 00 6f 00  o.f.t.C.o.r.p.o.
0020:  72 00 61 00 74 00 69 00  6f 00 6e 00 49 00 49 00  r.a.t.i.o.n.I.I.
0030:  2e 00 57 00 69 00 6e 00  64 00 6f 00 77 00 73 00  ..W.i.n.d.o.w.s.
0040:  53 00 75 00 62 00 73 00  79 00 73 00 74 00 65 00  S.u.b.s.y.s.t.e.
0050:  6d 00 46 00 6f 00 72 00  4c 00 69 00 6e 00 75 00  m.F.o.r.L.i.n.u.
0060:  78 00 5f 00 38 00 77 00  65 00 6b 00 79 00 62 00  x._.8.w.e.k.y.b.
0070:  33 00 64 00 38 00 62 00  62 00 77 00 65 00 00 00  3.d.8.b.b.w.e...
0080:  4d 00 69 00 63 00 72 00  6f 00 73 00 6f 00 66 00  M.i.c.r.o.s.o.f.
0090:  74 00 43 00 6f 00 72 00  70 00 6f 00 72 00 61 00  t.C.o.r.p.o.r.a.
00a0:  74 00 69 00 6f 00 6e 00  49 00 49 00 2e 00 57 00  t.i.o.n.I.I...W.
00b0:  69 00 6e 00 64 00 6f 00  77 00 73 00 53 00 75 00  i.n.d.o.w.s.S.u.
00c0:  62 00 73 00 79 00 73 00  74 00 65 00 6d 00 46 00  b.s.y.s.t.e.m.F.
00d0:  6f 00 72 00 4c 00 69 00  6e 00 75 00 78 00 5f 00  o.r.L.i.n.u.x._.
00e0:  38 00 77 00 65 00 6b 00  79 00 62 00 33 00 64 00  8.w.e.k.y.b.3.d.
00f0:  38 00 62 00 62 00 77 00  65 00 21 00 6d 00 73 00  8.b.b.w.e.!.m.s.
0100:  72 00 64 00 63 00 00 00  43 00 3a 00 5c 00 50 00  r.d.c...C.:.\.P.
0110:  72 00 6f 00 67 00 72 00  61 00 6d 00 20 00 46 00  r.o.g.r.a.m. .F.
0120:  69 00 6c 00 65 00 73 00  5c 00 57 00 69 00 6e 00  i.l.e.s.\.W.i.n.
0130:  64 00 6f 00 77 00 73 00  41 00 70 00 70 00 73 00  d.o.w.s.A.p.p.s.
0140:  5c 00 4d 00 69 00 63 00  72 00 6f 00 73 00 6f 00  \.M.i.c.r.o.s.o.
0150:  66 00 74 00 43 00 6f 00  72 00 70 00 6f 00 72 00  f.t.C.o.r.p.o.r.
0160:  61 00 74 00 69 00 6f 00  6e 00 49 00 49 00 2e 00  a.t.i.o.n.I.I...
0170:  57 00 69 00 6e 00 64 00  6f 00 77 00 73 00 53 00  W.i.n.d.o.w.s.S.
0180:  75 00 62 00 73 00 79 00  73 00 74 00 65 00 6d 00  u.b.s.y.s.t.e.m.
0190:  46 00 6f 00 72 00 4c 00  69 00 6e 00 75 00 78 00  F.o.r.L.i.n.u.x.
01a0:  5f 00 31 00 2e 00 30 00  2e 00 33 00 2e 00 30 00  _.1...0...3...0.
01b0:  5f 00 78 00 36 00 34 00  5f 00 5f 00 38 00 77 00  _.x.6.4._._.8.w.
01c0:  65 00 6b 00 79 00 62 00  33 00 64 00 38 00 62 00  e.k.y.b.3.d.8.b.
01d0:  62 00 77 00 65 00 5c 00  6d 00 73 00 72 00 64 00  b.w.e.\.m.s.r.d.
01e0:  63 00 2e 00 65 00 78 00  65 00 00 00 30 00 00 00  c...e.x.e...0...

https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/c8e77b37-3909-4fe6-a4ea-2b9d423b1ee4

IO_REPARSE_TAG_APPEXECLINK 0x8000001B Used by Universal Windows Platform (UWP) packages to encode information that allows the application to be launched by CreateProcess. Server-side interpretation only, not meaningful over the wire.

@colemar
Copy link
Author

colemar commented Dec 3, 2022

https://stackoverflow.com/questions/71697488/follow-hard-links-reparsepoints-to-files-windows-terminal

is an example of yet another kind of reparse point: an AppX reparse point aka app execution alias aka (internally) AppExecLink.

These are used by UWP applications, which notably includes all applications downloaded from the Microsoft Store.

While they are conceptually similar to symlinks, there are important differences:

The link target isn't necessarily the true target executable; it may just be the generic UWP launcher, C:\WINDOWS\system32\SystemUWPLauncher.exe, such as in the case of Microsoft Edge.

More importantly, though, Microsoft considers the reparse data associated with app execution aliases (AppX reparse points) to be an undocumented implementation detail, subject to change.[1] In other words:

You should treat an app execution alias just like any other (regular, self-contained) executable and not as a link to another executable.

It seems that WSL cannot parse this kind of reparse point.

@colemar
Copy link
Author

colemar commented Dec 3, 2022

Apparently WSLg is trying to open a remote destop connection, but the file wslg.rdp looks incomplete:

audiocapturemode:i:2
authentication level:i:0
disableconnectionsharing:i:1
enablecredsspsupport:i:0
hvsocketenabled:i:1
remoteapplicationmode:i:1
remoteapplicationprogram:s:dummy-entry

This command from a CMD console opens a small window [RemoteApp] "Starting your app" that never connects.

"c:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.3.0_x64__8wekyb3d8bbwe\msrdc.exe" /v:022336E4-DDD9-4DF6-BDF2-4063D81F69D9 /hvsocketserviceid:401D9BBF-FACB-11E6-BD58-64006A7986D3 /wslg /plugin:WSLDVC_PACKAGE /wslgsharedmemorypath:WSL\022336E4-DDD9-4DF6-BDF2-4063D81F69D9\wslg "C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.3.0_x64__8wekyb3d8bbwe\wslg.rdp"

@elsaco
Copy link

elsaco commented Dec 3, 2022

@colemar the issue is not the reparsing. If you look at the output when you run fsutil reparespoint query it points to the actual RDP binary located at:

PS C:\> ls 'C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.0.0_x64__8wekyb3d8bbwe\msrdc.exe'

    Directory: C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.0.0_x64__8wekyb3d8bbwe

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           12/1/2022  6:59 PM        2568096 msrdc.exe

In my case is version 1.0.0. Looks like you're on version 1.0.3 already.

@colemar
Copy link
Author

colemar commented Dec 3, 2022

Wait, on my system /mnt/wslg/stderr.log refers to /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe

and

root@VERDE:~# ll '/mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe'
-r-xr-xr-x 1 colem colem 2 Dec  2 20:06 /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe*

root@VERDE:~# cat '/mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe' | wc -c
2
root@VERDE:~# xxd '/mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe'
00000000: 4d5a                                     MZ

root@VERDE:~# wslpath -w '/mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe'
C:\Users\colem\AppData\Local\Microsoft\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe\msrdc.exe

Now in CMD.EXE

C:\>dir "C:\Users\colem\AppData\Local\Microsoft\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe\msrdc.exe"
 Volume in drive C is System
 Volume Serial Number is 16F5-BA47

 Directory of C:\Users\colem\AppData\Local\Microsoft\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe

02/12/2022  20:06                 0 msrdc.exe
               1 File(s)              0 bytes
               0 Dir(s)  167.923.810.304 bytes free

(zero bytes?)

C:\>"C:\Users\colem\AppData\Local\Microsoft\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe\msrdc.exe"
(this opens a "Remote Desktop Usage" window nonetheless)

It seems to me that WSL sees the reparse point as a file of 2 bytes size containing only "MZ", while Windows understands the reparse point (at least when launching the process msrdc.exe).

@colemar
Copy link
Author

colemar commented Dec 3, 2022

And it seems strange for WSL to refer to C:\Users\colem\AppData\Local\Microsoft\WindowsApps instead of C:\Program Files\WindowsApps.
Even if colem is the user that installed WSL, why?

@gnw3
Copy link

gnw3 commented Dec 6, 2022

I see the same symptoms as @colemar describes on this box,

> wsl --version
WSL version: 1.0.3.0
Kernel version: 5.15.79.1
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.2311

Using either Debian or Alpine (both installed via the MS Store), /mnt/wslg/stderr.log is constantly adding pairs of lines with pid incremented by 2 like (lines wrapped for readability):

[13:23:25.130] <5>WSLGd: Run:104: pid 4875 exited with status 127, /mnt/c/Users/gwhite/AppData/Local/Microsoft/WindowsApps\
/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe \
/v:21CDBDE0-A785-4340-B9C0-5E37C2A39CBF /hvsocketserviceid:7E061424-FACB-11E6-BD58-64006A7986D3\
 /silent /wslg /plugin:WSLDVC_PACKAGE \
/wslgsharedmemorypath:WSL\21CDBDE0-A785-4340-B9C0-5E37C2A39CBF\wslg C:\Program Files\WindowsApps\
\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.3.0_x64__8wekyb3d8bbwe\wslg.rdp 
/mnt/c/Users/gwhite/AppData/Local/Microsoft/WindowsApps\/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe: \
line 1: MZ: command not found

When I run a X11 application such as xeyes, the app runs, but the window never appears.
In linux, ...\msrdc.exe appears to be the same MZ two bytes.

@elsaco
Copy link

elsaco commented Dec 6, 2022

In Linux msrdc.exe show as MZ because of the interop. Here is the setting Linux side:

tux@eleven:~$ cat /proc/sys/fs/binfmt_misc/WSLInterop
enabled
interpreter /init
flags: PF
offset 0
magic 4d5a

And 4d5a is MZ, the magic signature for Windows executables. However, on Windows side msrdc.exe is a link to the actual RPD client. Can be seen by reparsing msrdc.exe from C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\msrdc.exe

This is what Linux shell sees, and interop should take care of it:

tux@eleven:~$ xxd /mnt/c/Users/toto/AppData/Local/Microsoft/WindowsApps/msrdc.exe
00000000: 4d5a

If you use xxd on Windows side this is the output:

PS C:\Users\toto\AppData\Local\Microsoft\WindowsApps> xxd .\msrdc.exe
xxd.exe: .\msrdc.exe: Invalid argument

and it's okay, too, because xxd does not reparse.

The issue you're having is with WSLg not working properly.

@gnw3
Copy link

gnw3 commented Dec 6, 2022

In Linux msrdc.exe show as MZ because of the interop. Here is the setting Linux side:

tux@eleven:~$ cat /proc/sys/fs/binfmt_misc/WSLInterop
enabled
interpreter /init
flags: PF
offset 0
magic 4d5a

There is no /proc/sys/fs/binfmt_misc/WSLInterop in this WSL2 debian. I have PowerShell Core 7.3.0 in Windows and have done Install-Module -Name WslInterop in Windows:

PS C:\Users\gwhite> get-installedmodule wslinterop

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
0.4.1                WslInterop                          PSGallery            Integrate Linux commands into Windows wi…

which is supposed to work with PS Core 7.3.0.

@colemar
Copy link
Author

colemar commented Dec 7, 2022

@elsaco
I downgraded WSL 1.0.3.0 to 1.0.0.0.
I can confirm your findings about MZ magic signature.

Now WSL is able to start msrdc.exe via the reparse point:

colem@VERDE:/mnt/wslg$ /mnt/c/Users/colem/AppData/Local/Microsoft/WindowsApps/MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe/msrdc.exe

If I remember well, version 1.0.3.0 was not able to start it. I am reinstalling this version to confirm.

@colemar
Copy link
Author

colemar commented Dec 7, 2022

I unistalled WSL 1.0.0.0 and installed WSL 1.0.3.0 (via Appx package).

WSL 1.0.3.0 is also able to start the reparse point, and I don't see anymore the original problem about /mnt/wslg/stderr.log.
I don't know why.

I see other issues in stderr.log, but I suppose these are not relevant:

Missing Wayland requirements for glamor GBM backend
Failed to initialize glamor, falling back to sw
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Internal error:   Could not resolve keysym XF86FullScreen
Errors from xkbcomp are not fatal to the X server
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 569, clipping.
>                   X11 cannot support keycodes above 255.
> Internal error:   Could not resolve keysym XF86FullScreen
Errors from xkbcomp are not fatal to the X server

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants