termux / proot

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

SSL_connect returned 1 on void linux xbps update #274

Closed jindamvani closed 1 year ago

jindamvani commented 1 year ago

Problem description

-bash-5.1# proot -v 9 xbps-install -Su
proot info: binding = /                  proot info: Checking for f2fs case sensitivity bug                                proot info: f2fs bug not present on device                                        proot info: vpid 1: translate("/root" + "xbps-install")                           proot info: vpid 1:          -> "/root/xbps-install"                              proot info: vpid 1: translate("/" + "/usr/local/sbin/xbps-install")               proot info: vpid 1:          -> "/usr/local/sbin/xbps-install"                    proot info: vpid 1: translate("/" + "/usr/local/bin/xbps-install")                proot info: vpid 1:          -> "/usr/local/bin/xbps-install"                     proot info: vpid 1: translate("/" + "/sbin/xbps-install")                         proot info: vpid 1:          -> "/usr/bin/xbps-install"                           proot info: vpid 1: translate("/" + "/sbin/xbps-install")                         proot info: vpid 1:          -> "/usr/bin/xbps-install"                           proot info: exe = /usr/bin/xbps-install
proot info: argv = xbps-install -Su      proot info: initial cwd = /root          proot info: verbose level = 9
proot info: pid 11539: access to "/dev/stderr" (fd 0) won't be translated until closed                                     proot info: pid 11539: access to "/dev/stderr" (fd 1) won't be translated until closed
proot info: pid 11539: access to "/dev/stderr" (fd 2) won't be translated until closed                                     proot info: pid 11539: access to "/proc/11539/fd" (fd 3) won't be translated until closed                                  proot info: vpid 1: sysenter start: mmap2(0x0, 0x80000, 0x3, 0x4022, 0xffffffff, 0x0) = 0x0 [0xff9dca88, 0]
proot info: vpid 1: sysenter end: mmap2(0x0, 0x80000, 0x3, 0x4022, 0xffffffff, 0x0) = 0x0 [0xff9dca88, 0]
proot info: vpid 1: sysexit start: mmap2(0xf2f92000, 0x80000, 0x3, 0x4022, 0xffffffff, 0x0) = 0xf2f92000 [0xff9dca88, 0]
proot info: vpid 1: sysexit end: mmap2(0xf2f92000, 0x80000, 0x3, 0x4022, 0xffffffff, 0x0) = 0xf2f92000 [0xff9dca88, 0]
proot info: vpid 1: sysenter start: madvise(0xf2f92000, 0x80000, 0xc, 0x4022, 0xf2f92000, 0x80000) = 0xf2f92000 [0xff9dca98, 0]
proot info: vpid 1: sysenter end: madvise(0xf2f92000, 0x80000, 0xc, 0x4022, 0xf2f92000, 0x80000) = 0xf2f92000 [0xff9dca98, 0]
proot info: vpid 1: sysexit start: madvise(0x0, 0x80000, 0xc, 0x4022, 0xf2f92000, 0x80000) = 0x0 [0xff9dca98, 0]
proot info: vpid 1: sysexit end: madvise(0x0, 0x80000, 0xc, 0x4022, 0xf2f92000, 0x80000) = 0x0 [0xff9dca98, 0]
proot info: vpid 1: sysenter start: prctl(0x53564d41, 0x0, 0xf2f92000, 0x80000, 0xf3361a55, 0x0) = 0x53564d41 [0xff9dcac0, 0]
proot info: vpid 1: sysenter end: prctl(0x53564d41, 0x0, 0xf2f92000, 0x80000, 0xf3361a55, 0x0) = 0x53564d41 [0xff9dcac0, 0]
proot info: vpid 1: sysexit start: prctl(0x0, 0x0, 0xf2f92000, 0x80000, 0xf3361a55, 0x0) = 0x0 [0xff9dcac0, 0]
proot info: vpid 1: sysexit end: prctl(0x0, 0x0, 0xf2f92000, 0x80000, 0xf3361a55, 0x0) = 0x0 [0xff9dcac0, 0]
proot info: vpid 1: sysenter start: munmap(0xf2f92000, 0x80000, 0xe23b0bc, 0x80000, 0x0, 0x80000) = 0xf2f92000 [0xff9dcae0, 0]
proot info: vpid 1: sysenter end: munmap(0xf2f92000, 0x80000, 0xe23b0bc, 0x80000, 0x0, 0x80000) = 0xf2f92000 [0xff9dcae0, 0]
proot info: vpid 1: sysexit start: munmap(0x0, 0x80000, 0xe23b0bc, 0x80000, 0x0, 0x80000) = 0x0 [0xff9dcae0, 0]
proot info: vpid 1: sysexit end: munmap(0x0, 0x80000, 0xe23b0bc, 0x80000, 0x0, 0x80000) = 0x0 [0xff9dcae0, 0]
proot info: vpid 1: sysenter start: mmap2(0x0, 0xff000, 0x3, 0x4022, 0xffffffff, 0x0) = 0x0 [0xff9dca88, 0]
proot info: vpid 1: sysenter end: mmap2(0x0, 0xff000, 0x3, 0x4022, 0xffffffff, 0x0) = 0x0 [0xff9dca88, 0]
proot info: vpid 1: sysexit start: mmap2(0xf2f13000, 0xff000, 0x3, 0x4022, 0xffffffff, 0x0) = 0xf2f13000 [0xff9dca88, 0]
proot info: vpid 1: sysexit end: mmap2(0xf2f13000, 0xff000, 0x3, 0x4022, 0xffffffff, 0x0) = 0xf2f13000 [0xff9dca88, 0]
proot info: vpid 1: sysenter start: madvise(0xf2f13000, 0xff000, 0xc, 0x4022, 0xf2f13000, 0xff000) = 0xf2f13000 [0xff9dca98, 0]
proot info: vpid 1: sysenter end: madvise(0xf2f13000, 0xff000, 0xc, 0x4022, 0xf2f13000, 0xff000) = 0xf2f13000 [0xff9dca98, 0]
proot info: vpid 1: sysexit start: madvise(0x0, 0xff000, 0xc, 0x4022, 0xf2f13000, 0xff000) = 0x0 [0xff9dca98, 0]
proot info: vpid 1: sysexit end: madvise(0x0, 0xff000, 0xc, 0x4022, 0xf2f13000, 0xff000) = 0x0 [0xff9dca98, 0]
proot info: vpid 1: sysenter start: prctl(0x53564d41, 0x0, 0xf2f13000, 0xff000, 0xf3361a55, 0x0) = 0x53564d41 [0xff9dcac0, 0]
proot info: vpid 1: sysenter end: prctl(0x53564d41, 0x0, 0xf2f13000, 0xff000, 0xf3361a55, 0x0) = 0x53564d41 [0xff9dcac0, 0]
proot info: vpid 1: sysexit start: prctl(0x0, 0x0, 0xf2f13000, 0xff000, 0xf3361a55, 0x0) = 0x0 [0xff9dcac0, 0]
proot info: vpid 1: sysexit end: prctl(0x0, 0x0, 0xf2f13000, 0xff000, 0xf3361a55, 0x0) = 0x0 [0xff9dcac0, 0]
proot info: vpid 1: sysenter start: munmap(0xf2f13000, 0x6d000, 0x6d000, 0x80000, 0x80000, 0xf2f13000) = 0xf2f13000 [0xff9dcad0, 0]
proot info: vpid 1: sysenter end: munmap(0xf2f13000, 0x6d000, 0x6d000, 0x80000, 0x80000, 0xf2f13000) = 0xf2f13000 [0xff9dcad0, 0]
proot info: vpid 1: sysexit start: munmap(0x0, 0x6d000, 0x6d000, 0x80000, 0x80000, 0xf2f13000) = 0x0 [0xff9dcad0, 0]
proot info: vpid 1: sysexit end: munmap(0x0, 0x6d000, 0x6d000, 0x80000, 0x80000, 0xf2f13000) = 0x0 [0xff9dcad0, 0]
proot info: vpid 1: sysenter start: munmap(0xf3000000, 0x12000, 0x6d000, 0x80000, 0x80000, 0xf2f80000) = 0xf3000000 [0xff9dcad0, 0]
proot info: vpid 1: sysenter end: munmap(0xf3000000, 0x12000, 0x6d000, 0x80000, 0x80000, 0xf2f80000) = 0xf3000000 [0xff9dcad0, 0]
proot info: vpid 1: sysexit start: munmap(0x0, 0x12000, 0x6d000, 0x80000, 0x80000, 0xf2f80000) = 0x0 [0xff9dcad0, 0]
proot info: vpid 1: sysexit end: munmap(0x0, 0x12000, 0x6d000, 0x80000, 0x80000, 0xf2f80000) = 0x0 [0xff9dcad0, 0]
proot info: vpid 1: sysenter start: prctl(0x26, 0x1, 0x0, 0x0, 0x0, 0x1f0cb4a8) = 0x26 [0xff9dcdc8, 0]
proot info: vpid 1: sysenter end: prctl(0x26, 0x1, 0x0, 0x0, 0x0, 0x1f0cb4a8) = 0x26 [0xff9dcdc8, 0]
proot info: vpid 1: sysexit start: prctl(0x0, 0x1, 0x0, 0x0, 0x0, 0x1f0cb4a8) = 0x0 [0xff9dcdc8, 0]
proot info: vpid 1: sysexit end: prctl(0x0, 0x1, 0x0, 0x0, 0x0, 0x1f0cb4a8) = 0x0 [0xff9dcdc8, 0]
proot info: vpid 1: sysenter start: prctl(0x16, 0x2, 0xff9dcde8, 0x0, 0x0, 0x1f0cb4a8) = 0x16 [0xff9dcdc8, 0]
proot info: vpid 1: sysenter end: prctl(0x16, 0x2, 0xff9dcde8, 0x0, 0x0, 0x1f0cb4a8) = 0x16 [0xff9dcdc8, 0]
proot info: vpid 1: sysexit start: prctl(0x0, 0x2, 0xff9dcde8, 0x0, 0x0, 0x1f0cb4a8) = 0x0 [0xff9dcdc8, 0]
proot info: vpid 1: sysexit end: prctl(0x0, 0x2, 0xff9dcde8, 0x0, 0x0, 0x1f0cb4a8) = 0x0 [0xff9dcdc8, 0]
proot info: vpid 1: sysenter start: execve(0xf31c5030, 0xff9deeb0, 0xff9deebc, 0x2f, 0xf319c030, 0xff9deeb0) = 0xf31c5030 [0xff9dcdd8, 0]
proot info: vpid 1: translate("/" + "/usr/bin/xbps-install")
proot info: vpid 1:          -> "/usr/bin/xbps-install"
proot info: vpid 1: translate("/" + "/lib/ld-linux-armhf.so.3")
proot info: vpid 1:          -> "/usr/lib/ld-linux-armhf.so.3"
proot info: vpid 1: sysenter end: execve(0xff9dcda3, 0xff9deeb0, 0xff9deebc, 0x2f, 0xf319c030, 0xff9deeb0) = 0xff9dcda3 [0xff9dcda3, 0]
proot info: vpid 1: sysexit start: execve(0x0, 0xff87ae10, 0x20000001, 0x2, 0x3, 0x4) = 0x0 [0xff87ae10, 0]
proot info: vpid 1: sysexit end: execve(0xff87ad50, 0xff87ae10, 0x20000001, 0x2, 0x3, 0x4) = 0xff87ad50 [0xff87ad50, 0]
proot info: vpid 1: translate("/" + "/usr/bin/xbps-install")
proot info: vpid 1:          -> "/usr/bin/xbps-install"
proot info: vpid 1: terminated with signal 4

Problem description

Unable to update installed void distribution

What steps will reproduce the bug?

$ pkg install proot-distro $ proot-distro login void -bash-5.1# xbps-install -Su [*] Updating repositoryhttps://repo-default.voidlinux.org/current/armv7l-repodata' ... Certificate verification failed for /C=US/O=Internet Security Research Group/CN=ISRG Root X1 SSL_connect returned 1 ERROR: [reposync] failed to fetch file https://repo-default.voidlinux.org/current/armv7l-repodata': Operation not permitted

What is the expected behavior?

Update distro

Additional information

~ $ termux-info
Termux Variables:
TERMUX_APK_RELEASE=GITHUB
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=11022
TERMUX_IS_DEBUGGABLE_BUILD=1
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://mirror.surf/termux/termux-main/ stable main
Updatable packages:
All packages up to date
termux-tools version:
1.38.1
Android version:
9
Kernel build information:
Linux localhost 3.18.91-16078765 #1 SMP PREEMPT Tue Jul 13 22:02:42 KST 2021 armv8l Android
Device manufacturer:
samsung
Device model:
SM-J701F
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
sylirre commented 1 year ago

Don't run nested proot inside proot-distro. Use this instead:

PROOT_VERBOSE=9 proot-distro login void -- xbps-install -Su > proot-log.txt 2>&1

And attach the proot-log.txt file here as it would be long.

jindamvani commented 1 year ago

Don't run nested proot inside proot-distro. Use this instead:

PROOT_VERBOSE=9 proot-distro login void -- xbps-install -Su > proot-log.txt 2>&1

And attach the proot-log.txt file here as it would be long.

Done. Output of proot -v 9 proot-distro login void -- xbps-install -Su > /sdcard/proot-log.txt 2>&1 proot-log.txt

jindamvani commented 1 year ago
jindamvani commented 1 year ago

I did some testing upon abby suggestion voidlinux irc:

sylirre commented 1 year ago

https://github.com/termux/proot-distro/issues/307#issuecomment-1569628297

jindamvani commented 1 year ago
jindamvani commented 1 year ago

voidlinux irc conversation, might be usefull for somebody

06:02:48 <jindam> is libressl mandatory for xbps-updates? i am trying to install and configure using proot-distro on android mobile device

06:03:54 <jindam> but when i try to xbps-install -Su and fails with Operation not permitted

06:04:26 <abby> libressl should not be installed

06:04:42 <jindam> i have reported both on proot & void-infrastructure

06:04:47 <abby> as void no longer uses it (openssl is used instead)

06:05:08 <abby> i asked that because it was a common issue at one point

06:05:10 <jindam> void issue: https://github.com/void-linux/void-infrastructure/issues/162

06:05:46 <jindam> proot issue: https://github.com/termux/proot/issues/274

06:06:50 <jindam> couple of issues suggested "SSL_NO_VERIFY_PEER=1"

06:07:28 <abby> if you go to https://repo-default.voidlinux.org on the host do you also have issues

06:07:32 <jindam> but i am strongly *against* it, inless there is someother kind of verification

06:07:46 <abby> or curl outside of proof in termux

06:07:46 <jindam> no

06:08:06 <abby> proot*

06:08:06 <jindam> i verified ssl cert. on ssllabs also

06:08:38 <jindam> cert expires in 2024

06:08:48 <abby> packages themselves are signed so it's perfectly fine to disable SSL verification

06:13:40 <jindam> $ curl -Is https://repo-default.voidlinux.org/ | head -n 1HTTP/2 200, ~ $ proot-distro login void -bash-5.1# curl -Is https://repo-default.voidlinux.org/ | head -n 1 HTTP/2 200

06:16:33 <abby> openssl s_client -connect repo-default.voidlinux.org:443 -verify_return_error

06:18:55 <jindam> inside proot https://paste.debian.net/1281546/

06:20:57 <abby> I would SSL_NO_VERIFY_PEER=1 xbps-install -Su ca-certificates

06:21:08 <abby> sounds like you don't have the right certs in the proot container

06:40:40 <jindam> excuse, abby ouput inside termux https://paste.debian.net/1281548/

06:41:12 <abby> did you try updating ca-certificates? SSL_NO_VERIFY_PEER=1 xbps-install -Su ca-certificates

06:51:49 <jindam> no, i will try now, just a minute

06:53:10 <jindam> abby, just now successfuly installed

06:53:50 <abby> try the openssl s_client command again

06:54:38 <jindam> "SSL_NO_VERIFY_PEER=1" option has become permanent

06:55:03 <abby> ?

06:56:15 <jindam> abby https://paste.debian.net/1281556/

06:56:40 <abby> is that in the proot?

07:06:01 <jindam> abby yes

07:06:28 <abby> then that's not ssl_no_verify_peer being permenant, that's it working

07:06:36 <abby> unless you exported no_verify_peer

07:06:50 <abby> if you just prepended it to the command, it would only apply to that command

07:06:57 <jindam> ok

07:19:57 <jindam> however installed both updates and ca-certs., abby do you think is there any issue still with proot?

07:20:06 <abby> probably