WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Updgrade to 2.5.7 - File does not contain a valid CIL image.

Open milkshakeuk opened this issue 6 months ago • 8 comments

Windows Version

Microsoft Windows [Version 10.0.26100.4061]

WSL Version

2.5.7

Are you using WSL 1 or WSL 2?

  • [x] WSL 2
  • [ ] WSL 1

Kernel Version

No response

Distro Version

Ubuntu 24.04.2 LTS

Other Software

git version 2.49.0 vscode 1.100.2 (user)

Repro Steps

git clone repository.git

Cloning into 'repository'...
Cannot open assembly '/mnt/c/WINDOWS/System32/OpenSSH//ssh.exe': File does not contain a valid CIL image.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

code .

Cannot open assembly '/mnt/c/Users/JakeAitchison/AppData/Local/Programs/Microsoft VS Code/Code.exe': File does not contain a valid CIL image.

Expected Behavior

git clones the repo

vscode launches remote wsl instance

Actual Behavior

see repro steps

Diagnostic Logs

WslLogs-2025-05-29_09-58-53.zip

milkshakeuk avatar May 29 '25 08:05 milkshakeuk

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here

Once completed please upload the output files to this Github issue.

Click here for more info on logging If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

github-actions[bot] avatar May 29 '25 08:05 github-actions[bot]

Diagnostic information
Detected appx version: 2.5.7.0

github-actions[bot] avatar May 29 '25 09:05 github-actions[bot]

Diagnostic information
Issue was edited and new log file was found: https://github.com/user-attachments/files/20501689/WslLogs-2025-05-29_09-58-53.zip
Detected appx version: 2.5.7.0

github-actions[bot] avatar May 29 '25 09:05 github-actions[bot]

Hi @milkshakeuk!

How did you install git?

Are you running these commands in your WSL shell or PowerShell?

File does not contain a valid CIL image. I would expect to see this error for a .NET application if the .NET path is misconfigured, but not git, which is not a .NET application. Same with code.

Are you running these in your WSL shell and do you have .NET or Mono installed in your WSL image?

sirredbeard avatar May 29 '25 14:05 sirredbeard

hi @sirredbeard,

git is installed within WSL it's not using the windows git installation; however it is using 1password to get the repo ssh key and gpg signing key.

https://developer.1password.com/docs/ssh/get-started#step-4-configure-your-ssh-or-git-client

relevant git config section:

[gpg "ssh"]
  program = "/mnt/c/Users/JakeAitchison/AppData/Local/1Password/app/8/op-ssh-sign-wsl"

I found some useful info here.

Using the followingg command I have worked around the problem sudo update-binfmts --disable cli though this was never an issue before updating so I suspect some systemd binfmts related shenanigans happens during the wsl update...maybe?

ls /proc/sys/fs/binfmt_misc

WSLInterop  python3.12  register  status

update-binfmts --display

cli (disabled):
     package = mono-runtime
        type = magic
      offset = 0
       magic = MZ
        mask = 
 interpreter = /usr/bin/cli
    detector = /usr/lib/cli/binfmt-detector-cli
python3.12 (enabled):
     package = python3.12
        type = magic
      offset = 0
       magic = \xcb\x0d\x0d\x0a
        mask = 
 interpreter = /usr/bin/python3.12
    detector = 

milkshakeuk avatar May 29 '25 14:05 milkshakeuk

With more context, a binfmts issue makes sense here.

I had same suspicion about .NET or Mono misconfiguration as raised in #9146.

I don't think using your 1Password GPG key is an issue.

What is odd is that WSL 2.5.1 contained a fix for a related issue, #8843.

It even seems to have bled over into systemd issues.

sirredbeard avatar May 29 '25 16:05 sirredbeard

Thank you for reporting this @milkshakeuk. This is most likely caused by a regression in 2.5.7. This will be fixed in the next release.

See #12999

OneBlue avatar May 29 '25 21:05 OneBlue

@sirredbeard @OneBlue btw I must run sudo update-binfmts --disable cli each day i.e. wsl fresh start to enable things to work again.

milkshakeuk avatar May 30 '25 07:05 milkshakeuk

Fixed in 2.5.8

OneBlue avatar Jun 02 '25 21:06 OneBlue