It seems that on debian, binfmt is not managed by systemd unit
systemd-binfmt.service but by binfmt-support.service instead, so the
"ConditionDirectoryNotEmpty was not met" sounds ok to me.

And binfmt-support.service expect to find binfmt conf files at
/var/lib/binfmts/*, which should be generated by the postinst script
/var/lib/dpkg/info/qemu-user-static.postinst as Ian explained.

The issue we have here is that there is a special check to prevent
execution on this postinst script on container platform like docker or lxc
(See line `grep -zqs ^container= /proc/1/environ && exit 0` in below
postinst script:)

```
$ head /var/lib/dpkg/info/qemu-user-static.postinst
#!/bin/sh
set -e
# check if we're running inside an (lxc) container
# (we may copy or move this to the postinst script too, to skip installing
it)
grep -zqs ^container= /proc/1/environ && exit 0

# == binfmt registration/deregistration ==
if command -v update-binfmts > /dev/null ; then

fmts="aarch64 alpha arm armeb cris i386 m68k microblaze mips mipsel mipsn32
mipsn32el mips64 mips64el ppc ppc64 ppc64abi32 ppc64le s390x sh4 sh4eb
sparc sparc32plus sparc64 x86_64"
```

So what is the reasoning behind this container check? and can we remove
this check or at least disable it for docker?
I guess if we install qemu-user-static in a docker container, we could
expect qemu binfmts to be correctly registered, right?

Thanks.
Bruno

Reply via email to