Skip to content

Commit

Permalink
[ansible][qemu-user-static] Force automount to mount /proc/sys/fs/bin…
Browse files Browse the repository at this point in the history
…fmt_misc

systemd is kind of taking over that directory. While Ubuntu seems to
handle this just right, Amazon Linux 2 does not, essentially, the
directory is handled by automount, but is not mounted and onl;y ends up
mounted once we try to access it with `ls` or such.
This gets us to end up in a situation where qemu-user-static has ran,
but its config gets overridden.

I did not manage to get this to work properly on AL2, but we can trick
it by "pre-warming" the mount by running a `ls /proc/sys/fs/binfmt_misc`
as a pre-exec-start step (ignoring failures).

Tried this on Ubuntu host, and there were still happy.
Signed-off-by: Manu Bretelle <[email protected]>
  • Loading branch information
chantra committed Nov 14, 2024
1 parent e6f0ab1 commit 2a3ec07
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ansible/roles/qemu-user-static/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# https://github.com/multiarch/qemu-user-static does not support host arch != x86_64
# see https://github.com/multiarch/qemu-user-static/issues/174
# In the meantime use https://dbhi.github.io/qus/
# The command below is a stupid trick to ensure that systemd units for binfmt (proc-sys-fs-binfmt_misc.{auto,}mount are kicked and properly mount the FS before we run qemu-user-static
ExecStartPre=-/bin/ls /proc/sys/fs/binfmt_misc
ExecStartPre=/usr/bin/docker run --rm --interactive --privileged {{ qus_container_name }}:{{ qus_container_tag }} -s -- -r
ExecStart=/usr/bin/docker run --rm --interactive --privileged {{ qus_container_name }}:{{ qus_container_tag }} -s -- -p
Expand Down

0 comments on commit 2a3ec07

Please sign in to comment.