1

Introduction:

I formatted a SDCard in ext4 and copied an ArchVersion on it to run it from Android like in this guide (step 7). Of course my device is rooted and I 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:

After executing sh storage/emulated/0/linux/linux.sh 2> storage/emulated/0/linux/output.txtthe device ends up in Android again because the command chroot /data/local/mnt /init.sh can't execute /init.sh: Permission denied.

linux.sh:

#!/system/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 # works fine
sh ./stopandroid.sh # works fine

echo "******* Your chroot-environment is starting now ********"
chroot $LINUXROOT /init.sh # can't execute /init.sh: Permission denied
echo "******* You exited the chroot-environment, unmounting... ********"

sh ./umount.sh
sh ./startandroid.sh

echo " ## DONE"

I already found some posts about this issue together with LinuxonAndroid and BusyBox. I do not use LinuxonAndroid and installed BusyBox from Google Play Store which should solve the problem when running another BusyBox-version what I do not.

Like it is stated here it may require to chmod 0755 /data/data/com.zpwebsites.linuxonandroid/files/busybox which is not possible in my case, because obviously the folder com.zpwebsites.linuxonandroid does not exist.

So I searched for busybox inside /data/data, found one file and changed permission: chmod 0777 data/data/stericson.busybox/files/bb/busybox.

I also changed the permissions of init.sh: chmod 777 init.sh

I also tried to run the command chroot /data/local/mnt /init.sh in the terminal with the same result.

After these changes I really do not have a clue whats wrong.

Any suggestions?

  • Look at how the card was mounted. Usually, SD cards are mounted with the noexec option, which means exactly that: not giving the permission to execute stuff. – Izzy Jul 12 '16 at 15:14
  • I added exec to the mount command: mount -t ext4 -o noatime,rw,exec /dev/block/mmcblk1p2 $LINUXROOT but it does not change the result, but I added another test.sh and chroot with it, also getting the permission denied error. But sh test.sh works, so I can execute but not inside the chroot command. – goulashsoup Jul 12 '16 at 17:31
  • have you checked with e.g. mount | grep mmcblk1p2 whether the flag was accepted? – Izzy Jul 12 '16 at 17:33
  • I executed mount | grep mmcblk1p2 and exec is not part of the flags, so how do I get it mounted with exec accepted? And why can I execute a normal .sh-file if exec is not accepted? – goulashsoup Jul 12 '16 at 21:23
  • 1
    No it does not... -> output: /dev/block/mmcblk1p2 /data/local/mnt ext4 rw,seclabel,noatime,data=ordered 0 0 – goulashsoup Jul 12 '16 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.