Apple - Unable to resolve hostnames inside macOS chroot jail
I was able to get it to work by making sure the
/etc/resolver.conf existed in the
chroot and then symlinking
/var/run/mDNSResponder into the
$ sudo chroot -u user "/Users/user/Source/macos-mkjail/test_jail" /bin/bash bash-4.4$ ping www.google.com PING www.google.com (188.8.131.52): 56 data bytes 64 bytes from 184.108.40.206: icmp_seq=0 ttl=53 time=10326.366 ms 64 bytes from 220.127.116.11: icmp_seq=1 ttl=53 time=44.899 ms 64 bytes from 18.104.22.168: icmp_seq=2 ttl=53 time=39.388 ms ^C--- www.google.com ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max/stddev = 39.388/3470.218/10326.366/4848.030 ms bash-4.4$exit $
Basically the problem is that newer macOS versions use mDNSResponder to resolve host names, and the standard library inside the chroot isn't able to contact the mDNSResponder. Without that communication, resolving names isn't possible. You'll want to install an responder inside the chroot jail in order to get it working.
You can find more information in this post: