2

I have my chroot environment setup (Alpine Linux) in /sdcard/alpine. I try running my chroot with the following commands:

su
chroot alpine /bin/busybox 

(busybox is the cli of Alpine)

I get the following error:

chroot: exec /bin/busybox: Permission denied.

How can I fix this?

My device specs:

Google Pixel XL (marlin)

Android 9.0

Rooted (obviously) with Magisk

Reddy Lutonadio
  • 7,164
  • 2
  • 17
  • 49
HolyCow
  • 21
  • 1
  • 2

1 Answers1

2

Binaries can't be executed on /sdcard because it's an emulated filesystem with fixed file permissions, mounted with noexec mount option. Create alpine directory on some other filesystem e.g. /data:

~# mkdir -p /data/local/tmp/alpine/bin

Place your executable in newly created directory and do chroot:

~# cd /data/local/tmp
~# chmod 0755 alpine/bin/busybox
~# chroot alpine /bin/busybox sh

This will drop you to a root shell (UID 0) with changed root (/).

Irfan Latif
  • 20,353
  • 3
  • 70
  • 213