termux / proot

An chroot-like implementation using ptrace.
https://wiki.termux.com/wiki/PRoot
Other
761 stars 160 forks source link

Hello why it doesn't work ?proot info: vpid 1: terminated with signal 11 #85

Closed seisdr closed 4 years ago

seisdr commented 4 years ago

Screenshot_2019-12-10-16-38-22 Screenshot_2019-12-10-16-38-30

oxr463 commented 4 years ago

Please provide the output from the following command:

uname -a

See also: https://stackoverflow.com/q/8894473/8507637

Also, what is it that you are trying to accomplish in this scenario? From the second screenshot, it looks as if there is more to the script that cannot be seen.

michalbednarski commented 4 years ago

Also, what you've used to install ex filesystem contents?

Also, run following command and share proot-log.txt

PROOT_VERBOSE=9 ./k.sh &> proot-log.txt
seisdr commented 4 years ago

Well there's that Windows emulator exagear I thought to try it's system files by proot

$ uname -a
Linux localhost 3.10.86-g0c14827 #2 SMP PREEMPT Thu Jul 12 13:13:34 CST 2018 aarch64 Android
$
seisdr commented 4 years ago
$ cat proot-log.txt
proot info: binding = /dev
proot info: binding = /proc
proot info: binding = /data/data/com.termux/files/home/shit/ex:/
proot info: vpid 1: translate("/" + "/usr/bin/env")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/shit/ex/usr/bin/env"
proot info: vpid 1: translate("/" + "/usr/bin/env")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/shit/ex/usr/bin/env"
proot info: exe = /usr/bin/env
proot info: argv = /usr/bin/env -i HOME=/root BASH_SOURCE=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games TERM=xterm-256color LANG=C.UTF-8 /bin/bash --login
proot info: initial cwd = /root
proot info: verbose level = 9
proot info: pid 19303: access to "/dev/pts/1" (fd 0) won't be translated until closed
proot info: pid 19303: access to "/data/data/com.termux/files/home/shit/proot-log.txt" (fd 1) won't be translated until closed
proot info: pid 19303: access to "/data/data/com.termux/files/home/shit/proot-log.txt" (fd 2) won't be translated until closed
proot info: pid 19303: access to "/proc/19303/fd" (fd 3) won't be translated until closed
proot info: vpid 1: sysenter start: prctl(0x26, 0x1, 0x0, 0x0, 0x0, 0x1) = 0x26 [0x7fd1af6080, 0]
proot info: vpid 1: sysenter end: prctl(0x26, 0x1, 0x0, 0x0, 0x0, 0x1) = 0x26 [0x7fd1af6080, 0]
proot info: vpid 1: sysexit start: prctl(0x0, 0x1, 0x0, 0x0, 0x0, 0x1) = 0x0 [0x7fd1af6080, 0]
proot info: vpid 1: sysexit end: prctl(0x0, 0x1, 0x0, 0x0, 0x0, 0x1) = 0x0 [0x7fd1af6080, 0]
proot info: vpid 1: sysenter start: prctl(0x16, 0x2, 0x7fd1af6088, 0x0, 0x0, 0x1) = 0x16 [0x7fd1af6080, 0]
proot info: vpid 1: sysenter end: prctl(0x16, 0x2, 0x7fd1af6088, 0x0, 0x0, 0x1) = 0x16 [0x7fd1af6080, 0]
proot info: vpid 1: sysexit start: prctl(0x0, 0x2, 0x7fd1af6088, 0x0, 0x0, 0x1) = 0x0 [0x7fd1af6080, 0]
proot info: vpid 1: sysexit end: prctl(0x0, 0x2, 0x7fd1af6088, 0x0, 0x0, 0x1) = 0x0 [0x7fd1af6080, 0]
proot info: ptrace acceleration (seccomp mode 2, old syscall order) enabled
proot info: vpid 1: sysenter start: execve(0x55c0737e60, 0x7fd1af8290, 0x7fd1af82e0, 0x0, 0x40100401, 0x1) = 0x55c0737e60 [0x7fd1af5020, 0]
proot info: vpid 1: translate("/" + "/usr/bin/env")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/shit/ex/usr/bin/env"
proot info: vpid 1: translate("/" + "/lib/ld-linux.so.2")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/shit/ex/lib/i386-linux-gnu/ld-2.19.so"
proot info: vpid 1: sysenter end: execve(0x7fd1af4feb, 0x7fd1af8290, 0x7fd1af82e0, 0x0, 0x40100401, 0x1) = 0x7fd1af4feb [0x7fd1af4feb, 0]
proot info: vpid 1: sysexit start: io_setup(0x0, 0x0, 0x0, 0x0, 0x0, 0x0) = 0x0 [0x7feae74530, 0]
proot info: vpid 1: sysexit end: io_setup(0x7feae743f0, 0x0, 0x0, 0x0, 0x0, 0x0) = 0x7feae743f0 [0x7feae743f0, 0]
proot info: vpid 1: sysenter start: openat(0xffffffffffffff9c, 0x7feae74510, 0x0, 0x0, 0x0, 0x0) = 0xffffffffffffff9c [0x7feae743f0, 0]
proot info: vpid 1: translate("/" + "/usr/bin/env")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/shit/ex/usr/bin/env"
proot info: vpid 1: sysenter end: openat(0xffffffffffffff9c, 0x7feae743bb, 0x0, 0x0, 0x0, 0x0) = 0xffffffffffffff9c [0x7feae743f0, 0]
proot info: vpid 1: sysenter start: openat(0xffffffffffffff9c, 0x7feae7451d, 0x0, 0x0, 0x3, 0x5000) = 0xffffffffffffff9c [0x7feae743f0, 0]
proot info: vpid 1: translate("/" + "/lib/ld-linux.so.2")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/shit/ex/lib/i386-linux-gnu/ld-2.19.so"
proot info: vpid 1: sysenter end: openat(0xffffffffffffff9c, 0x7feae743a9, 0x0, 0x0, 0x3, 0x5000) = 0xffffffffffffff9c [0x7feae743f0, 0]
proot info: vpid 1: sysenter start: prctl(0xf, 0x7feae74519, 0x0, 0x12, 0x3, 0x1f000) = 0xf [0x7feae743f0, 0]
proot info: vpid 1: sysenter end: prctl(0xf, 0x7feae74519, 0x0, 0x12, 0x3, 0x1f000) = 0xf [0x7feae743f0, 0]
proot info: vpid 1: translate("/" + "/usr/bin/env")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/shit/ex/usr/bin/env"
proot info: vpid 1: terminated with signal 11
$
michalbednarski commented 4 years ago

You're trying to run x86/i386 program on aarch64 processor (normally Linux would fail execve with -ENOEXEC but proot lacks this check)

You need to use distro matching your processor architecture

seisdr commented 4 years ago

Well if I installed proot:i368 and run it with qemu is that gonna work? Screenshot_2019-12-10-21-27-42 Screenshot_2019-12-10-21-28-16

ghost commented 4 years ago

Well if I installed proot:i368 and run it with qemu is that gonna work?

No, you are using qemu with proot incorrectly. Proot cannot be launched under qemu. Use the following cli syntax instead:


proot -q /path/to/qemu-i386-static .... <other arguments> ....`
seisdr commented 4 years ago

Well I installed i368 proot which is doesn't work

root@localhost:/data/data/com.termux/files/home/shit# proot -q
Segmentation fault

Should I use it this way

root@localhost:~# qemu-i386-static ../usr/bin/proot  -q ../usr/bin/qemu-i386-static
proot error: ptrace(TRACEME): Function not implemented
proot error: execve("/usr/bin/sh"): Function not implemented
proot info: possible causes:
  * the program is a script but its interpreter (eg. /bin/sh) was not found;
  * the program is an ELF but its interpreter (eg. ld-linux.so) was not found;
  * the program is a foreign binary but qemu was not specified;
  * qemu does not work correctly (if specified);
  * the loader was not found or doesn't work.
fatal error: see `proot --help`.
proot error: can't chmod '/tmp/proot-5972-4J5FyE': No such file or directory
root@localhost:~#

I uninstalled this proot and installed the normal one it do nothing actually

root@localhost:/data/data/com.termux/files/home/shit# ./k.sh
root@localhost:/data/data/com.termux/files/home/shit# proot -q /usr/bin/qemu-i386-static
root@localhost:/data/data/com.termux/files/home/shit# proot -q /usr/bin/qemu-i386-static
root@localhost:/data/data/com.termux/files/home/shit# proot -q /usr/bin/qemu-i386-staticr
oot@localhost:/data/data/com.termux/files/home/shit# ps
  PID TTY          TIME CMD
root@localhost:/data/data/com.termux/files/home/shit#

Screenshot_2019-12-10-22-11-38

otherwise I already have copy of qemu on regular termux I tried it and it display this

proot info: vpid 1: terminated with signal 7

Proot log


$ rm proot-log.txt
$ PROOT_VERBOSE=9 ./k.sh &> proot-log.txt
$ cat proot-log.txt
proot info: binding = /dev
proot info: binding = /proc
proot info: binding = /dev/null:/etc/ld.so.preload
proot info: binding = /:/host-rootfs
proot info: binding = /data/data/com.termux/files/home/shit/ex:/
proot info: vpid 1: translate("/" + "/usr/bin/env")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/shit/ex/usr/bin/env"
proot info: vpid 1: translate("/" + "/usr/bin/env")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/shit/ex/usr/bin/env"
proot info: host rootfs = /host-rootfs
proot info: glue rootfs = /data/data/com.termux/files/usr/tmp/proot-10817-crkCYU
proot info: exe = /usr/bin/env
proot info: argv = /usr/bin/env -i HOME=/root BASH_SOURCE=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games TERM=xterm-256color LANG=C.UTF-8 /bin/bash --login
proot info: qemu = /data/data/com.termux/files/home/qemu-i386-static
proot info: initial cwd = /root
proot info: verbose level = 9
proot info: pid 10817: access to "/dev/pts/2" (fd 0) won't be translated until closed
proot info: pid 10817: access to "/data/data/com.termux/files/home/shit/proot-log.txt" (fd 1) won't be translated until closed
proot info: pid 10817: access to "/data/data/com.termux/files/home/shit/proot-log.txt" (fd 2) won't be translated until closed
proot info: pid 10817: access to "/proc/10817/fd" (fd 3) won't be translated until closed
proot info: vpid 1: sysenter start: prctl(0x26, 0x1, 0x0, 0x0, 0x0, 0x1) = 0x26 [0x7fc86eb910, 0]
proot info: vpid 1: sysenter end: prctl(0x26, 0x1, 0x0, 0x0, 0x0, 0x1) = 0x26 [0x7fc86eb910, 0]
proot info: vpid 1: sysexit start: prctl(0x0, 0x1, 0x0, 0x0, 0x0, 0x1) = 0x0 [0x7fc86eb910, 0]
proot info: vpid 1: sysexit end: prctl(0x0, 0x1, 0x0, 0x0, 0x0, 0x1) = 0x0 [0x7fc86eb910, 0]
proot info: vpid 1: sysenter start: prctl(0x16, 0x2, 0x7fc86eb918, 0x0, 0x0, 0x1) = 0x16 [0x7fc86eb910, 0]
proot info: vpid 1: sysenter end: prctl(0x16, 0x2, 0x7fc86eb918, 0x0, 0x0, 0x1) = 0x16 [0x7fc86eb910, 0]
proot info: vpid 1: sysexit start: prctl(0x0, 0x2, 0x7fc86eb918, 0x0, 0x0, 0x1) = 0x0 [0x7fc86eb910, 0]
proot info: vpid 1: sysexit end: prctl(0x0, 0x2, 0x7fc86eb918, 0x0, 0x0, 0x1) = 0x0 [0x7fc86eb910, 0]
proot info: ptrace acceleration (seccomp mode 2, old syscall order) enabled
proot info: vpid 1: sysenter start: execve(0x559409ba60, 0x7fc86edb28, 0x7fc86edb78, 0x0, 0x40100401, 0x1) = 0x559409ba60 [0x7fc86ea8b0, 0]
proot info: vpid 1: translate("/" + "/usr/bin/env")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/shit/ex/usr/bin/env"
proot info: vpid 1: sysenter end: execve(0x7fc86ea47b, 0x7fc86ea7b2, 0x7fc86ea4b0, 0x0, 0x40100401, 0x1) = 0x7fc86ea47b [0x7fc86ea47b, 0]
proot info: vpid 1: sysexit start: io_setup(0x0, 0x0, 0x0, 0x0, 0x0, 0x0) = 0x0 [0x7fd83a0fe0, 0]
proot info: vpid 1: sysexit end: io_setup(0x7fd83a0eb0, 0x0, 0x0, 0x0, 0x0, 0x0) = 0x7fd83a0eb0 [0x7fd83a0eb0, 0]
proot info: vpid 1: sysenter start: openat(0xffffffffffffff9c, 0x7fd83a0f90, 0x0, 0x0, 0x0, 0x0) = 0xffffffffffffff9c [0x7fd83a0eb0, 0]
proot info: vpid 1: translate("/" + "/host-rootfs/data/data/com.termux/files/home/qemu-i386-static")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/qemu-i386-static"
proot info: vpid 1: sysenter end: openat(0xffffffffffffff9c, 0x7fd83a0e7e, 0x0, 0x0, 0x0, 0x0) = 0xffffffffffffff9c [0x7fd83a0eb0, 0]
proot info: vpid 1: sysenter start: prctl(0xf, 0x7fd83a0fd7, 0x0, 0x32, 0xffffffffffffffff, 0x0) = 0xf [0x7fd83a0eb0, 0]
proot info: vpid 1: sysenter end: prctl(0xf, 0x7fd83a0fd7, 0x0, 0x32, 0xffffffffffffffff, 0x0) = 0xf [0x7fd83a0eb0, 0]
proot info: vpid 1: translate("/" + "/usr/bin/env")
proot info: vpid 1:          -> "/data/data/com.termux/files/home/shit/ex/usr/bin/env"
proot info: vpid 1: terminated with signal 7
$
seisdr commented 4 years ago
$ file ex/usr/bin/wine
ex/usr/bin/wine: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=73e608e95a54d9a4cba199ab4265ec748a1514c8, stripped

Well the files are 32bit and I am 64 bit is that explain why the app crashing everytime I open it ? But it did just work today for few minutes I were able to run explore and the xserver and then it crashing after I close and didn't works again I'm confused Where can I understand how exagear work

seisdr commented 4 years ago

Now I'm trying with i386 debian it doesn't work with same error code signal 7 maybe that qemu is broken

$ ./qemu-i386-static --help
usage: qemu-i386 [options] program [arguments...]
Linux CPU emulator (compiled for i386 emulation)

Options and associated environment variables:

Argument      Env-variable      Description
-h                              print this help
-g port       QEMU_GDB          wait gdb connection to 'port'
-L path       QEMU_LD_PREFIX    set the elf interpreter prefix to 'path'
-s size       QEMU_STACK_SIZE   set the stack size to 'size' bytes
-cpu model    QEMU_CPU          select CPU (-cpu help for list)
-E var=value  QEMU_SET_ENV      sets targets environment variable (see below)
-U var        QEMU_UNSET_ENV    unsets targets environment variable (see below)
-0 argv0      QEMU_ARGV0        forces target process argv[0] to be 'argv0'
-r uname      QEMU_UNAME        set qemu uname release string to 'uname'
-B address    QEMU_GUEST_BASE   set guest_base address to 'address'
-R size       QEMU_RESERVED_VA  reserve 'size' bytes for guest virtual address space
-d item[,...] QEMU_LOG          enable logging of specified items (use '-d help' for a list of items)
-D logfile    QEMU_LOG_FILENAME write logs to 'logfile' (default stderr)
-p pagesize   QEMU_PAGESIZE     set the host page size to 'pagesize'
-singlestep   QEMU_SINGLESTEP   run in singlestep mode
-strace       QEMU_STRACE       log system calls
-seed         QEMU_RAND_SEED    Seed for pseudo-random number generator
-version      QEMU_VERSION      display version information and exit

Defaults:
QEMU_LD_PREFIX  = /etc/qemu-binfmt/i386
QEMU_STACK_SIZE = 8388608 byte

You can use -E and -U options or the QEMU_SET_ENV and
QEMU_UNSET_ENV environment variables to set and unset
environment variables for the target process.
It is possible to provide several variables by separating them
by commas in getsubopt(3) style. Additionally it is possible to
provide the -E and -U options multiple times.
The following lines are equivalent:
    -E var1=val2 -E var2=val2 -U LD_PRELOAD -U LD_DEBUG
    -E var1=val2,var2=val2 -U LD_PRELOAD,LD_DEBUG
    QEMU_SET_ENV=var1=val2,var2=val2 QEMU_UNSET_ENV=LD_PRELOAD,LD_DEBUG
Note that if you provide several changes to a single variable
the last change will stay in effect.
$
seisdr commented 4 years ago

What about chroot 🤔

ghost commented 4 years ago

@seisdr You can try qemu from https://github.com/termux/unstable-packages/issues/109#issuecomment-547201723.

seisdr commented 4 years ago

It works now but slow finally I'm able to run Windows programs

seisdr commented 4 years ago

Something tells me that your x11 repo one was a bit faster

seisdr commented 4 years ago

I have a different issue should I post it here or

ghost commented 4 years ago

Post here.

seisdr commented 4 years ago

IMG_٢٠١٩١٢١٥_٠٣٣١٢٣ This file won't work under proot

ghost commented 4 years ago

It depends on what that executable "ubt" does. If it is equivalent to proot or something like that, then I'm not surprised that it crashes.

seisdr commented 4 years ago

It's I'm now trying to run exagear since wine is slow

By the way how to use chroot

ghost commented 4 years ago

ubt.txt

Not so useful, but it shows that ubt uses ptrace() just like proot and therefore incompatible.

By the way how to use chroot

Something like chroot /path/to/rootfs /bin/sh.

seisdr commented 4 years ago

Any Idea of chroot login script might work?

seisdr commented 4 years ago

IMG_٢٠١٩١٢١٥_١٨٤٢٣٠ not working why I can't enter /root ? also how to use mount I want to get access to sdcard

ghost commented 4 years ago

@seisdr Regarding "Could not resolve ......" - create a file /etc/resolv.conf with content nameserver 8.8.8.8.

seisdr commented 4 years ago

It's exist with with nameserver whenI I login with proot it works fine

ghost commented 4 years ago

Then how you are login at https://github.com/termux/proot/issues/85#issuecomment-565820882 ?

If with root, then you need to add supplementary group with 3003 to your user as Android restricts internet access only to processes with that gid.


PS. Closing issue as it related to third-party things running under proot and not proot itself.