uraimo / run-on-arch-action

A Github Action that executes jobs/commands on non-x86 cpu architectures (ARMv6, ARMv7, aarch64, s390x, ppc64le, riscv64) via QEMU
BSD 3-Clause "New" or "Revised" License
677 stars 149 forks source link

Run Docker so qemu-aarch64 flags: OCF (fixes uraimo#68) #75

Closed benalexau closed 2 years ago

benalexau commented 2 years ago

This PR resolves issue #68.

The root cause of the sudo: effective uid is not 0, is /usr/sbin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges? error is explained in https://github.com/multiarch/qemu-user-static/issues/17.

In summary the QEMU Docker instance needs to launched so the binfmt_misc flags include OCF. Prior to this PR the flags are limited to F, which can be confirmed using following run-on-arch-action configuration:

  setup: |
    cat /proc/sys/fs/binfmt_misc/qemu-aarch64

This returns:

enabled
interpreter /usr/bin/qemu-aarch64-static
flags: F
offset 0
magic 7f454c460201010000000000000000000200b700
mask ffffffffffffff00fffffffffffffffffeffffff

Applying the PR results in:

enabled
interpreter /usr/bin/qemu-aarch64-static
flags: OCF
offset 0
magic 7f454c460201010000000000000000000200b700
mask ffffffffffffff00fffffffffffffffffeffffff

sudo now works in run-on-arch-action containers.

uraimo commented 2 years ago

@benalexau thanks for taking the time to research and open this PR, will do a new release.