Introduction:
I formatted a SDCard in ext4 and copied an ArchVersion on it to run it from Android like in this guide (step 6). Of course my device is rooted and am running the following scripts and commands in the Terminal Emulator as superuser.
Device-info:
- Phone: Sony Xperia Z1
- Model number: C6903
- Android version: 5.1.1
- Build Number: 14.6.A.1.236
Issue:
When I execute sh chroot_bashonly.sh
the error tmp-mksh: chroot: not found
appears. Of course I looked in the script to figure it out myself:
chroot_bashonly.sh:
#!/bin/sh
export LINUXROOT=/data/local/mnt
export TMPDIR=/tmp
export HOME=/root
export USER=root
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH
export TERM=vt100
sh ./mount.sh
echo "******* Your chroot-environment is starting now ********"
chroot $LINUXROOT /bin/bash # tmp-mksh: chroot: not found
echo "******* You exited the chroot-environment, unmounting... ********"
sh ./umount.sh
echo " ## DONE"
mount.sh:
#!/bin/sh
export LINUXROOT=/data/local/mnt
export TMPDIR=/tmp
export HOME=/root
export USER=root
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH
export TERM=vt100
# mount /
mkdir $LINUXROOT #works
mount -t ext4 -o noatime,rw /dev/block/mmcblk1p2 $LINUXROOT #works
# mount other stuff
mkdir -p $LINUXROOT/proc
mkdir -p $LINUXROOT/sys
mkdir -p $LINUXROOT/dev
mkdir -p $LINUXROOT/dev/pts
mkdir -p $LINUXROOT/var/lib/dbus
mkdir -p $LINUXROOT/android_storage/sdcard0
mkdir -p $LINUXROOT/android_storage/sdcard1
mkdir -p $LINUXROOT/system
mount -t proc proc $LINUXROOT/proc
mount -t sysfs sysfs $LINUXROOT/sys
mount -o bind /dev $LINUXROOT/dev
mount -t devpts devpts $LINUXROOT/dev/pts
mount -o bind /system $LINUXROOT/system
mount -o bind /storage/sdcard0 $LINUXROOT/android_storage/sdcard0
mount -o bind /storage/sdcard1 $LINUXROOT/android_storage/sdcard1
echo "******* everything mounted ********"
I think the mount.sh part works, at least I get no error and the mkdir
-created folders existing. So the next thing I tried was to run chroot
outside the script in many forms with the same error.
chroot /data/local/mnt /bin/bash
chroot /data/local/mnt /system/bin/sh
chroot /data/local/mnt /bin/sh
All having the same issue: tmp-mksh: chroot: not found
.
So what is wrong?
Is chroot even available on Android?