Factors copy_with_so() and ldd()
Makes create_chroot() use env -i if available