Open zaoqi opened 5 years ago
if mkdir tmp
$ fakechroot fakeroot chroot . ./proot/src/proot -R alpine-minirootfs-3.10.1-x86_64
proot error: execve("/bin/sh"): No such file or directory
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-22405-7CHcGd': No such file or directory
proot error: can't chdir to '/': No such file or directory
Interesting.. I'll look into it.
Thanks for providing such detailed debugging information!
I had a similar issue. The problem is, that the detranslate_path
function somehow is called with empty strings for path
and/or t_referrer
.
Also length1
and length2
are of type size_t, thus, unsigned integers and by the looks of it the case length1==0
is supposed to be handled in the if
statement immediately after the assert.
There's probably a better way to fix it, but this works for me: https://github.com/0pq76r/proot/commit/7d7479c490de083729253f120a5e9a9c5bd47d0c
Still not fixed as of latest version.
This is a bit tricky. At least one cause of this crash is when readlinkat
is called with an empty string for the path
, which is allowed: (see readlinkat(2))
Since Linux 2.6.39,
pathname
can be an empty string, in which case the call operates on the symbolic link referred to bydirfd
(which should have been obtained using open(2) with theO_PATH
andO_NOFOLLOW
flags).
proot doesn't handle this case, and I'm not sure if simply making detranslate_path
ignore an empty t_referrer
is correct. In fact, I'm not sure if proot's readlinkat handling is otherwise correct at all.
Hi, I'm also experiencing this issue:
proot: ./path/path.c:547: compare_paths2: Assertion `length2 > 0' failed.
This makes pacman fail in arch. It also makes wine GUI fail when running inside the new root.
Edit: The changes provided by @0pq76r fix both issues.
I am having the same problem. Here is a Dockerfile that reproduces it:
FROM ubuntu:mantic
RUN apt-get update && apt-get install -y proot systemd
RUN proot dpkg-reconfigure systemd
docker build .
fails with the message:
0.402 proot: ./path/path.c:541: compare_paths2: Assertion `length2 > 0' failed.
Is there a workaround?
Steps to Reproduce the Problem
do not
mkdir tmp
fakechroot fakeroot chroot . ./proot/src/proot -R alpine-minirootfs-3.10.1-x86_64
Specifications