Windows-Binary-Interop fails with "Invalid argument" under certain circumstances
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
Windows Version
Microsoft Windows [Version 10.0.22631.5624]
WSL Version
2.5.10.0
Are you using WSL 1 or WSL 2?
- WSL 2
- WSL 1
Kernel Version
6.6.87.2-1
Distro Version
Ubuntu 24.04.2 LTS (Noble Numbat)
Other Software
No response
Repro Steps
Steps to reproduce:
- Import a new Installation of Ubuntu using
wsl --install Ubuntuand walk through OOBE (create a user). - After Setup is complete, switch to
rootusingsudo -i. - Run
/mnt/c/Windows/System32/wsl.exe --version, it should output version info - Create
/root/.cachedirectory and switch to it - Run
/mnt/c/Windows/System32/wsl.exe --versionagain, it should still work. - Modify
/etc/wsl.conf(adding interop options): I am still not sure, what exactly causes this, but according to the documentation, the following should have no changing effect (but it will anyway):
[interop]
enabled=true
appendWindowsPath=true
- Exit the distribution and terminate it (
wsl --terminate Ubuntu) - Start it again
wsl -d Ubuntuand switch toroot - Try running
/mnt/c/Windows/System32/wsl.exe --versionin/root, it should still work - Switch to
/root/.cacheand run/mnt/c/Windows/System32/wsl.exe --versionagain. Now you should receive:
root@FAVF-5CD4468BBT:~/.cache# /mnt/c/Windows/System32/wsl.exe --version
/mnt/c/Windows/System32/wsl.exe: Invalid argument
root@FAVF-5CD4468BBT:~/.cache#
Note: We sporadically got errors like these about 1,5 years ago (mostly in systemd services) and only now I have a valid way of reproducing them. So the error persists for quite a while in WSL.
Expected Behavior
The expected behaviour is, that no matter where I execute Windows binaries, they work or I receive a meaningful error on why it does not work.
Actual Behavior
The Windows binary just returns with Invalid argument and exits.
Diagnostic Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure through /mnt/c/Windows/System32/wsl.exe --version after enabling [interop] in /etc/wsl.conf, comparing /root with /root/.cache. Trace the Windows-binary interop entry point involved in the Invalid argument result; done means the command works from both directories or reports a meaningful error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, ubuntu
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100