[Bug 13746] New: /bin/sh (busybox sh) commands are not run via their absolute path thus leading to qemu complaints

bugzilla at busybox.net bugzilla at busybox.net
Sun Apr 11 22:13:06 UTC 2021


            Bug ID: 13746
           Summary: /bin/sh (busybox sh) commands are not run via their
                    absolute path thus leading to qemu complaints
           Product: Busybox
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: admnd at protonmail.com
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

While using a chrooted crossbuilt Gentoo environment via QEMU I noticed the
failure of all internal commands run inside a sh shell. What works however is
when the commands are run with their full path:

# busybox sh
/ # dmesg 
qemu: no user program specified
/ # grep 
qemu: no user program specified
/ # 
/ # /bin/dmesg | /bin/grep SSE
[    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
/ # sed -e
qemu: unknown option 'e'
/ # /bin/sed -e
/bin/sed: option requires an argument -- 'e'
BusyBox v1.33.0 (2021-04-11 12:57:27 EDT) multi-call binary.

External sh commands however are run as expected:

/ # file /usr/bin/file 
/usr/bin/file: ELF 64-bit MSB pie executable, IBM S/390, version 1 (SYSV),
dynamically linked, interpreter /lib/ld64.so.1, for GNU/Linux 3.2.0, stripped

This is unfortunate because all autotools configure scripts have the shebang
#!/bin/sh thus I am unable to emerge stuff inside my chroot :(

Steps to reproduce (Gentoo Linux on x86_64) :
1. Read the steps on https://wiki.gentoo.org/wiki/Cross_build_environment 
2. Build the environment of your choice (in my case => crossdev
s390x-ibm-linux-gnu giving a "busyboxed" environment in
3. Add the QEMU user emulation into it as instructed  by above link 
4. Register the QEMU user emulator for the S390x binaries (echo
> /proc/sys/fs/binfmt_misc/register)
5. Mount everything required (proc, sys, dev ...) prior chrooting 
6. chroot /usr/s390x-ibm-linux-gnu /bin/bash
7. run /bin/sh and try some commands (grep, dmesg and so on), you will see what
I put above.

You are receiving this mail because:
You are on the CC list for the bug.

More information about the busybox-cvs mailing list