getting busybox DNS (ping, nslookup) to work on android

Tito farmatito at tiscali.it
Thu Apr 14 18:51:30 UTC 2011



On Thursday 14 April 2011 17:31:43 rouble wrote:
> I do have a /etc/resolv.conf. It points to the localhost that routes the DNS
> queries appropriately. I have also tried using another valid name server -
> which yields the same result.
> 
> Here are the logs:
> 
> # cat /etc/resolv.conf
> nameserver 127.0.0.1:53
> 
> 
> # strace -tt -s99 -oLOG nslookup www.google.com
> Server:    0.0.0.0
> Address 1: 0.0.0.0
> 
> nslookup: can't resolve 'www.google.com'
> 
> 
> # cat LOG
> 15:10:32.686311 execve("/system/xbin/nslookup", ["nslookup", "www.google.com"],
> [/* 14 vars */]) = 0
> 15:10:32.694534 uname({sys="Linux", node="localhost", ...}) = 0
> 15:10:32.695684 brk(0)                  = 0x8718000
> 15:10:32.695915 brk(0x8718cd0)          = 0x8718cd0
> 15:10:32.696221 set_thread_area({entry_number:-1 -> 6, base_addr:0x8718850,
> limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1,
> seg_not_present:0, useable:1}) = 0
> 15:10:32.696676 brk(0x8739cd0)          = 0x8739cd0
> 15:10:32.696903 brk(0x873a000)          = 0x873a000
> 15:10:32.697341 getuid32()              = 0
> 15:10:32.697582 getpid()                = 30438
> 15:10:32.697868 open("/etc/resolv.conf", O_RDONLY) = 3
> 15:10:32.698275 fstat64(3, {st_mode=S_IFREG|0666, st_size=24, ...}) = 0
> 15:10:32.698773 mmap2(NULL, 4096, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77ea000
> 15:10:32.699038 read(3, "nameserver 127.0.0.1:53\n", 1024) = 24
> 15:10:32.699421 read(3, "", 1024)       = 0
> 15:10:32.699654 close(3)                = 0
> 15:10:32.699882 munmap(0xb77ea000, 4096) = 0
> 15:10:32.700188 uname({sys="Linux", node="localhost", ...}) = 0
> 15:10:32.701512 fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0),
> ...}) = 0
> 15:10:32.701985 mmap2(NULL, 4096, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77ea000
> 15:10:32.702267 write(1, "Server:    0.0.0.0\n", 19) = 19
> 15:10:32.702659 socket(PF_UNIX, SOCK_STREAM, 0) = 3
> 15:10:32.703056 fcntl64(3, F_GETFL)     = 0x2 (flags O_RDWR)
> 15:10:32.703316 fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
> 15:10:32.703573 connect(3, {sa_family=AF_UNIX, path="/var/run/nscd/socket"},
> 110) = -1 ENOENT (No such file or directory)
> 15:10:32.704146 close(3)                = 0
> 15:10:32.704571 socket(PF_UNIX, SOCK_STREAM, 0) = 3
> 15:10:32.704817 fcntl64(3, F_GETFL)     = 0x2 (flags O_RDWR)
> 15:10:32.705150 fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
> 15:10:32.705470 connect(3, {sa_family=AF_UNIX, path="/var/run/nscd/socket"},
> 110) = -1 ENOENT (No such file or directory)
> 15:10:32.706137 close(3)                = 0
> 15:10:32.706406 open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such
> file or directory)
> 15:10:32.706831 open("/system/lib/libnss_dns.so.2", O_RDONLY) = -1 ENOENT
> (No such file or directory)
> 15:10:32.707143 stat64("/system/lib", {st_mode=S_IFDIR|0755, st_size=10240,
> ...}) = 0
> 15:10:32.707639 open("/system/lib/egl/libnss_dns.so.2", O_RDONLY) = -1
> ENOENT (No such file or directory)
> 15:10:32.707955 stat64("/system/lib/egl", {st_mode=S_IFDIR|0755,
> st_size=1024, ...}) = 0
> 15:10:32.708496 open("/system/lib/anyconnect-lib/libnss_dns.so.2", O_RDONLY)
> = -1 ENOENT (No such file or directory)
> 15:10:32.708868 stat64("/system/lib/anyconnect-lib", {st_mode=S_IFDIR|0755,
> st_size=1024, ...}) = 0
> 15:10:32.709611 open("/etc/ld.so.cache", O_RDONLY) = -1 ENOENT (No such file
> or directory)
> 15:10:32.709940 open("/lib/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such
> file or directory)
> 15:10:32.710238 stat64("/lib", 0xbfc5a5a8) = -1 ENOENT (No such file or
> directory)
> 15:10:32.710497 open("/usr/lib/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No
> such file or directory)
> 15:10:32.710801 stat64("/usr/lib", 0xbfc5a5a8) = -1 ENOENT (No such file or
> directory)
> 15:10:32.711093 open("/system/lib/libnss_files.so.2", O_RDONLY) = -1 ENOENT
> (No such file or directory)
> 15:10:32.711413 open("/system/lib/egl/libnss_files.so.2", O_RDONLY) = -1
> ENOENT (No such file or directory)
> 15:10:32.711741 open("/system/lib/anyconnect-lib/libnss_files.so.2",
> O_RDONLY) = -1 ENOENT (No such file or directory)
> 15:10:32.712153 write(1, "Address 1: 0.0.0.0\n", 19) = 19
> 15:10:32.712469 write(1, "\n", 1)       = 1
> 15:10:32.712762 write(2, "nslookup: can\'t resolve \'www.google.com\'\n",
> 41) = 41
> 15:10:32.713347 exit_group(1)           = ?
> 
> 
> On Thu, Apr 14, 2011 at 1:57 AM, Tito <farmatito at tiscali.it> wrote:
> >
> >
> > On Wednesday 13 April 2011 21:59:32 rouble wrote:
> >> BB Gurus,
> >>
> >> I have compiled busybox as a static binary for an android system.
> >>
> >> Most things work great, but I can not get any of the DNS related
> >> applets (nslookup, ping, traceroute etc) to work for domain names.
> >> They work fine for IP addresses. I think what is happening is that
> >> busybox is looking for some specific libc libraries that are missing -
> >> since android uses bionic instead of libc.
> >>
> >> Does anyone know of a way to get this to work?
> >>
> >> Here is what happens on the command line:
> >> # strace -tt -s99 -oLOG nslookup www.google.com
> >> Server:    0.0.0.0
> >> Address 1: 0.0.0.0
> >>
> >> nslookup: can't resolve 'www.google.com'
> >>
> >> I can provide detailed logs if required.
> >>
> >> tia,
> >> rouble
> > Hi,
> > You have to add a resolv.conf file in /system/etc like:
> >
> >
> ---------------------------------------------------------------------------------------------
> > nameserver 8.8.8.8
> > nameserver 8.8.4.4
> >
> >
> >
> ---------------------------------------------------------------------------------------------
> >
> > Ciao,
> > Tito
> >
> 

Seems to me you miss lib_dns* and nsswitch.conf.
Try a statically compiled busybox or add the missing libraries
to your system.

Ciao,
Tito


More information about the busybox mailing list