Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 41608 - gethostbyname failure in net-dns/noip-updater
Summary: gethostbyname failure in net-dns/noip-updater
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Daniel Black (RETIRED)
URL:
Whiteboard:
Keywords:
: 41597 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-14 17:42 UTC by José Romildo Malaquias
Modified: 2010-04-29 19:21 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Simple test program for the gethostbyname() function (gh.c,438 bytes, text/plain)
2004-02-14 17:44 UTC, José Romildo Malaquias
Details

Note You need to log in before you can comment on or make changes to this bug.
Description José Romildo Malaquias 2004-02-14 17:42:03 UTC
The noip2 program from the net-dns/noip-updater package is failing with the error message "Can't gethostbyname for dynupdate.no-ip.com", although name resolution is working in my system.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.




# emerge --info
Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.2, glibc-2.3.3_pre20040207-r0,
2.6.3-rc2-gentoo)
=================================================================
System uname: 2.6.3-rc2-gentoo i686 AMD Athlon(tm) XP 2000+
Gentoo Base System version 1.4.3.13
Autoconf: sys-devel/autoconf-2.59
Automake: sys-devel/automake-1.8.2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=athlon-xp -funroll-loops -fprefetch-loop-arrays -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.2/share/config /usr/kde/3/share/config /usr/share/config
/usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O2 -march=athlon-xp -funroll-loops -fprefetch-loop-arrays -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs buildpkg ccache sandbox"
GENTOO_MIRRORS="http://www.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="3dnow X aalib acl acpi alsa apm arts artswrappersuid avi berkdb bonobo cdr
crypt cups dvd encode esd fbcon foomaticdb gdbm gif gnome gpm gracenote gtk gtk2
gtkhtml guile imap imlib imlib2 java javascript jpeg kde libg++ libwww
linguas_de linguas_en linguas_fr linguas_pt lirc mad mbox mikmod mmx motif
mozilla mozsvg mpeg mysql ncurses nls oggvorbis opengl oss pam pdflib perl png
python qt quicktime readline rplay samba sdl slang spell sse ssl stroke svga
tcltk tcpd tetex tiff truetype usb wmf x86 xface xml xml2 xmms xv zlib"
Comment 1 José Romildo Malaquias 2004-02-14 17:44:58 UTC
Created attachment 25626 [details]
Simple test program for the gethostbyname() function

To test the gethostbyname() function, I have written this small C program.
Running it in my systems gives me:

$ ./gh
name	 = dynupdate.no-ip.com
addrtype = 2
length	 = 4
63.215.241.204.

So where is the problem with noip2 from net-dns/noip-updater ?
Comment 2 SpanKY gentoo-dev 2004-02-14 17:53:56 UTC
*** Bug 41597 has been marked as a duplicate of this bug. ***
Comment 3 Martin Holzer (RETIRED) gentoo-dev 2004-02-18 02:10:23 UTC
try install net-misc/host
Comment 4 José Romildo Malaquias 2004-02-18 09:16:50 UTC
net-misc/host-991529 is already installed:

# qpkg -i -I net-misc/host
net-misc/host-991529 *
        the standalone host tool, supports LOC reporting (RFC1876) [ http://www.dtek.chalmers.se/~d3august/xt/ ]

Name resolution is also working:

# hostx dynupdate.no-ip.com
dynupdate.no-ip.com     A       63.215.241.204

But noip2 insists in not work, with the error message in /var/log/messages:

Feb 18 14:21:37 gentoo noip2[4767]: Can't gethostbyname for dynupdate.no-ip.com
Comment 5 Martin Schlemmer (RETIRED) gentoo-dev 2004-02-19 10:02:51 UTC
Your test program is bugus.  Check the manpage (last sentence):

--
RETURN VALUE
       The gethostbyname() and gethostbyaddr() functions return the hostent
       structure or a NULL pointer if an error occurs.  On error, the h_errno
       variable holds an error number.  When non-NULL, the return value may
       point at static data, see the Notes below.
--

Meaning, you should _only_ test h_errno.
Comment 6 José Romildo Malaquias 2004-02-19 11:21:11 UTC
I do not see why the test program is incorrect. It tests the value returned by gethostbyname(). As mentioned in the man page:

"The gethostbyname() [...] functions return the hostent structure or a NULL pointer if an error occurs."

Therefore if an error occurs, the returned value is NULL. The test program has the lines

 if (! h)
   {
   	herror("ERROR FOUND: ");
	return 1;
   }

which just test that.

I do not agree with the idea that "[...] you should _only_ test h_errno." This is neither explicit nor implicit in the man page. It is just the oposite: h_errno is meaningfull only in error conditions, and an error condition is signeld by a NULL return value.

But independently of this test program, the fact is that noip2 is not working and it logs a message indicating that the problem is that gethostbyname() can not resolve dynupdate.no-ip.com, although DNS is working in this system, as shown by the command

$ hostx dynupdate.no-ip.com
dynupdate.no-ip.com     A       63.215.241.204
Comment 7 Jared H. Hudson (RETIRED) gentoo-dev 2004-02-24 16:35:06 UTC
I just installed noip-updater, created a noip account and ran it. It seems to work and it created a noip subdomain for me (jhhudso.no-ip.com)
Comment 8 José Romildo Malaquias 2004-03-26 11:37:24 UTC
noip-updater continus to not work for me.

For some reasons I had to reinstall my Gentoo Linux system and I was hoping that with the new install it would work correctly again. But it does not.

I really do not understand why it is not working for me. The message left in /var/log/messages is the same:

Mar 26 16:34:04 gentoo noip2[3043]: Can't gethostbyname for dynupdate.no-ip.com 

althoug other programs that resolve DNS names is working flawlesslly.

If I am not wrong, the gethostbyname() is implemented in glibc. Could it be something related to the glibc version I have installed (sys-libs/glibc-2.3.3_pre20040207)? Maybe downgrading glibc then would solve the problem.

Any more comments?
Comment 9 José Romildo Malaquias 2004-04-02 12:22:48 UTC
Same behaviour with sys-libs/glibc-2.3.2-r9.
Comment 10 José Romildo Malaquias 2004-04-02 12:26:06 UTC
I am having a problem with cvs that seems to be related to this problem with noip-updater. If called directly in the command line, cvs succeeds. But when called by emerge to install a package whose source is to be retrieved using cvs, it fails with a unknown host message.

See bug #46377.
Comment 11 David 2004-06-18 21:42:30 UTC
At the outset I will say that I am not sure exactly what I am doing and I may be doing a bad thing but I was getting the 'gethostbyname()' error.  This may help others find the problem.

I was looking through the code and found the following piece of code at line 528

   /* drop root privileges after reading config */
   if (geteuid() == 0) {
      if ((nobody = getpwnam("nobody")) != NULL) { // if "nobody" exists
         setgid(nobody->pw_gid);
         setegid(nobody->pw_gid);
         setuid(nobody->pw_uid);
         seteuid(nobody->pw_uid);
      }
   }
 
I commented it out completely then recompiled and ran it.  The error disappeared and it was updating successfuly.

This seems a little insecure for me but I do not have the skills to work out why this happens.
Comment 12 Jared H. Hudson (RETIRED) gentoo-dev 2004-06-23 14:50:12 UTC
What are your permissions on
/
/etc
/etc/resolv.conf
/etc/nsswitch.conf

This seems to be a bug in the way your systems resolver is setup. If you're anything but root noip-updater seems unable to looks up dns resolutions.

What do the two above files look like?
Comment 13 David 2004-07-05 04:12:55 UTC
Is this what you are after?

-rw-r--r--  1 root root 37 Jul  5 17:29 /etc/resolv.conf
-rw-r--r--  1 root root 497 Jul  5 19:15 /etc/nsswitch.conf
Comment 14 Jared H. Hudson (RETIRED) gentoo-dev 2004-07-14 01:57:22 UTC
What is the contents of your nsswitch.conf and resolv.conf file?
Comment 15 David 2004-07-15 16:39:12 UTC
/etc/resolv.conf
    domain home.loc
    nameserver 172.1.1.2

/etc/nsswitch.conf
    # /etc/nsswitch.conf:
    # $Header: /var/cvsroot/gentoo-src/rc-scripts/etc/nsswitch.conf,v 1.4 2002/11/18 19:39:22 azarah Exp $

    passwd:      compat
    shadow:      compat
    group:       compat

    # passwd:    db files nis
    # shadow:    db files nis
    # group:     db files nis

    hosts:       files dns
    networks:    files dns

    services:    db files
    protocols:   db files
    rpc:         db files
    ethers:      db files
    netmasks:    files
    netgroup:    files
    bootparams:  files

    automount:   files
    aliases:     files

Comment 16 Tom Ward 2004-10-19 04:03:58 UTC
Ok - I was getting this problem too using my new address of new.no-ip.com.
Fixed it by fettling my system's resolver config, including:

* changed /etc/dnsdomainname (and nisdomainname) from old.no-ip.com to no-ip.com
* changed domain line at top of /etc/resolv.conf from old.no-ip.com to no-ip.com 
* amended entry corresponding to value of /etc/hostname in /etc/hosts - "hostname -i" now returns the correct local address

Serve me right for being lazy when transferring networks...

Hope this helps someone...

Jesu
Comment 17 Gabriele Tibaldi 2004-11-07 05:29:28 UTC
I'm having this problem too ;)
I can't figure out how to make noip-updater working again...
Comment 18 José Romildo Malaquias 2004-11-07 09:27:59 UTC
I have added the line

63.215.241.204	dynupdate.no-ip.com

to /etc/hosts.
Comment 19 Daniel Black (RETIRED) gentoo-dev 2004-12-02 04:06:26 UTC
what if anything needs to be done for this to be closed? Please summarise for slow old me.
Comment 20 José Romildo Malaquias 2004-12-03 04:44:44 UTC
I do not know why the noip2 program is failing to resolve dynupdate.no-ip.com. But it is not working yet. So the bug should not be closed right now, without a solution, although I do not know the solution.

As a workaround, I have added the following line to /etc/hosts:

  63.215.241.204  dynupdate.no-ip.com

Some information from my system:

# ls -d -l / /etc /etc/resolv.conf /etc/nsswitch.conf
drwxr-xr-x  26 root root  4096 Nov 13 21:15 /
drwxr-xr-x  82 root root  8192 Dec  3 08:37 /etc
-rw-r--r--   1 root root   498 Nov  8 23:32 /etc/nsswitch.conf
-rw-r-----   1 root users   79 Dec  3 08:18 /etc/resolv.conf

# cat /etc/dnsdomainname
malaquias.no-ip.org

# cat /etc/hostname
gentoo

# cat /etc/resolv.conf
nameserver 200.225.197.34
nameserver 200.225.197.37
domain malaquias.no-ip.org

# cat /etc/nsswitch.conf # /etc/nsswitch.conf:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/nsswitch.conf,v 1.4 2002/11/18 19:39:22 azarah Exp $

passwd:      compat
shadow:      compat
group:       compat

# passwd:    db files nis
# shadow:    db files nis
# group:     db files nis

hosts:       files dns
networks:    files dns

services:    db files
protocols:   db files
rpc:         db files
ethers:      db files
netmasks:    files
netgroup:    files
bootparams:  files

automount:   files
aliases:     files
Comment 21 Daniel Black (RETIRED) gentoo-dev 2004-12-04 17:54:00 UTC
Does Tom's solution in comment 16 work?
Comment 22 José Romildo Malaquias 2004-12-05 02:15:53 UTC
The solution from commment #16 does not solve the problem for me:

# rc-update show | grep "name "
          domainname |      default
            hostname | boot

# grep '^[^#]' /etc/conf.d/domainname
OVERRIDE=1
DNSDOMAIN="no-ip.org"

# grep '^[^#]' /etc/conf.d/hostname
HOSTNAME="malaquias"

# cat /etc/resolv.conf
nameserver 200.225.197.34
nameserver 200.225.197.37
domain no-ip.org

# grep '^[^#]' /etc/hosts
127.0.0.1       malaquias.no-ip.org     malaquias       localhost.localdomain  localhost

# hostname -i
127.0.0.1

# hostx dynupdate.no-ip.com
dynupdate.no-ip.com     A       63.215.241.204

# /etc/init.d/noip restart
 * Stopping noip ...                                                      [ ok ] 
 * Setting noip addresses to 0.0.0.0 ...
 * Failed to set noip addresses to 0.0.0.0, error 255                     [ !! ]
 * Starting noip ...                                                      [ ok ]

# grep noip /var/log/messages | tail -n 5
Dec  5 08:05:36 malaquias noip2[11294]: v2.1.1 daemon ended.
Dec  5 08:05:36 malaquias rc-scripts: Failed to set noip addresses to 0.0.0.0, error 255
Dec  5 08:05:37 malaquias noip2[11369]: v2.1.1 daemon started
Dec  5 08:05:37 malaquias noip2[11369]: Can't gethostbyname for dynupdate.no-ip.com
Dec  5 08:06:37 malaquias noip2[11369]: Can't gethostbyname for dynupdate.no-ip.com

# epm -q baselayout
baselayout-1.11.7-r2

Note that some configuration files have changed from /etc to /etc/conf.d with the latest baselayout.
Comment 23 Daniel Black (RETIRED) gentoo-dev 2004-12-05 02:40:44 UTC
Check to see if you get the same answer using dig? dig probes the servers 1st ignoring /etc/hosts.

bash-2.05b$ dig @200.225.197.34 no-ip.com
bash-2.05b$ dig @200.225.197.37 no-ip.com
Comment 24 José Romildo Malaquias 2004-12-05 10:54:30 UTC
dig succeeds in resolving dynupdate.no-ip.com and no-ip.com with the DNS servers from /etc/resolv.conf. This name lookup seems to fail only when done by the /usr/sbin/noip2 program.

$ dig @200.225.197.34 dynupdate.no-ip.com

; <<>> DiG 9.2.2-P1 <<>> @200.225.197.34 dynupdate.no-ip.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6263
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 3

;; QUESTION SECTION:
;dynupdate.no-ip.com.           IN      A

;; ANSWER SECTION:
dynupdate.no-ip.com.    86220   IN      A       63.215.241.204

;; AUTHORITY SECTION:
no-ip.com.              85525   IN      NS      nf1.no-ip.com.
no-ip.com.              85525   IN      NS      nf2.no-ip.com.
no-ip.com.              85525   IN      NS      nf3.no-ip.com.

;; ADDITIONAL SECTION:
nf1.no-ip.com.          74481   IN      A       63.215.241.225
nf2.no-ip.com.          10237   IN      A       63.208.74.227
nf3.no-ip.com.          171919  IN      A       216.66.37.13

;; Query time: 31 msec
;; SERVER: 200.225.197.34#53(200.225.197.34)
;; WHEN: Sun Dec  5 16:53:11 2004
;; MSG SIZE  rcvd: 155

$ dig @200.225.197.37 dynupdate.no-ip.com

; <<>> DiG 9.2.2-P1 <<>> @200.225.197.37 dynupdate.no-ip.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6179
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 3

;; QUESTION SECTION:
;dynupdate.no-ip.com.           IN      A

;; ANSWER SECTION:
dynupdate.no-ip.com.    58480   IN      A       63.215.241.204

;; AUTHORITY SECTION:
no-ip.com.              58247   IN      NS      nf3.no-ip.com.
no-ip.com.              58247   IN      NS      nf1.no-ip.com.
no-ip.com.              58247   IN      NS      nf2.no-ip.com.

;; ADDITIONAL SECTION:
nf1.no-ip.com.          58209   IN      A       63.215.241.225
nf2.no-ip.com.          58209   IN      A       63.208.74.227
nf3.no-ip.com.          144608  IN      A       216.66.37.13

;; Query time: 25 msec
;; SERVER: 200.225.197.37#53(200.225.197.37)
;; WHEN: Sun Dec  5 16:53:17 2004
;; MSG SIZE  rcvd: 155
Comment 25 Stian Skjelstad 2005-01-01 20:15:08 UTC
I have a little theory after looking at strace and what happens when you issue gethostbyname

what are your permissions on /lib/libnss* /lib/libresolv*

these files are not linked until you actually need them, and if they have some wierd permissions, setuid and friends might block your access.

You could attach a strace if you are able and log what happens.
Comment 26 José Romildo Malaquias 2005-01-03 03:19:48 UTC
I have not used strace before.

Here is the permissions on the mentioned files:

# ls -l /lib/libnss* /lib/libresolv*
-rwxr-xr-x  1 root root 31088 Nov  5 17:46 /lib/libnss_compat-2.3.4.so
lrwxrwxrwx  1 root root    22 Nov  5 17:46 /lib/libnss_compat.so.2 -> libnss_compat-2.3.4.so
-rwxr-xr-x  1 root root 18428 Nov  5 17:46 /lib/libnss_dns-2.3.4.so
lrwxrwxrwx  1 root root    19 Nov  5 17:46 /lib/libnss_dns.so.2 -> libnss_dns-2.3.4.so
-rwxr-xr-x  1 root root 35544 Nov  5 17:46 /lib/libnss_files-2.3.4.so
lrwxrwxrwx  1 root root    21 Nov  5 17:46 /lib/libnss_files.so.2 -> libnss_files-2.3.4.so
-rwxr-xr-x  1 root root 18664 Nov  5 17:46 /lib/libnss_hesiod-2.3.4.so
lrwxrwxrwx  1 root root    22 Nov  5 17:46 /lib/libnss_hesiod.so.2 -> libnss_hesiod-2.3.4.so
-rwxr-xr-x  1 root root 35756 Nov  5 17:46 /lib/libnss_nis-2.3.4.so
lrwxrwxrwx  1 root root    19 Nov  5 17:46 /lib/libnss_nis.so.2 -> libnss_nis-2.3.4.so
-rwxr-xr-x  1 root root 43860 Nov  5 17:46 /lib/libnss_nisplus-2.3.4.so
lrwxrwxrwx  1 root root    23 Nov  5 17:46 /lib/libnss_nisplus.so.2 -> libnss_nisplus-2.3.4.so
-rwxr-xr-x  1 root root 64964 Nov  5 17:46 /lib/libresolv-2.3.4.so
lrwxrwxrwx  1 root root    18 Nov  5 17:46 /lib/libresolv.so.2 -> libresolv-2.3.4.so
Comment 27 José Romildo Malaquias 2005-01-15 04:48:08 UTC
When configuring squid-2.5.7 I am having similar problems:

# squid -NCd1
2005/01/15 10:34:33| Starting Squid Cache version 2.5.STABLE7 for i686-pc-linux-gnu...
2005/01/15 10:34:33| Process ID 21427
2005/01/15 10:34:33| With 1024 file descriptors available
2005/01/15 10:34:33| Performing DNS Tests...
FATAL: ipcache_init: DNS name lookup tests failed.
Aborted

# grep dns_testnames /etc/squid/squid.conf.default
#  TAG: dns_testnames
# dns_testnames netscape.com internic.net nlanr.net microsoft.com

From the Squid FAQ (http://www.squid-cache.org/Doc/FAQ/FAQ-11.html#ss11.21):

-----------------------------------------------------------------
FATAL: ipcache_init: DNS name lookup tests failed

Squid normally tests your system's DNS configuration before it starts server requests. Squid tries to resolve some common DNS names, as defined in the dns_testnames configuration directive. If Squid cannot resolve these names, it could mean:

   1. your DNS nameserver is unreachable or not running.
   2. your /etc/resolv.conf file may contain incorrect information.
   3. your /etc/resolv.conf file may have incorrect permissions, and may be unreadable by Squid.
-----------------------------------------------------------------

The host names tested by squid (netscape.com internic.net nlanr.net microsoft.com) are all resolved by dig, nslookup and host.

So definitely there is something wrong in name resolution in my box, but only with certain applications like noip2, squid and cvs. But I can not find what it is.

I am needing help to solve this bug.
Comment 28 Daniel Black (RETIRED) gentoo-dev 2005-02-15 03:12:22 UTC
emerge strace, read the man page, and attach output.
Comment 29 José Romildo Malaquias 2005-02-15 07:06:30 UTC
I have upgraded my hardware from an athlon-xp to an athlon-64, reinstalled Gentoo Linux (for the amd64 archtecture this time) and the bug is not present anymore in the new system.
Comment 30 Daniel Black (RETIRED) gentoo-dev 2005-02-15 12:37:41 UTC
gald its working for you now.
Comment 31 Ken Page 2008-11-17 13:50:17 UTC
(In reply to comment #0)
> The noip2 program from the net-dns/noip-updater package is failing with the
> error message "Can't gethostbyname for dynupdate.no-ip.com", although name
> resolution is working in my system.

I too am having problems with noip-updater. 

Mine is setting the IP to 0.0.0.0

It started doing this out of the blue after workign fine for ages. 

I have tried re-install, re-config, restart. Nothing works. 

Any idea's?

Ken - vk4akp@yahoo.com.au
.-.-.
Comment 32 Dieter Saeys 2010-04-29 19:21:17 UTC
Suddenly ran into this problem too.

Solution for me came out comment #3 : emerge net-misc/host