First of all, I have inside an android Operating System a chroot environment created using Linux Deploy. I am able to access it from Android using a terminal emulator and root permission. I would like to run a script inside it. However, when trying to run the script, or even normal shell commands, it doesn't executes and returns this error:

"No such file or directory"

So, I am wondering, is it there a way to execute, from the host within a chroot environment, commands/scripts? Has the problem to do with the proper setting of the environment PATH variable?

I am able to execute ls command within the chroot environment but when printing with the -la argument it doesn't even show the . and .. directories. Could someone explain why is this happening and how could we overcome this issue?

P.D.: I've posted this issue in unix/linux stack exchange because I thought it concerns more to it. However, if you recommend me to also post it in stackoverflow or any other, I am open to do so.

  • 1
    You must of course populate the chroot environment before chrooting into it. To run commands it must have /bin, /sbin etc. with the commands in them. – AlexP Nov 6 '17 at 11:54
  • Actually, I can find them on the chroot environment. However, when executing it shows the error described above. – Santiago Nicolas Martin Nov 6 '17 at 13:20
  • If you have a correctly populated the chroot environment (including libraries for example), have you tried invoking the commands using their full pathname? – AlexP Nov 6 '17 at 17:01
  • I am currently trying to populate the chroot environment. I tried invoking the commands using their full pathname or even changing the PATH environment variable to search on the chroot bin but still didn't work. – Santiago Nicolas Martin Nov 7 '17 at 12:09

It sounds like you may not have fully configured your chroot environment. Here are instructions for setting up a Debian chroot on Android:

There are lots of other OS-specific instructions online for setting up a chroot, e.g.:

The bottom line is that you typically would install the programs into your chroot environment before trying to execute them. What have you done to setup your chroot?

  • I have just installed a linux image using linux deploy app, which as I understand created a chroot environment. I was able to enter this chroot environment through the terminal emulator. I Don't know if I was totally clear with this, maybe I should rephrase the question. – Santiago Nicolas Martin Nov 6 '17 at 13:18
  • @SantiagoNicolasMartin Sure. Can you explain why you need (or want) to run scripts/programs from the host environment without installing them in the chrooted environment? – igal Nov 6 '17 at 14:05
  • Sure, It comes really from the need to install rockchip's gstreamer plugins on linux, as I am working on a video processing project. When running the installation script for this plugins from the chroot environment which is accessed via VNC, it doesn't find some files, which I suppose are on the host system which can't be accessed. Therefore, I am trying to see if running the script on the host environment could fix this issue and install the plugins on the chroot's linux. – Santiago Nicolas Martin Nov 6 '17 at 14:14
  • Why not install those files in the chroot environment? – igal Nov 6 '17 at 14:26
  • In fact, I do not know what are those files I am missing because I supposed they were already there on the package one can download from github. It seems I need extra stuff which seems to be no documentation about. – Santiago Nicolas Martin Nov 6 '17 at 15:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.