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

systemd-binfmt.service breaks interop #334

Closed
1 task
EduardGomezEscandell opened this issue Dec 12, 2022 · 1 comment · Fixed by #335
Closed
1 task

systemd-binfmt.service breaks interop #334

EduardGomezEscandell opened this issue Dec 12, 2022 · 1 comment · Fixed by #335
Labels
jira Import to Jira systemd

Comments

@EduardGomezEscandell
Copy link
Collaborator

EduardGomezEscandell commented Dec 12, 2022

cmd /c ver

Microsoft Windows [Versión 10.0.22623.1028]

wsl --status

Distribución predeterminada: Ubuntu-22.04-test
Versión predeterminada: 2

Did the problem occur during installation?

  • Yes

What happened?

systemd-binfmt.service remounts the /proc/sys/fs/binfmt_misc/ directory, where WSLInterop is located and now overriden.

This directrory is shared across distros meaning that any distro can break all others' interop.

What was expected?

Interop should not be broken by a service, much less across distros.

Steps to reproduce

  1. wsl --shutdown
  2. Start any WSL distro that does not have systemd enabled.
  3. Assert that /proc/sys/fs/binfmt_misc/WSLInterop exists.
  4. Enable systemd and exit
  5. wsl --shutdown
  6. Start the distro
  7. See that /proc/sys/fs/binfmt_misc/ no longer contains WSLInterop.
  8. See that notepad.exe fails.

Additional information

No response

EduardGomezEscandell added a commit that referenced this issue Dec 12, 2022
Disables systemd-binfmt.service to avoid breaking interop.
See related bug report: #334
EduardGomezEscandell added a commit that referenced this issue Dec 12, 2022
Disables systemd-binfmt.service to avoid breaking interop.
See related bug report: #334
EduardGomezEscandell added a commit that referenced this issue Dec 13, 2022
* Masked systemd-binfmt.service

Disables systemd-binfmt.service to avoid breaking interop.
See related bug report: #334

* Wrote test to ensure interop is not broken
@the-moog
Copy link

the-moog commented Jun 16, 2023

It seems this issue is back in recent WSL. I'm experimenting with Wsl 1.3.11 with Ubuntu 23.04. Just found the same issue. It's probably time for a proper fix!
I'm not sure if the bug is in WSL runtime startup, Ubuntu distribution or WSL install (firstboot).
So raising it here as it's and older reference that still comes up in searches.
ls -al /proc/sys/fs/binfmt_misc shows only python-3.1.1 Of course WSLInterop.conf should be there too.
I know I posted a work-round elsewhere (but I can't remember where) yes I can!
workround: microsoft/WSL#8952 (comment)

The suggestion here, that is disabling systemd-binfmt.service, is a bit of a blunt tool, e.g. it breaks other stuff, like Java.

Perhaps a proper long term fix would be to include a WSLInterop.conf file in /etc/binfmt.d through systemd-firstboot
or through the wsl overlays on /usr/lib/binfmt.d or in /run/binfmt.d (the latter may be best as it is not present on a stock Ubuntu 23 so likely will not break things).

NOTE this issues comes up a lot!! Hence why I tried to find the earliest and link them.

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

Successfully merging a pull request may close this issue.

2 participants