You are not logged in.

#1 2011-05-22 10:25:02

retznto
Member
Registered: 2010-11-21
Posts: 9

Certain programs can't resolve domain names and IP addresses.

I've been stuck with this problem for a while now, any help or suggestions would be very much appreciated! smile

I've been having problems with certain programs not being able to resolve IP addresses into domain names, and vice versa.

The programs that have been having problems that I've noticed, are the NoIP updater, DenyHosts, and possibly PHP.  None of them are able to resolve hostnames or IP addresses.

I have included the logs showing the problems for each program.  I have tested the exact IPs/domains that these programs are having problems with on the same computer, and I can retrieve the URL/hostname fine.  My resolve.conf is just 'nameserver 192.168.0.1'.

I'm at a loss as to why this could be happening.  Could avahi-daemon have anything to do with it? Stopping it doesn't seem to make a difference.

-- Logs below --

Denyhosts:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/DenyHosts/sync.py", line 117, in receive_new_hosts
    self.__prefs.get("SYNC_DOWNLOAD_RESILIENCY"))
  File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1570, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1292, in single_request
    self.send_content(h, request_body)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1439, in send_content
    connection.endheaders(request_body)
  File "/usr/lib/python2.7/httplib.py", line 937, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 797, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 759, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 740, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 553, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno -2] Name or service not known

NoIP:

.. Can't gethostbyname for dynupdate.no-ip.com
.. Can't get our visible IP address from ip1.dynupdate.no-ip.com

PHP (with file_get_contents on a valid URL):

php_network_getaddresses: getaddrinfo failed: Name or service not known

Offline

#2 2011-05-23 01:59:10

williamkray
Member
Registered: 2010-11-06
Posts: 64

Re: Certain programs can't resolve domain names and IP addresses.

not sure if this will help, but try adding a couple extra nameservers to your resolve.conf above what you've already got.  i've always had good luck with googles servers, at 8.8.8.8 and 8.8.4.4

when i have weird networking issues, i usually find that it's because i'm not using an alternate dns, and apparently my isp blocks things...

Offline

#3 2011-05-23 04:33:15

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: Certain programs can't resolve domain names and IP addresses.

Have you been doing anything funky with glibc? Most programs utilize libresolv for DNS stuff, which is part of glibc. If you've been doing weird stuff with versions, pacman updates or manually compiling stuff then things may have gotten out of sync.

Also, you haven't said what IS able to resolve hosts, so try this test also:
https://wiki.archlinux.org/index.php/Ne … NS_Servers

Offline

#4 2011-05-23 07:08:29

retznto
Member
Registered: 2010-11-21
Posts: 9

Re: Certain programs can't resolve domain names and IP addresses.

williamkray wrote:

not sure if this will help, but try adding a couple extra nameservers to your resolve.conf above what you've already got.  i've always had good luck with googles servers, at 8.8.8.8 and 8.8.4.4

Adding the extra nameservers to resolv.conf doesn't seem to do anything.  The same problems are showing sad

fukawi2 wrote:

Have you been doing anything funky with glibc? Most programs utilize libresolv for DNS stuff, which is part of glibc. If you've been doing weird stuff with versions, pacman updates or manually compiling stuff then things may have gotten out of sync.

I tend to build a lot of packages from the AUR using yaourt, I wouldn't have thought it'd break something.  I've reinstalled glibc, it doesn't seem to have worked though.

I'll give both these solutions a go for a day or so, before saying definitively if they worked or not, just in case they need time to work.

fukawi2 wrote:

Also, you haven't said what IS able to resolve hosts, so try this test also:
https://wiki.archlinux.org/index.php/Ne … NS_Servers

The test completes fine, says everything is ok.  Programs which are fine with DNS (pretty much everything not on the list) are Chromium, Firefox, Opera, Empathy, Pidgin, Skype, Steam (crossover), Rythmbox, VLC, Filezilla, Deluge, wget, and xchat.

The only difference I can see between these and the other programs is that they run as a different user. My best guess would be something to do with that.  It might not be, however, as if I run 'php -a' to load the PHP interpreter, and use the file_get_contents command (copied from the code), it works fine. This holds for whatever user I launch it as, whether it be normal user, root or http.  It seems the further I look in to this, the odder the problem gets.

Thanks for the help/suggestions smile

Offline

#5 2011-05-23 09:10:37

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: Certain programs can't resolve domain names and IP addresses.

strace denyhost hosts and pastebin the output

Offline

#6 2011-08-10 13:39:24

Bkmz
Member
Registered: 2011-07-30
Posts: 21

Re: Certain programs can't resolve domain names and IP addresses.

Hi all.
I have the same issue. My PHP script not working at all.

# Generated by dhcpcd from wlan0
# /etc/resolv.conf.head can replace this line
nameserver 192.168.1.37
nameserver 8.8.4.4
nameserver 8.8.8.8
nameserver 4.2.2.5
[bkmz@bkmz-hp-laptop ~]$ sudo su -m http 
bash: /root/.bashrc: Permission denied

[http@bkmz-hp-laptop bkmz]$ dig @8.8.4.4 google.com

; <<>> DiG 9.8.0-P4 <<>> @8.8.4.4 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26774
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             300     IN      A       74.125.232.80
google.com.             300     IN      A       74.125.232.84
google.com.             300     IN      A       74.125.232.81
google.com.             300     IN      A       74.125.232.82
google.com.             300     IN      A       74.125.232.83

;; Query time: 256 msec
;; SERVER: 8.8.4.4#53(8.8.4.4)
;; WHEN: Wed Aug 10 21:31:52 2011
;; MSG SIZE  rcvd: 108

So, Last time I had all somehow miraculously it worked. But i have this trable again. And i can't solve it.
I try to find call of getaddrinfo into strace output, but nothing. If i adding this site into /etc/hosts all working fine, but i don't know what domain i will need.

Any one can help me?

Last edited by Bkmz (2011-08-10 13:40:14)

Offline

#7 2011-08-10 23:05:08

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: Certain programs can't resolve domain names and IP addresses.

Can you `dig @192.168.1.37`?

What is the contents of /etc/nsswitch.conf?

Last edited by fukawi2 (2011-08-10 23:05:24)

Offline

#8 2011-08-16 17:57:54

Bkmz
Member
Registered: 2011-07-30
Posts: 21

Re: Certain programs can't resolve domain names and IP addresses.

fukawi2 wrote:

Can you `dig @192.168.1.37`?

What is the contents of /etc/nsswitch.conf?

I'm removed 192.168.1.37 and there is nothing happened sad

[bkmz@bkmz-hp-laptop ~]$ dig @192.168.1.37

; <<>> DiG 9.8.0-P4 <<>> @192.168.1.37
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63529
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       4652    IN      NS      d.root-servers.net.
.                       4652    IN      NS      i.root-servers.net.
.                       4652    IN      NS      m.root-servers.net.
.                       4652    IN      NS      c.root-servers.net.
.                       4652    IN      NS      b.root-servers.net.
.                       4652    IN      NS      f.root-servers.net.
.                       4652    IN      NS      l.root-servers.net.
.                       4652    IN      NS      h.root-servers.net.
.                       4652    IN      NS      k.root-servers.net.
.                       4652    IN      NS      g.root-servers.net.
.                       4652    IN      NS      a.root-servers.net.
.                       4652    IN      NS      j.root-servers.net.
.                       4652    IN      NS      e.root-servers.net.

;; Query time: 9 msec
;; SERVER: 192.168.1.37#53(192.168.1.37)
;; WHEN: Wed Aug 17 01:54:45 2011
;; MSG SIZE  rcvd: 228

[bkmz@bkmz-hp-laptop ~]$ dig @8.8.8.8

; <<>> DiG 9.8.0-P4 <<>> @8.8.8.8
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36074
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       82772   IN      NS      c.root-servers.net.
.                       82772   IN      NS      d.root-servers.net.
.                       82772   IN      NS      g.root-servers.net.
.                       82772   IN      NS      k.root-servers.net.
.                       82772   IN      NS      b.root-servers.net.
.                       82772   IN      NS      e.root-servers.net.
.                       82772   IN      NS      i.root-servers.net.
.                       82772   IN      NS      f.root-servers.net.
.                       82772   IN      NS      m.root-servers.net.
.                       82772   IN      NS      j.root-servers.net.
.                       82772   IN      NS      a.root-servers.net.
.                       82772   IN      NS      h.root-servers.net.
.                       82772   IN      NS      l.root-servers.net.

;; Query time: 135 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Wed Aug 17 01:54:51 2011
;; MSG SIZE  rcvd: 228
# Begin /etc/nsswitch.conf

passwd: files
group: files
shadow: files

publickey: files

hosts: files dns
networks: files

protocols: files
services: files
ethers: files
rpc: files

netgroup: files

# End /etc/nsswitch.conf

Offline

#9 2011-08-16 18:10:29

Bkmz
Member
Registered: 2011-07-30
Posts: 21

Re: Certain programs can't resolve domain names and IP addresses.

127.0.0.1       localhost.localdomain   localhost
::1             localhost.localdomain   localhost

127.0.0.250     bkmz-hp-laptop

Once again it solved the problem. But what happens after next reboot?

Offline

#10 2012-02-08 12:55:02

gesti
Member
Registered: 2012-02-08
Posts: 5

Re: Certain programs can't resolve domain names and IP addresses.

I had this problem after doing a pacman -Syu. On my development site it was giving me this

file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known

error. But when I tried the line in question in PHP's interactive shell (php -a) it was working. Also when I chaged on the site from domain name to IP address it was working.
The solution for me was that I have looked around and noticed that pacman created .pacnew files for some of my configs. So I just updated the config files according to the .pacnew files, rebooted and problem solved.
Strangely just like in Bkmz's comment for me the solution was in the /etc/hosts file:

127.0.0.1       localhost.localdomain   localhost
::1             localhost.localdomain   localhost
127.0.0.1       localhost.localdomain   gesti-PC
::1             localhost.localdomain   gesti-PC

Offline

#11 2012-02-08 22:26:27

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: Certain programs can't resolve domain names and IP addresses.

127.0.0.1       localhost.localdomain   localhost
::1             localhost.localdomain   localhost
127.0.0.1       localhost.localdomain   gesti-PC
::1             localhost.localdomain   gesti-PC

Don't create multiple lines for the same IP...

127.0.0.1       gesti-PC   localhost.localdomain   localhost
::1             gesti-PC   localhost.localdomain   localhost

Offline

Board footer

Powered by FluxBB