Skip to content

binfmt not working for QEMU - Ubuntu's fault?? #512

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

Open
micsthepick opened this issue Feb 9, 2025 · 1 comment
Open

binfmt not working for QEMU - Ubuntu's fault?? #512

micsthepick opened this issue Feb 9, 2025 · 1 comment
Labels
jira Import to Jira

Comments

@micsthepick
Copy link

microsoft/WSL#11946 (comment)

seems to state that commenting a line in /usr/lib/systemd/system/systemd-binfmt.service.d/wsl.conf allows binfmt to work, and it's apparently Ubuntu's fault? If so I'd like to track the issue here, or continue the discussion there.

@CarlosNihelton CarlosNihelton added the jira Import to Jira label Feb 19, 2025
@ashuntu
Copy link
Contributor

ashuntu commented Feb 25, 2025

I was able to reproduce the issue and the proposed workaround noted in that comment following their steps. However, doing so seems to break Windows interoperability. For example, code . will no longer work from inside WSL, nor will notepad.exe.

Interestingly, if you apply the workaround (commenting out /usr/lib/systemd/system/systemd-binfmt.service.d/wsl.conf) and restart WSL completely, Ubuntu WSL will work in all cases, including Windows binaries and other architecture Linux binaries. It's only when you restart binfmt with systemctl restart systemd-binfmt that Windows interoperability breaks once again.

Seems to be that there is something during the setup of the instance that allows everything to work, but the same setup is not applied when restarting binfmt manually.

CarlosNihelton added a commit to canonical/ubuntu-pro-for-wsl that referenced this issue Mar 26, 2025
While ubuntu/WSL#512 is a representative
issue, I've seen similar complains in the upstream repository about
binfmt_misc registration mediated by systemd not working. I've also seen
a bunch of other complains in the past about WSL binary interoperability
not working because of some surprising interaction with
`systemd-binfmt.service`.

This explanation page aims to eliminate (or at least decrease the amount
of) surprises by:
- Explaining power users why we chose to disable that service
- Giving them knowledge to do the opposite and deal with potential
consequences

I have high hopes (based on conversations I already had with upstream)
that we'll see strong improvements in this area still in the WSL 2.5.x
release series.

---

UDENG-6366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira Import to Jira
Projects
None yet
Development

No branches or pull requests

3 participants