resolver not working in a chroot
Perry Hutchison
perryh at pluto.rain.com
Tue Jan 19 10:16:12 UTC 2016
The resolver is not working in a chroot (to the 10.2 memstick image,
with its /tmp, /var/run, and /var/tmp made writable by mounting tmpfs
on them):
# chroot -u 0 -g 0 -G 105,0,5,20,25 /mnt ping pkg.FreeBSD.org
ping: cannot resolve pkg.FreeBSD.org: Host name lookup failure
but it works when not in a chroot:
# ping pkg.FreeBSD.org
PING pkg.FreeBSD.org (96.47.72.71): 56 data bytes
64 bytes from 96.47.72.71: icmp_seq=0 ttl=51 time=97.329 ms
...
What would cause this?
So far I have checked:
ping works in the chroot if given the IP address (showing that
the chroot environment does have network access, so the resolver
"should" be able to reach a nameserver):
# chroot -u 0 -g 0 -G 105,0,5,20,25 /mnt ping 96.47.72.71
PING 96.47.72.71 (96.47.72.71): 56 data bytes
64 bytes from 96.47.72.71: icmp_seq=0 ttl=51 time=97.717 ms
...
host(1) works, and gives the same result, in both environments:
# host pkg.FreeBSD.org
pkg.FreeBSD.org has address 96.47.72.71
...
# chroot -u 0 -g 0 -G 105,0,5,20,25 /mnt host pkg.FreeBSD.org
pkg.FreeBSD.org has address 96.47.72.71
...
Ignoring comments, both /etc/nsswitch.conf are the same:
# egrep -v '^#' /etc/nsswitch.conf
group: compat
group_compat: nis
hosts: files dns
networks: files
passwd: compat
passwd_compat: nis
shells: files
services: compat
services_compat: nis
protocols: files
rpc: files
# chroot -u 0 -g 0 -G 105,0,5,20,25 /mnt egrep -v '^#' /etc/nsswitch.conf
group: compat
group_compat: nis
hosts: files dns
networks: files
passwd: compat
passwd_compat: nis
shells: files
services: compat
services_compat: nis
protocols: files
rpc: files
as are both /etc/resolv.conf:
# egrep -v '^#' /etc/resolv.conf
nameserver 192.168.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4
# chroot -u 0 -g 0 -G 105,0,5,20,25 /mnt egrep -v '^#' /etc/resolv.conf
nameserver 192.168.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4
and there is no mention of any freebsd.org host in either
environment's /etc/hosts:
# egrep 'freebsd\.org' /etc/hosts
# chroot -u 0 -g 0 -G 105,0,5,20,25 /mnt egrep 'freebsd\.org' /etc/hosts
More information about the freebsd-questions
mailing list