proot
proot copied to clipboard
Android Huavei mobile phones and Proot
I have read The following debate related to Userland development.
https://github.com/CypherpunkArmory/UserLAnd/issues/170 So I Am wondering, if non functioning Pokedata of Huavei Android kernels can not be also The cause of The problems with The file system extraction. Programmers had to recode Proot source to overcome The issue with Pokedata, so Proot work much more faster. But what if this googly thinked work around can cause file system extractions issues on some devices. There is one fact. Some Android kernels do not support Proot as it should. There are issues with file system case file sensitivity and other issues. The question is, if there is even The chance from The perspective of Proot developers to overcome those issues. Or if those issues are The effect of various ddevelopment strategies while developing The Android kernels for various devices. What would happen, if would try older release of Proot, which have been originally created by Electron company? Or it was necessary to recode it to be compatible with Termux, so I can not simply recompile it from Termux and give it A try. I want to find some work around to support Huavei 10 lite mate and android 7.0 kernel. I had A right. The most functioning distribution is Fedora. Its container is causing only a few issues while installing some specific packages such as Perl interpreter. But Fedora have other important issues related to dbus. Debian is much more universal and Dbus is working even while using Debian chrooted container. No crashes, no issues. I have analysed many many articles on The Internet to find other routines which would work as a Proot, but I had no luck. Proot is very probably very improtant programmers invention and there is no similar technique. Qemu work very slowly if user do not installer rooted Android and if user will not install KQEMU kernel module for Android. I Am still thinkink and may be, that I will have some success on future.
POKEDATA issue doesn't appear to be present on your device (according to log you've posted in https://github.com/termux/proot/issues/84#issuecomment-562524615)
I still think you should be able to use Debian with modifications (as I've previously described in https://github.com/termux/proot/issues/84#issuecomment-564673007), however for some packages there might be further configuration changes necessary; please let me know which packages have issues there.
Also, could you run following commands (outside proot) and share trace.txt so I could confirm/reject hypothesis that case folding behavior is triggered by tracing program:
pkg install -y gdb strace
mkdir casetest
cd casetest
strace -o trace.txt touch teststrace TESTSTRACE
gdb --batch -ex r --args touch testgdb TESTGDB &>> trace.txt
touch testdirect TESTDIRECT
proot -v 9 touch testproot TESTPROOT &>> trace.txt
PROOT_NO_SECCOMP=1 proot -v 9 touch testnproot TESTNPROOT &>> trace.txt
ls -l &>> trace.txt
Dear MR Bednarski, Here is attached log file. I hope, that it will not be problems, that I have created it on download folder to easily move it from mobile device to The computer. The most annoing fact is, that not only Debian have issues with packages. All Linux distributions. But working with Debian makes The biggest sense for Me. Because task mate-desktop configures Dbus so it can be started by using Marco window manager. Fedora is using much more different philosophy so Dbus configuration from container is rather impossible. The onlyone hack is to use very old DBUS from Fedora before version 27 with 31 and this is not good technique. I will report Debian problems with packages here since my previous issue is closed.
Thank you for yours patience with Me. My second phone, Samsung Galaxy 5.1 with Android 6.1 have The same issue. So it is not only Huavei kernel problem, it seems to Me, that there are more manufacturers who have made this strange think with their kernels.
Looks like trace.txt wasn't generated correctly because some newlines were removed while you've copy-pasted commands
Could you try doing that using following snippet which replaces newlines with semicolons and switches to home directory (as on storage system is always case insensitive by design; after running code you can cp trace.txt /storage/emulated/0/Download/trace2.txt in order to upload it)
mkdir ~/casetest ; cd ~/casetest ; strace -o trace.txt touch teststrace TESTSTRACE ; gdb --batch -ex r --args touch testgdb TESTGDB &>> trace.txt ; touch testdirect TESTDIRECT ; proot -v 9 touch testproot TESTPROOT &>> trace.txt ; PROOT_NO_SECCOMP=1 proot -v 9 touch testnproot TESTNPROOT &>> trace.txt ; ls -l &>> trace.txt
Ok, I will do by this way as you have adviced to Me. I have not used copy and paste operations. I have used Windows Explorer to copy file from downloads folder to my harddisk and I have used attach file buton on The Github page. I will run it by using yours latest commands. I hope, that nothing will corrupt file stransfer for now.
Oh I have understood. My previous log have been generated incorrectly because I have used copy and paste commands to copy The command between Github WEB page window and Putty Window. May be, that NVDA screen reader places extra empty lines because it uses virtual area to present information about loaded WEB page. I will use select all and copy for The second time to use copy operation directly from The Browser.
OK, lI will rather return to The Debian, because The template apt install task-mate-desktop registers DBUS so marco window manager can correctly initiate ATSPI accessibility bus and Orca screen reader can perfectly work thanks to revolutionar and fully functioning Pulseaudio sound server which run directly from Termux. So thanks to yours script path, I can correctly install Debian. For a science validity and to prevent chaos from my side, here is The pathing script, if I have not corrupted some code inside it.
When you confirm that patching script is OK, I will install Debian and I will install mate-desktop But there is so many many packages, that we have very probably very limited chance to success. If I would know, which steps apt is doing that dbus is working with Marco, I could only install gnome-orca and Marco. But I have tested it, it is not enough. Only task-mate-desktop configures something very strangly but it is working with Orca. Mraco C source contain The needed code to initiate at-spi accessibility bus.
Looking at log you've provided it looks like problem has occurred with proot (in both operation modes), but not with gdb nor strace, I've made some additional tests in C and I'd ask for running below command and sharing case-test-results.txt
pkg install -y clang ; wget https://gist.github.com/michalbednarski/438b058f77f43dba78aa8d2ddd08f629/raw/de21dee783274d114fe0ed7b930bfa9219052fb6/proot-case-tests.c ; clang proot-case-tests.c -o ~/proot-case-tests ; ~/proot-case-tests &> case-test-results.txt
Depending on results it might be possible to make proot avoid kernel bug, although no promises yet.
Here testing program source can be viewed as gist.
If you've successfully installed system using above script then it means it was pasted correctly; in form you've attached it to above post it fails because of bash having problem with file having Windows style line endings as well as script has markdown markers. I yet have to prepare Debian configuration, although I'd prefer to fix problem on proot side if it turns out to be possible.
Here is The bug when installing task-mate-desktop I have used The following command
DEBIAN_FRONTEND=noninteractive apt install task-mate-desktop
Preparing to unpack .../19-python2.7_2.7.16-2+deb10u1_arm64.deb ... Progress: [ 2%] [#.........................................................] Unpacking python2.7 (2.7.16-2+deb10u1) ... Selecting previously unselected package libpython2-stdlib:arm64. Preparing to unpack .../20-libpython2-stdlib_2.7.16-1_arm64.deb ... Unpacking libpython2-stdlib:arm64 (2.7.16-1) ... Selecting previously unselected package libpython-stdlib:arm64. Preparing to unpack .../21-libpython-stdlib_2.7.16-1_arm64.deb ... Unpacking libpython-stdlib:arm64 (2.7.16-1) ... Errors were encountered while processing: /tmp/apt-dpkg-install-tv2usz/06-perl-modules-5.28_5.28.1-6_all.deb /tmp/apt-dpkg-install-tv2usz/08-libperl5.28_5.28.1-6_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1) And I can only dream about The successfull installation.
To be 100 % sure, that commands are working, I have used The following commands before typing ./enter_deb from The bin folder. mkdir -p deboot_debian/etc/dpkg/dpkg.cfg.d
echo path-exclude /usr/share/man/man7/pam.7.gz > deboot_debian/etc/dpkg/dpkg.cfg.d/01_bad_case
I Am afraid, that my The onlyone hope is to make my own virtual HTTP WEB server, which will host all .deb packages for ARM64 architeczure for The Debian version which is being used by The script. Rename all package names of .deb files so there will be only little letters, lover case never uppercase. Modify all .deb files so all file names inside it will only contain lover case letters, no uppercase. Recode Binary .so files and other so if it refer to uppercase .so file or similar file name so I would had to recode its call to lovercase letters. But when I analyse it, it would engage one or more year process.
Here is The needed .txt file. What do you think, is there any chance to avoid kernel bug, or unfortunately no?
I Am deeply appraciting you that you have The good will to invest yours time for my issue. Without yours knowledge, I would have The zero chance to success.
Thank you for yours thinkink, debugging and for yours kind access to Me.
Test cases didn't trigger kernel bug while invoking most important calls used by proot, which suggests that it'd probably be possible to avoid the bug, but still I have no idea how as I still don't know what actually triggers bug. I'll yet have to think how to analyze this further.
Thank you for The analysis. I will be patiently waiting for yours future instructions. I could even give you a remote access to my phone so you will have direct access to it no problem. I believe you that you will not corrupt it. So I Am even ready to debug with you by this way. Sure I Am also ready to send next protocols according to yours instructions.
I've modified patched installation to apply fixes and install task-mate-desktop. This script should be run from Termux home directory. Note that this script will erase existing installation and install new system with task-mate-desktop package. Patched installation has updated list of path excludes for dpkg and also skips configuration of udisks2 which is separate issue (probably not to be fixed on proot side). debian-mate-case.txt
To actually fix case sensitivity issue I think that I'd need interactive access to your phone, so in order to grant me remote access run following commands in Termux and post result from last one (which contains address to which I'll have to connect, but I still need to authenticate with my SSH key so it should be okay to post on public issue)
pkg install -y tmate ;
wget https://github.com/michalbednarski.keys ;
tmate -a michalbednarski.keys
Dear MR Bednarski, You are really The expert!!! I Am now running yours special script to install whole Debian with Mate. Because I want to make something also for many other Termux users, I will give you The permission to remotely control my phone. Because if you will be able to find The case file insensitivity issue, it would even help to specific Samsumg mobile phones users. I also have very positive feelings inside my soul that there is so kind man in The globe, who has so good will to help to other users by using his deep programmers knowledge. Yours lectors from university can be very prought on you. Yours C language knowledge are excellent and you even knows The kernel in deep level.
I think, that you will do yours best to not corrupt it. I have big problem, that I could not simply unplug The LION battery, since I do not see at all and plastic cover of he phone in this model is very un easy to open. But I think, that if you will only test from Termux that it should not happen, that phone will get to The never ending reboots or hang in some threads.
As far as i know in case of system hang you could reboot by long pressing (for about 10 seconds) power button, but I think it won't be necessary here.
Anyway, note that after running above commands you'll have to share connection address that is shown after running last command as otherwise I won't be able to connect nor see that you've ran them
I hope, that this output will be useful to you. There is no my IP address.
[tmate] ssh session: ssh [email protected]
Tip: if you wish to use tmate only for remote access, run: tmate -F
[0/0]To see the following messages again, run in a tmate session: tmate
show-messagesPress or to continue
Connecting to ssh.tmate.io... Note: clear your terminal before sharing readonly access ssh session read only: ssh [email protected] ssh session: ssh [email protected]
Do you have The possibility to connect? Or The output was not useful? Or do I have to run only tmate command Or is it OK and I can leave my phone intact connected to The AC adapter?
Thanks, I'm connected now
Does everything work smoothly? Connection is stable?
Thank you, I've just finished analysis and exited tmate, you might still need to release wakelock and/or exit Termux from Termux notification.
Tomorrow I'll start implementing workaround
Reduced code triggering bug and some technical notes are available at https://gist.github.com/michalbednarski/bef82aec3519d9f3225b72b9764a78ed
Thank you very very much for yours time and for The analysis. It is positive, that Proot can be modified. You are really truly professional. I wish you good night and I Am ready to test newest Proot.
I think I have a fix, you can install it with following commands (If you still have environment after my yesterday analysis you can skip first two lines)
pkg install -y proot git make clang ;
git clone https://github.com/termux/proot.git ;
cd proot/src ;
git fetch ;
git checkout -f origin/f2fs-case ;
make ;
make install ;
You can go back to normal proot version with apt install --reinstall proot
Thank you very very much for yours complex programmers work. I have yours environment from yesterday. So I can only use git clone https://github.com/termux/proot.git ; cd proot/src ; git fetch ; git checkout -f origin/f2fs-case ; make ; make install ; I have even noticed, that new version of Proot is available in The repository. Is it yours patched version or no?
I meant skipping git clone command as well (but if you keep it, it will just fail and remaining commands will continue using already cloned repo)
Update in apt repo is rebuild after dependency update and has no functional changes.
I will test yours new version by installing original Debian script. It it will not fail, it will be A strong evidence, that you have really found The solution. Thank you for yours hard work on this fix. I Am comfuser. When I do apt dist-upgrade it will install Proot from The rpository. So I will not use this for some time to let yours Proot version installed. I Am starting with Debian distro.
aI Am verx sorry to you, but I have experienced other errors. May be, that I have to remove Proot dir and clone it again or the work around can not solve The strange issue with file naming.
I: Extracting libpam-modules-bin... I: Extracting libpam-runtime... E: Tried to extract package, but file already exists. Exit... proot warning: f2fs bug probe failed to open third file with different errno than expected (errno=17): File exists proot error: can't create temporary file: Not a directory proot info: Please set PROOT_TMP_DIR env. variable to an alternate location (with write permission). proot error: execve("/usr/bin/env"): 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 warning: f2fs bug probe failed to open third file with different errno than expected (errno=17): File exists proot error: can't create temporary file: Not a directory proot info: Please set PROOT_TMP_DIR env. variable to an alternate location (with write permission). proot error: execve("/usr/bin/env"): 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.
installation successfully completed to enter the guest system type: $HOME/bin/enter_deb
Do not be afraid dear MR bednarski. Yours programmers work have not been lost to empty. In The end, I have yours modified Debian installation script with task-mate-desktop, so I will also test this. I will also try to install other distribution and install as much packages as possible to test file naming issue here. You have done yours best it seems that we are fighting with AN informatic enthrophy phenomena, it is not possible but may be, that internal flash chip inside my phone is corrupted so some Bytes of data are being randomly changing in time.
I have found interesting script Atilo to install various Linux distros including Fedora, Arch Linux. I will also test small Debian script and I will also test Arch Linux install script created by MR Rausty.
Looks like I've got sign with errno wrong in initial bug probe code (which decides if workaround should be activated on device), could you try running installation with PROOT_F2FS_WORKAROUND=1 environment variable set
(Run export PROOT_F2FS_WORKAROUND=1 and then proceed with installation as usual)
If still won't work with that I'd ask for log from following installation commands (these commands erase existing Debian installation)
rm -rf deboot_debian debootstrap debootstrap-1.0.116
PROOT_F2FS_WORKAROUND=1 PROOT_VERBOSE=9 bash -x debian_on_termux.sh |& gzip -9 > log-setup.txt.gz
Dear Mr Bednarski, you have really solved The case insensitive file system when using Proot on my device. Installation of Debian have been passed like A charm. No errors. Yours reconstruction of Proot C source code and yours last advice export PROOT_F2FS_WORKAROUND=1 Those two thinks have solved The issue. Only for informatic science purposes, I Am attaching The process of The Debian installation. Many users of Huavei devices will congratulate for yours outstanding work. And I Am very sorry for some of my amateours chaos. You are very patient human being. Thank you again. Very well done.
Here is The evidence, that Debian have been really installed successfully.