Skip to content

Commit

Permalink
fix up sudo issue for loongarch-lab
Browse files Browse the repository at this point in the history
The newer qemu requires additional OCF flags to let users switch to
root, let's apply such flags.

ref: multiarch/qemu-user-static#17

Signed-off-by: Wu Zhangjin <falcon@tinylab.org>
  • Loading branch information
lzufalcon committed Sep 13, 2024
1 parent 9aaa872 commit 749d334
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion configs/loongarch-lab/tools/host-run
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@
if [ ! -f /proc/sys/fs/binfmt_misc/register -o ! -f /proc/sys/fs/binfmt_misc/qemu-loongarch64 ]; then
# multiarch/qemu-user-static doesn't support loongarch64 yet
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes >/dev/null
sudo sh -c "echo ':qemu-loongarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01:\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-loongarch64:' > /proc/sys/fs/binfmt_misc/register"

# ref: https://github.com/multiarch/qemu-user-static/issues/17
# FIXME: sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges
flags="OCF"
sudo sh -c "echo ':qemu-loongarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01:\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-loongarch64:$flags' > /proc/sys/fs/binfmt_misc/register"
fi

0 comments on commit 749d334

Please sign in to comment.