2

I'm trying to debug a Makefile which at face value calls a script trying to chroot into some directory. Then it also does env command.

BCMD= bash

CMD= "/build/toolcrib/prepare_final_tree >crumbs/Final-prep.out 2>&1"

${BCMD} -c "chroot /home/user/Smoothwall/bcutm/distrib /tools/bin/env -i ${CMD}"

I understand that it is chrooting into the specified directory. What is it doing with the env -i ${CMD}, as a single command with chroot.

After I run this command it does not find the /tools/bin/env command.

Jonatas Walker
  • 13,583
  • 5
  • 53
  • 82
Haswell
  • 1,573
  • 1
  • 18
  • 45

1 Answers1

2

It looks like /tools/bin/env is not installed correctly in your chroot. It may be missing or some of its dependencies may be missing.

Perhaps the chroot has a /usr/bin/env that you could use instead.

You might be able to find what other files are missing for env to work by running ldd from outside the chroot:

ldd /home/user/Smoothwall/bcutm/distrib/tools/bin/env

However it might be best to properly install coreutils into your chroot.

Etienne Laurin
  • 6,731
  • 2
  • 27
  • 31
  • /tools/bin/ contains env, I copied is from my (non chrooted) /usr/bin/env. – Haswell Dec 09 '15 at 08:22
  • What is the exact output of `chroot /home/user/Smoothwall/bcutm/distrib /tools/bin/env` and `ls -l /home/user/Smoothwall/bcutm/distrib/tools/bin/env`? – Etienne Laurin Dec 09 '15 at 08:52
  • 1. chroot: failed to run command ‘/tools/bin/env’: No such file or directory 2. `-rwxr-xr-x 1 root root 26308 Dec 8 17:27 /home/user/Smoothwall/bcutm/distrib/tools/bin/env` – Haswell Dec 09 '15 at 09:19
  • I believe the "No such file or directory" error is generated when looking for dynamically linked libraries. You can list those by doing `ldd /home/user/Smoothwall/bcutm/distrib/tools/bin/env`. – Etienne Laurin Dec 09 '15 at 16:44