Quoting Michael Tokarev (2022-05-31 11:50:29) > > stumbled across another strange problem which I'm again able to > > reproduce inside QEMU with qemu-user-mode emulation. Have a look at this > > log file: > > > > https://jenkins.debian.net/job/fakeroot-foreign-worker/645/consoleText > > > > And search for "apt-get remove --yes qemu-user-static binfmt-support > > qemu-user". This used to successfully remove qemu-user support from the > > virtual machine. As you can see from a few lines below, running > > > > mmdebstrap --architectures=arm64 [...] > > > > succeeds. Why? Is this because I'm now running qemu with "-cpu host"? Or > > is this due to another change in qemu-user from recently? > > It has nothing to do with -cpu host. It is due to the fact that I switched > from binfmt-support to systemd for binfmt registration (actually the two > work in parallel). And systemd does not provide an official way to trigger > binfmt (de)registration besides a reboot. And in systemd, the service > (systemd-binfmt.service) is described as "early boot service". > > Maybe I can run /lib/systemd/systemd-binfmt explicitly but this does not > look like a good thing to do. And I don't see any way to remove registered > formats which are not there anymore. > > It is actually the same for *installing* qemu-user - without binfmt-support > it will not register its binfmts until reboot.
I'm very surprised it keeps working even though the package providing the emulation binary got removed. This must mean that the qemu-user binaries are loaded into memory where they remain until reboot? I have another funny observation: the test is actually flaky and doesn't always produce the same results. I ran the same test 100 times and in 10% of the cases, qemu-user-mode emulation still worked despite the packages being removed. In 90% of the cases, foreign-arch mmdebstrap failed as I expected it to happen. Given your explanation above, I don't understand why I do not get the same result every time I run this test. In my tests, I now replaced removing qemu-user-static and binfmt-support with running `echo 0 > /proc/sys/fs/binfmt_misc/qemu-aarch64`. As expected, this seems to work all of the time, so I guess I'll stick with that. Thanks! cheers, josch
signature.asc
Description: signature