• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

/bin/sh: *: not found after chrooting

wert joe

Lurker
i need to do a task on my system but after succesfull mounting and bind and chroot, get the error written in the following:
Code:
mkdir /data/local/sda19
mount /dev/block/sda19 /data/local/sda19
mount --bind /dev /data/local/sda19/dev
mount --bind /dev/pts /data/local/sda19/dev/pts
mount --bind /proc /data/local/sda19/proc
mount --bind /sys /data/local/sda19/sys
chroot /data/local/sda19
#ls 
/bin/sh: ls: not found
please help me out as i need to perform that task urgently
 
Not knowing a) what OS you're using to boot off of or b) what OS you're trying to access this might not help you directly but just as an example when I need to chroot into my desktop after doing something stupid I'll do the following (running off a Slackware install disc to access a Slackware system):


mount /dev/sda1 /mnt

mount -o bind /dev /mnt/dev
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys

chroot /mnt /bin/bash

In your case, try going through the same process except try using chroot /mnt /bin/bash instead of /data/local/sda19
Since you couldn't use ls it would appear you just need to be accessing /bin (on your mounted target) to get access to the typical system binaries. Just an assumption but you don't need to chroot into /data/local/sda19 as you can just use cd once you have access to /bin.
 
Not knowing a) what OS you're using to boot off of or b) what OS you're trying to access this might not help you directly but just as an example when I need to chroot into my desktop after doing something stupid I'll do the following (running off a Slackware install disc to access a Slackware system):


mount /dev/sda1 /mnt

mount -o bind /dev /mnt/dev
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys

chroot /mnt /bin/bash

In your case, try going through the same process except try using chroot /mnt /bin/bash instead of /data/local/sda19
Since you couldn't use ls it would appear you just need to be accessing /bin (on your mounted target) to get access to the typical system binaries. Just an assumption but you don't need to chroot into /data/local/sda19 as you can just use cd once you have access to /bin.
i'm using naugat to chroot to xubuntu. it works in live cd but i want to use android terminal app since i plan to automate a script. thank's for your suggestions,they might work
 
If you're referring to using something like the 'Terminal Emulator for Android' app (along with having BusyBox installed), you might find it easier to use the Termux app instead.
https://play.google.com/store/apps/details?id=com.termux&hl=en_US
Termux has the same basic tools but it's a more expansive terminal app that allows you to install a lot more things -- i.e. use the apt install ssh command and you can ssh into your Xubuntu install instead.
https://www.makeuseof.com/tag/use-linux-command-line-android-termux/
https://www.hackeroyale.com/termux-hacks-guide/
 
Back
Top Bottom