ubuntu / wsl-setup

WSL setup starts the setup and reconfigure GUI or TUI
GNU General Public License v3.0
17 stars 4 forks source link

`systemd-binfmt.service.d/wsl.conf`` breaking compatibility with `qemu` from version >=8.0.0 onwards #11

Open ColorfulRhino opened 8 months ago

ColorfulRhino commented 8 months ago

Hello! This config below breaks compatibility with qemu-user-static starting from version 8.0.0. https://github.com/ubuntu/wsl-setup/blob/08a7311f8e9266ce69544440792da7c5a4c525f5/systemd/system/systemd-binfmt.service.d/wsl.conf#L1-L4

qemu has removed binfmt-support registration from version 8.0.0 onwards, see changelog:

  * New qemu release 8.0.0.
  * remove binfmt-support registration, use systemd binfmd.d/ only
    No more binfmt-support support. Unregister any entries on upgrades.
  * binfmt: ship (but not enable) entries for all arches, do not omit native
    Ship all really-foreign binfmt entries in /usr/lib/binfmt.d/ as usual,
    to be enable automatically at package install. Also ship the
    same-cpu-family entries in /usr/share/doc/qemu-user-static/qemu-foo.conf -
    this way it will not be enabled automatically but it will be possible to
    (carefully) symlink the needed additional entries to /etc/binfmt.d/.
    (Closes: #924667, #1016810, #1027781)

Previously, the binfmt files were stored in /usr/share/binfmts/ (e.g. qemu-aarch64) after installing qemu-user-static <8.0.0 and automatially loaded. The wsl config mentioned above did not prevent this. From version 8.0.0 onwards, the qemu files for binfmt are stored in /usr/lib/binfmt.d/ (e.g. qemu-aarch64.conf) in a .conf format. Usually, these are auto-loaded/enabled by systemd-binfmt.service on boot time. However, since systemd-binfmt.service.d/wsl.conf prevents this auto-load on boot, qemu-user-static is not functional anymore on WSL-Ubuntu (Ubuntu 23.10 and 24.04 have qemu versions >=8.0.0)

The config files /usr/lib/systemd/system/systemd-binfmt.service.d/wsl.conf as well as /etc/systemd/system/systemd-binfmt.service.d/00-wsl.conf prevent systemd-binfmt.service from starting.

How to reproduce

1) On WSL Ubuntu 23.10 or 24.04, install qemu-user-static and binfmt-support 2) Try sudo update-binfmts --enable qemu-aarch64 3) See error: update-binfmts: warning: qemu-aarch64 not in database of installed binary formats

Expected behaviour (like it was in Ubuntu 22.04): 1) On WSL Ubuntu 22.04, install qemu-user-static and binfmt-support 2) Try sudo update-binfmts --enable qemu-aarch64 3) See qemu-aarch64 enabled with sudo update-binfmts --display

rklasen commented 1 week ago

I can confirm this bug, under WSL with Ubuntu 24.04, I get the error update-binfmts: warning: qemu-aarch64 not in database of installed binary formats.