Closed SDRausty closed 6 years ago
I'm working on fix, for now you should be able to work around this with export PROOT_NO_SECCOMP=1
It's because in Linux 4.8 order of PTRACE_SYSCALL event and seccomp event was swapped (Linux commit, mailing list post, upstream PRoot issue)
I have committed the work around; Results are pending. Thank you for your time and quick reply.
Using export PROOT_NO_SECCOMP=1
works as a work around for the issue of installing Arch Linux in Termux PRoot on Android 8. There are still some issues with installing keys however:
Any advice is welcome https://github.com/sdrausty/TermuxArch/issues/59#issuecomment-381349182; Thank you for your advice and good work.
@michalbednarski do you have any idea what can be causing these errors on Android 8?
Welcome to Termux!
Wiki: https://wiki.termux.com
Community forum: https://termux.com/community
IRC channel: #termux on freenode
Gitter chat: https://gitter.im/termux/termux
Mailing list: termux+subscribe@groups.io
Search packages: pkg search <query>
Install a package: pkg install <package>
Upgrade packages: pkg upgrade
Learn more: pkg help
$ startarch
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
Welcome to Arch Linux in Termux! Enjoy!
Chat: https://gitter.im/termux/termux/
Help: info query and man query
Portal: https://wiki.termux.com/wiki/Community
Install a package: pacman -S package
More information: pacman [-D|F|Q|R|S|T|U]h
Search packages: pacman -Ss query
Upgrade packages: pacman -Syu
[00:26 . ]$ pwd
pwd: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
[00:26 . ]$ whoami
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
root
[00:27 . ]$
The default PRoot statement from startarch
:
exec proot --kill-on-exit --link2symlink -0 -r /data/data/com.termux/files/home/arch -b $ANDROID_DATA -b /dev/ -b $EXTERNAL_STORAGE -b $HOME -b /proc/ -b /storage/ -b /sys/ -w "$PWD" /usr/bin/env -i HOME=/root TERM=xterm-256color /bin/bash -l ||:
Do you see anything that might be causing 8 to hiccup? All's well with Android 5-7, but not with Android 8.
Function not implement suggests ENOSYS, violation of seccomp policy (system one, not one provided by PRoot). I'll build aarch64 Oreo AOSP to check if I could reproduce it there, anyway I haven't solution yet.
@michalbednarski closer, will we have the cigar with the coffee? export PROOT_NO_SECCOMP=1
got the image unpacked, step one. Here is the latest update of clues from https://github.com/sdrausty/TermuxArch/issues/59:
$ startarch command addauser user
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
su: cannot change directory to /su: : Function not implemented
cannot set group id: Function not implemented
$ startarch su
su: su: cannot change directory to /cannot set group id: : Function not implemented
Function not implemented
$ startarch su user "pwd & whoami"
su: cannot change directory to /: Function not implemented
su: cannot set group id: Function not implemented
$
Thanks for checking deeper into this. It seems like we are standing at a huge gate, and it's still closed.
@michalbednarski a couple more decent clues just arrived. The first one is combined from two posts:
$ startarch command addauser user
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
su: cannot change directory to /su: : Function not implemented
cannot set group id: Function not implemented
$ ls -al arch/home/
total 16
drwxr-xr-x 4 u0_a290 u0_a290 4096 Apr 16 04:15 .
drwx------ 16 u0_a290 u0_a290 4096 Apr 16 04:16 ..
-rw------- 1 u0_a290 u0_a290 0 Apr 16 04:15 .chushlogin
drwx------ 2 u0_a290 u0_a290 4096 Apr 15 05:32 alarm
drwxr-x--- 4 u0_a290 u0_a290 4096 Apr 16 04:16 user
$ ls -al arch/home/user/
total 32
drwxr-x--- 4 u0_a290 u0_a290 4096 Apr 16 04:16 .
drwxr-xr-x 4 u0_a290 u0_a290 4096 Apr 16 04:15 ..
-rw------- 1 u0_a290 u0_a290 63 Apr 16 04:14 .bash_history
-rw------- 1 u0_a290 u0_a290 106 Apr 16 04:14 .bash_profile
-rw------- 1 u0_a290 u0_a290 876 Apr 16 04:14 .bashrc
-rw------- 1 u0_a290 u0_a290 0 Apr 16 04:16 .chushlogin
drwx------ 3 u0_a290 u0_a290 4096 Apr 16 04:14 .gnupg
-rw------- 1 u0_a290 u0_a290 22 Apr 16 04:14 .profile
drwx------ 2 u0_a290 u0_a290 4096 Apr 16 04:14 bin
This means that cp -r /root /home/$1
from addauser
ran correctly. Also:
$ startarch
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
Welcome to Arch Linux in Termux! Enjoy!
Chat: https://gitter.im/termux/termux/
Help: info query and man query
Portal: https://wiki.termux.com/wiki/Community
Install a package: pacman -S package
More information: pacman [-D|F|Q|R|S|T|U]h
Search packages: pacman -Ss query
Upgrade packages: pacman -Syu
[22:36 . ]$ whoami
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
root
[22:36 . ]$ pwd
pwd: error retrieving current directory: getcwd: cannot access parent directories: Function not implemented
[22:36 . ]$
indicates that .bash_profile
was sourced.
@michalbednarski Do you see anything here exec proot --kill-on-exit --link2symlink -0 -r /data/data/com.termux/files/home/arch -b $ANDROID_DATA -b /dev/ -b $EXTERNAL_STORAGE -b $HOME -b /proc/ -b /storage/ -b /sys/ -w "$PWD" /usr/bin/env -i HOME=/root TERM=xterm-256color /bin/bash -l
that Android 8 might not like?
.bash_profile
was sourced.
export
is set correctly in PRoot also.
@michalbednarski this came in yesterday from Android 8 Termux user https://github.com/soulzzz:
proot error: execve("/usr/bin/env"): No such file or directory proot info: It seems that termux-exec is active and is prepending /data/data/com.termux/... to executable paths If this is path is not available inside proot, please "unset LD_PRELOAD" fatal error: see proot --help. proot error: can't chmod '/data/data/com.termux/files/usr/tmp//proot-7158-fxZbkm': No such file or directory
when unzipping linux files it shows
Ignoring unknown extended header keyword 'SCHILY.fflags' after each commands
From https://github.com/sdrausty/TermuxArch/issues/70#issuecomment-382602367
At present, there is only one to present for Android 8 https://github.com/sdrausty/TermuxArch/issues/74 Android 8 System Information : bash setupTermuxArch.sh sysinfo
#74 The reason that this topic is being brought up; Are there any calls that can be added to help debug?
It seems that termux-exec is active and is prepending /data/data/com.termux/... to executable paths If this is path is not available inside proot, please "unset LD_PRELOAD"
Exactly as message says, first program failed to execute and proot noticed termux-exec in LD_PRELOAD, that command was not either not run from your script, there's some bug in your script and it kept LD_PRELOAD
, or bug in something above (as a generic note nesting proot
is not supported and causes issues, make sure you're not inside proot
(e.g. termux-chroot
) already)
In this issue there's probably something between libc, proot and kernel, so I cannot point anything in script snippets. I'm trying to set up reproduction AOSP environment, but running AArch64 AOSP Oreo with modified kernel somehow became surprisingly difficult.
Thanks for the update. Correct me if I misunderstood. It is possible that this user is already in a PRoot environment or similar.
there's some bug in your script
There is one that I know of, but it is unrelated to this topic. The script is much better than the first versions which produced errors for a long time before finally giving a positive result. Patheticly ugly mesmer for long minutes scrolling and scrolling, then a test command, another, another, and another, flying results awe when compared with other Linux distributions tested (I could have stopped there, and never bothered publishing this script), TermuxArch has come long way from the first runs. On all the devices (Android 5-7 armv7-8) that I have, Arch Linux in Termux PRoot installs without any trouble. Termux PRoot is a wonderful product.
Are there any calls that can be added to help debug?
For example prs () can be modified with a verbose option. How would this snippet look?
$ proot --help |grep verb
-v *value*, --verbose=*value*
Creating options like verbose1, verbose2, etc... should not be an issue, but is it worth it? Which values are best for our want, if any? This can be integrated into setupTermuxArch.sh refresh
which creates the PRoot startup file.
As far as I know, this is the valid solution at present:
#!/bin/bash -e
export PROOT_NO_SECCOMP=1
unset LD_PRELOAD
There are five sets of these in TermuxArch. Running one inside the other should not affect the functionality whatsoever; There are no calls that call proot from inside proot.
Update from the first Android 8 user @Root-voidX:
I actually think it's an issue with android 8.0 itself
From https://github.com/sdrausty/TermuxArch/issues/72#issuecomment-382583864
The second user @soulzzz has not shared any additional information. I have reworked the issue pages with the hope that we will get more information about Android 8 Oreo. Both users were invited to participate here. Can you confirm what is happening with Android 8 Oreo?
a) Android 8 works well with Termux, only some users are having issues. b) Almost all Android 8 users are having a hard time with Termux.
It seems like scenario a) is what is going on, but I am not sure.
trying to set up reproduction AOSP environment
It would be nice if someone sent us a Pixel, wouldn't it? Maybe we should do some crowdfunding?
I've finally got reproduction environment so I can finally start really working on it (but keep in mind that from reproducing problem to having solution is still some work to do and I have job/family/life to spent time on too, so please be patient)
I actually think it's an issue with android 8.0 itself
Can you confirm what is happening with Android 8 Oreo? a) Android 8 works well with Termux, only some users are having issues. b) Almost all Android 8 users are having a hard time with Termux.
You need to realize that it's not just about Android version, but also about Linux (kernel) version, which isn't tightly coupled to Android versions, OEMs can choose to use different kernel versions with particular Android version (AFAIK their choice of kernel version depends on for what version they have drivers ready for). For example, on my phone I've got Android 8.0 with Linux 4.4 and TermuxArch runs fine there.
The changes that broke proot are:
there's some bug in your script
unset LD_PRELOAD
That's what should have avoided termux-exec problem, yet somehow we've got it (but that is separate issue probably unrelated to main one in this thread). Bug in script is only one of possibilities and I'd expect that error was actually caused by manually running command (as I don't really know how could unset
fail)
Correct me if I misunderstood. It is possible that this user is already in a PRoot environment or similar.
Some users like to autostart termux-chroot
script, in which case there can be problems with nested PRoots
@michalbednarski
I was original poster for the issue in termux-arch.
It could be possible that it is a kernel issue.
Linux localhost 4.9.65-13087505 #1 SMP PREEMPT Sun Feb 25 18:48:40 KST 2018 aarch64 Android
That's the kernel version I am using. It's a snapdragon 845 so it's the latest version. Maybe it's a issue specifically to it?
AFAIK issue is related to change in mainline kernel.
Could you check what result does this program print if run under proot
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
int main() {
int a = open("nonexistent-test-file-a", O_RDONLY);
int ae = errno;
int b = open("nonexistent-test-dir/nonexistent-test-file-b", O_RDONLY);
int be = errno;
int c = open("nonexistent-test-file-c", O_RDONLY);
int ce = errno;
printf("[%d %d %d %d %d %d]\n", a, ae, b, be, c, ce);
}
clang testapp.c -o testapp
PROOT_NO_SECCOMP=1 proot ./testapp
@Root-voidX @soulzzz this https://github.com/sdrausty/TermuxArch/commit/ed9464cb620fb62a55f76ad230b18a4f2d01e714 commit adds this test to the TermuxArch repository. Run ktest.sh
to produce a result like this one:
$ PROOT_NO_SECCOMP=1 proot ./testapp
[-1 2 -1 2 -1 2]
We want these test results to be able to improve the Android 8 user experience in Termux.
@michalbednarski thank you for contributing this test; provide as many as you wish. I will be happy to convert them into BASH scripts for our Termux users for one tap on Android 8 PRoot test results.
@michalbednarski @sdrausty
Here you go.
cd proot
$ ls
ktest.sh testapp
$ bash ktest.sh
PRoot test results:
[-1 2 -1 38 -1 2]
$
I have initial fix for this issue (now on master branch here and on termux/termux-packages#2374).
Please remove PROOT_NO_SECCOMP=1
as it's use will prevent proot from detecting whenever it should use new behavior (In case of problems PROOT_NO_SECCOMP=1 PROOT_ASSUME_NEW_SECCOMP=1
could be used, however this will break on older Linux versions while not providing any should work across all versions)
Running debuggers inside proot on Linux >= 4.8 is not yet supported
Sounds good, once @sdrausty commits this, I will try it. Thst is unfortunate that debugger doesn't work on 4.9. Worst comes to worse, I have a older rooted tablet where I can just chroot to play around with. Would love to use the latest and greatest though.
@michalbednarski thank you for your time and consideration in this matter; looks like we have a solution. However this information just came in:
able to run Arch prooted on 8.1
From https://github.com/sdrausty/TermuxArch/issues/74#issuecomment-385196484 by https://github.com/SwiftLawnGnome
@Root-voidX untill I can get around to creating another commit, use the following to get the same results @michalbednarski proposed:
$ bash setupTermuxArch.sh bloom
$ cd ~/TermuxArchBloom
$ sed -i '/PROOT_NO_SECCOMP/d' *sh
$ bash setupTermuxArch.sh
Let us know if this resolves the issue on your device; doctor's visit with smartphone SAR pocket burn is causing me to retire.
Reference: https://www.fcc.gov/general/specific-absorption-rate-sar-cellular-telephones
I've pushed new proot version which fixes debugging and hang after which Ctrl-C exits proot and makes bash print [1] Stopped
message (this was regression in yesterday commit, this happened when process inside proot got killed before it performed any syscall, this might be
But my zsh init file will not load, it will just hang until I press Ctrl-c and then it will return to the default prompt.
thing described by @SwiftLawnGnome in https://github.com/sdrausty/TermuxArch/issues/74#issuecomment-385196484).
Version from my yesterday commit is now in apt repo, for status on todays version see termux/termux-packages#2383
@michalbednarski @Root-voidX this https://github.com/sdrausty/TermuxArch/commit/0b218c74d8736fab0044bc4468ddd66d7c3920bc commit depreciates export PROOT_NO_SECCOMP=1
from TermuxArch.
doctor's visit with smartphone SAR pocket burn
After boasting to our group, "Strolling with our Termux network..." Have you ever had your doctor scold you for carrying your smartphone in your pants pocket?
Android 6 armv7 machine successfully installed Arch Linux in Termux PRoot and also had a massive data error : due for hard reset (possibly unrelated to this issue)
@Root-voidX @soulzzz @SwiftLawnGnome as far as I can tell this issue can be closed; Can you confirm this on the Android 8 device?
@sdrausty
I ran the installer again on 8.0 on the newest kernal on s9+ using sd 845.
Can you explain these warnings and errors:
warning: could not get file information for boot/Image
warning: could not get file information for usr/lib/modules/4.16.0-1-ARCH/build/vmlinux
:: Processing package changes...
( 1/32) upgrading linux-api-headers [#######] 100%
( 2/32) upgrading glibc [#######] 100%
warning: /etc/locale.gen installed as /etc/locale.gen.pacnew
Generating locales...
en_US.UTF-8... done
OR THIS
linux.img
==> Starting build: 4.16.6-1-ARCH
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [autodetect]
sort: cannot read: '/sys/devices/platform/soc/soc:qcom,llccbw/devfreq/soc:qcom,llccbw/uevent': Permission denied
sort: cannot read: /sys/devices/virtual/mdnie/mdnie/uevent: Permission denied
modprobe: ERROR: missing parameters. See -h.
-> Running build hook: [modconf]
-> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: wd719x
-> Running build hook: [filesystems]
-> Running build hook: [keyboard]
-> Running build hook: [fsck]
==> ERROR: file not found: `fsck.rootfs'
==> WARNING: No fsck helpers found. fsck will not be run on boot.
/usr/lib/initcpio/functions: line 636: /dev/stdin: No such file or directory
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
==> WARNING: errors were encountered during the build. The image may not be complete.
==> Building image from preset: /etc/mkinitcpio.d/linux-aarch64.preset: 'fallback'
-> -k 4.16.6-1-ARCH -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> Starting build: 4.16.6-1-ARCH
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [modconf]
-> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: wd719x
-> Running build hook: [filesystems]
-> Running build hook: [keyboard]
-> Running build hook: [fsck]
/usr/lib/initcpio/functions: line 636: /dev/stdin: No such file or directory
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img
==> Image generation successful
error: command failed to execute correctly
( 2/12) Warn about old perl modules
( 3/12) Updating journal message catalog...
( 4/12) Reloading system manager configuration...
Skipped: Current root is not booted.
( 5/12) Updating udev hardware database...
( 6/12) Applying kernel sysctl settings...
Skipped: Current root is not booted.
( 7/12) Creating system user accounts...
( 8/12) Creating temporary files...
[tmp.conf:15] Failed to replace specifiers: /tmp/systemd-private-%b-*
[tmp.conf:16] Failed to replace specifiers: /tmp/systemd-private-%b-*/tmp
[tmp.conf:17] Failed to replace specifiers: /var/tmp/systemd-private-%b-*
[tmp.conf:18] Failed to replace specifiers: /var/tmp/systemd-private-%b-*/tmp
error: command failed to execute correctly
Otherwise it installed and I can run arch kinda: https://imgur.com/a/kupJv4r
I just wanna make sure those errors dont cause fatal errors later on.
@Root-voidX afaikt, these are SELinux related.
@sdrausty yeah it seems they are mostly warnings and proot seems to suppress them and continue working. So I guess it's all good. I'll let you guys know of any other issues in the termux-arch github thanks for the help.
@Root-voidX you're welcome. Thank you for the update.
@michalbednarski where does /dev/shm fit in? Can $TMP accomplish this want? It appears to be important in a many issues:
1) https://github.com/sdrausty/termux-archlinux/issues/4 2) https://github.com/sdrausty/TermuxArch/issues/38 3) https://github.com/sdrausty/TermuxArch/issues/55https://github.com/sdrausty/TermuxArch/issues/59#issuecomment-381380567 4) https://github.com/sdrausty/TermuxArch/issues/68 5) etc...
To enchance the UX https://github.com/sdrausty/TermuxArch/issues is open. Arch Linux Termux users are encouraged to share here.
@sdrausty
/dev/shm
is directory used by POSIX shared memory (shm_open
), it should be directory where apps can write (but not same as /tmp
, though if it would be it probably wouldn't break anything))
@Root-voidX
These are caused by kernel related scripts, but as unprivileged app we can't manage kernel and devices. It seems that kernel and firmware packages can be removed (pacman -R linux-aarch64 linux-firmware
, TermuxArch uses kernel and firmware from host Android anyway, however it is possible that those packages are dependency for something else)
@michalbednarski
Would you suggest keeping them anyway. Seems like the errors were suppressed. Pacman indicates a successful install?
@michalbednarski @Root-voidX the command trim
is used in many shortcut commands, and the initial testing results of pacman -R linux-aarch64 linux-firmware
encourage adjusting addtrim () with this bomb tweak; Do you agree?
Interesting tidbit, arch loaded in that latest firmware and kernal for my device in an update. Install went fine with no errors, a bunch of read warnings but that's about it.
Armv7-8 tests indicate that pacman -Rc linux-aarch64 linux-firmware systemd
and similar are OK. Thank you for suggesting this @michalbednarski
@Root-voidX thanks for this comment:
bunch of read warnings but that's about it.
If you would like to test, uncomment dfl=/gen
and use bash setupTermuxArch.sh refresh
. Everything indicates a go for migrating this to stable after user printout information is added.
ED: This is now https://github.com/sdrausty/TermuxArch/commit/9f6e881f01553046e048352e033ef23017bfbd94 merged into stable for all architectures.
ED2: This https://github.com/termux/libandroid-shmem project might give us the shm functionality we are seeking in this issue, and these:
1) https://github.com/sdrausty/termux-archlinux/issues/4 1) https://github.com/sdrausty/TermuxArch/issues/38 3) https://github.com/sdrausty/TermuxArch/issues/55 3) https://github.com/sdrausty/TermuxArch/issues/59#issuecomment-381380567 4) https://github.com/sdrausty/TermuxArch/issues/68
Hi I dont know where to write this so sorry if that is wrong place :/ I have Honor 8x android 8.1 and after installing LXDE on Kali nethunter in Termux (in kali apt update && apt upgrade are ok) i have such error:
Setting up man-db (2.8.4-2+b1) ... Building database of manual pages ... ./tracee/event.c:517: int handle_tracee_event(Tracee *, int): assertion "!IS_IN_SYSENTER(tracee)" failed proot warning: signal 6 received from process 7750 $ I can admit that everything was ok on my ze520kl android 8.0 version. Does anybody has solution for my problem?
In ubuntu, sudo works as long as you don't use --link2symlink
...
But then you cant apt install
anything....
*on an non-rooted device
@bakaika It is completely different issue. Not https://github.com/termux/proot/issues/13.
Oh sorry. What issue is it?
Open new.
@Root-voidX asked, "A few questions about Arch Linux in Termux PRoot #59" including:
After working on this issue; Here is what we have:
Assertion "IS_IN_SYSENTER(tracee)" failed: Proot warning: signal 6 recieved when
proot --link2symlink -0 $PREFIX/bin/applets/tar xf $file
is called. Busyboxtar
never finishes unpacking the downloaded system image file. Insight is welcome.