From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.62) (envelope-from ) id 1Hs9oy-0005Q3-Bj for garchives@archives.gentoo.org; Sun, 27 May 2007 03:53:32 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.0/8.14.0) with SMTP id l4R3qKKc030382; Sun, 27 May 2007 03:52:20 GMT Received: from omta04sl.mx.bigpond.com (omta04sl.mx.bigpond.com [144.140.93.156]) by robin.gentoo.org (8.14.0/8.14.0) with ESMTP id l4R3mAEv025732 for ; Sun, 27 May 2007 03:48:12 GMT Received: from oaamta08sl.mx.bigpond.com ([58.174.105.83]) by omta04sl.mx.bigpond.com with ESMTP id <20070527034808.WCFH28583.omta04sl.mx.bigpond.com@oaamta08sl.mx.bigpond.com> for ; Sun, 27 May 2007 03:48:08 +0000 Received: from [192.168.0.3] (really [58.174.105.83]) by oaamta08sl.mx.bigpond.com with ESMTP id <20070527034808.VTQN16336.oaamta08sl.mx.bigpond.com@[192.168.0.3]> for ; Sun, 27 May 2007 03:48:08 +0000 Subject: [gentoo-user] No /etc/resolv.conf with dhcpcd From: Richard Watson To: gentoo-user@lists.gentoo.org Content-Type: text/plain Date: Sun, 27 May 2007 13:44:44 +1000 Message-Id: <1180237484.10262.9.camel@localhost> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.8.2.1 Content-Transfer-Encoding: 7bit X-Archives-Salt: c04b02d1-a3c1-45fc-89de-1b5595a041a7 X-Archives-Hash: d0edbad003958058d0698eecefce1896 Hi - For a while now when I run # dhcpcd eth1 I get an IP address OK but no DNS. I've established that a /etc/resolv.conf file is not being created when the command is being run. There's a script invoked at some stage called /etc/resolvconf/update.d/libc. This is creating a file with all the DNS information called /var/run/resolvconf/interfaces/eth1 (or eth2 depending on the interface raised). However it's not then creating /etc/resolv.conf. I can get around this by running my own script to copy the DNS information to /etc/resolv.conf but it would be good to figure out why it's not working. I attach output of my /etc/resolvconf/update.d/libc below if anyone can help. I've tried reemerging the package (unsuccessfully). Thanks, Richard === Begin === #!/bin/bash # Copyright 2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # libc resolv.conf updater # Written by Roy Marples (uberlord@gentoo.org) # Heavily based on Debian resolvconf by Thomas Hood # Load generic Gentoo functions source /etc/init.d/functions.sh [[ $(readlink /etc/resolv.conf 2>/dev/null) \ != "resolvconf/run/resolv.conf" ]] && exit 0 RESOLVCONF="$(resolvconf -l)" BASE="/etc/resolvconf/resolv.conf.d/base" OUR_NS= if [[ -e ${BASE} ]] ; then OUR_NS="$(sed -n -e 's/^[[:space:]]*nameserver[[:space:]]*//p' "${BASE}")" fi OUR_NS="$(uniqify \ ${OUR_NS} \ $(echo "${RESOLVCONF}" \ | sed -n -e 's/^[[:space:]]*nameserver[[:space:]]*//p') \ )" # libc only allows for 3 nameservers # truncate after 127 as well i=0 NS= for N in ${OUR_NS} ; do ((i++)) NS="${NS} ${N}" [[ ${i} == "3" || ${N} == "127."* ]] && break done # This is nasty! # If we have a local nameserver then assume they are intelligent enough # to be forwarding domain requests to the correct nameserver and not search # ones. This means we prefer search then domain, otherwise, we use them in # the order given to us. OUR_SEARCH= if [[ ${N} == "127."* ]] ; then if [[ -e ${BASE} ]] ; then OUR_SEARCH="$(sed -n -e 's/^[[:space:]]*search[[:space:]]*//p' "${BASE}")" fi OUR_SEARCH="${OUR_SEARCH} $(echo "${RESOLVCONF}" \ | sed -n 's/^[[:space:]]*search[[:space:]]*//p')" if [[ -e ${BASE} ]] ; then OUR_SEARCH="${OUR_SEARCH} $(sed -n -e 's/^[[:space:]]*domain[[:space:]]*//p' "${BASE}")" fi OUR_SEARCH="${OUR_SEARCH} $( echo "${RESOLVCONF}" \ | sed -n -e 's/^[[:space:]]*domain[[:space:]]*//p')" else if [[ -e ${BASE} ]] ; then OUR_SEARCH="$(sed -n -e 's/^[[:space:]]*search[[:space:]]*//p' \ -e 's/^[[:space:]]*domain[[:space:]]*//p' "${BASE}")" fi OUR_SEARCH="${OUR_SEARCH} $(echo "${RESOLVCONF}" \ | sed -n -e 's/^[[:space:]]*search[[:space:]]*//p' \ -e 's/^[[:space:]]*domain[[:space:]]*//p')" fi # libc only allows for 6 search domains i=0 SEARCH= for S in $(uniqify ${OUR_SEARCH}) ; do ((i++)) SEARCH="${SEARCH} ${S}" [[ ${i} == "6" ]] && break done [[ -n ${SEARCH} ]] && SEARCH="search${SEARCH}" # Hold our new resolv.conf in a variable to save on temporary files NEWCONF="# Generated by resolvconf\n" [[ -e /etc/resolvconf/resolv.conf.d/head ]] \ && NEWCONF="${NEWCONF}$(< /etc/resolvconf/resolv.conf.d/head)\n" [[ -n ${SEARCH} ]] && NEWCONF="${NEWCONF}${SEARCH}\n" for N in ${NS} ; do NEWCONF="${NEWCONF}nameserver ${N}\n" done # Now dump everything else from our resolvs if [[ -e ${BASE} ]] ; then NEWCONF="${NEWCONF}$(sed -e '/^[[:space:]]*$/d' \ -e '/^[[:space:]]*nameserver[[:space:]]*.*/d' \ -e '/^[[:space:]]*search[[:space:]]*.*/d' \ -e '/^[[:space:]]*domain[[:space:]]*.*/d' \ "${BASE}")" fi # We don't know we're using GNU sed, so we do it like this NEWCONF="${NEWCONF}$(echo "${RESOLVCONF}" | sed -e '/^[[:space:]]*$/d' \ -e '/^[[:space:]]*#/d' \ -e '/^[[:space:]]*nameserver[[:space:]]*.*/d' \ -e '/^[[:space:]]*search[[:space:]]*.*/d' \ -e '/^[[:space:]]*domain[[:space:]]*.*/d' \ )" [[ -e /etc/resolvconf/resolv.conf.d/tail ]] \ && NEWCONF="${NEWCONF}$(< /etc/resolvconf/resolv.conf.d/tail)" # Check if the file has actually changed or not if [[ -e /etc/resolv.conf ]] ; then [[ $(< /etc/resolv.conf) == "$(echo -e "${NEWCONF}")" ]] && exit 0 fi # Create our resolv.conf now echo -e "${NEWCONF}" > /etc/resolvconf/run/resolv.conf # Restart nscd if it's running if [[ -x /etc/init.d/nscd ]] ; then if /etc/init.d/nscd --quiet status ; then /etc/init.d/nscd --nodeps --quiet restart fi fi # Notify users of the resolver for x in /etc/resolvconf/update-libc.d/* ; do [[ -e ${x} ]] && "${x}" "$@" done # vim: ts=4 : -- gentoo-user@gentoo.org mailing list