From owner-freebsd-questions@freebsd.org Tue Jan 19 10:16:12 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31E39A8854D for ; Tue, 19 Jan 2016 10:16:12 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (agora.rdrop.com [IPv6:2607:f678:1010::34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02C9F1AA3 for ; Tue, 19 Jan 2016 10:16:11 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (66@localhost [127.0.0.1]) by agora.rdrop.com (8.13.1/8.12.7) with ESMTP id u0JABHUM005310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 19 Jan 2016 02:11:21 -0800 (PST) (envelope-from perryh@pluto.rain.com) Received: (from uucp@localhost) by agora.rdrop.com (8.13.1/8.14.2/Submit) with UUCP id u0JABFF5005307 for freebsd-questions@freebsd.org; Tue, 19 Jan 2016 02:11:15 -0800 (PST) (envelope-from perryh@pluto.rain.com) Received: from fbsd81 by pluto.rain.com (4.1/SMI-4.1-pluto-M2060407) id AA28233; Tue, 19 Jan 16 01:45:37 PST Date: Tue, 19 Jan 2016 01:45:26 -0800 From: perryh@pluto.rain.com (Perry Hutchison) To: freebsd-questions@freebsd.org Subject: resolver not working in a chroot Message-Id: <569e05b6.2RStkLc7SZIg/dVM%perryh@pluto.rain.com> User-Agent: nail 11.25 7/29/05 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2016 10:16:12 -0000 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