On Fri, Dec 13, 2024 at 06:47:47PM +1000, Paul W. Rankin wrote: > Hello, > > I'm trying to run a simple chroot test and, perplexingly, it's not > working: > > # ls -l /var/chroot/test/bin/sh > -r-xr-xr-x 1 root wheel 255840 Dec 13 18:37 /var/chroot/test/bin/sh > # cd /var/chroot/test/ > # ./bin/sh -c 'exit 7'; echo $? > 7 > # chroot /var/chroot/test /bin/sh -c 'exit 7' > chroot: /bin/sh: No such file or directory > > What am I doing wrong here?
Probably missing /var/chroot/test/libexec/ld.elf_so and a few shared libraries. ldd /var/chroot/test/bin/sh and check if everything it lists is in your chroot as well. Or use a statically linked sh. Martin