FS#41769 - [busybox] DNS lookups don't work

Attached to Project: Community Packages
Opened by Steven Honeyman (stevenhoneyman) - Sunday, 31 August 2014, 15:22 GMT
Last edited by Sergej Pupykin (sergej) - Wednesday, 10 September 2014, 09:15 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sergej Pupykin (sergej)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Any of the busybox "applets" that use DNS lookups fail (nslookup, wget, ntpd, ping, etc)

Additional info:
I suspect it has something to do with glibc, static compilation, and nss (because --enable-static-nss is an optional extra)
I rebuilt your PKGBUILD, it failed to link without unsetting LDFLAGS, but still failed to query DNS once it did compile.

Steps to reproduce:
$ busybox nslookup archlinux.org
Server: 127.0.0.1
Address 1: 127.0.0.1

nslookup: can't resolve 'archlinux.org'

$ nslookup archlinux.org
Server: 127.0.0.1
Address: 127.0.0.1#53

Non-authoritative answer:
Name: archlinux.org
Address: 66.211.214.131

$ ldd /usr/bin/busybox
not a dynamic executable


--

(and here's the error I got with my usual LDFLAGS set)
...
...
LINK busybox_unstripped
Trying libraries: crypt m
Failed: -Wl,--start-group -lcrypt -lm -Wl,--end-group
This task depends upon

Closed by  Sergej Pupykin (sergej)
Wednesday, 10 September 2014, 09:15 GMT
Reason for closing:  Fixed
Comment by Sergej Pupykin (sergej) - Monday, 01 September 2014, 09:38 GMT
Probably you should

systemctl start nscd
Comment by Steven Honeyman (stevenhoneyman) - Monday, 01 September 2014, 09:41 GMT
If it has an external dependency on nscd (can't test right now - not at home), then why compile it as static?
Comment by Sergej Pupykin (sergej) - Monday, 01 September 2014, 09:56 GMT
As I understand glibc does not support static libnss* linking. May be busybox should be built with uclibc instead.
Comment by Steven Honeyman (stevenhoneyman) - Monday, 01 September 2014, 10:03 GMT
It's still technically possible, but yes 'not supported' is correct.
uclibc is pretty old/dead, dietlibc is buggy&dying, musl would be the one to go for.

Doubt it'd run with klibc, and I have no experience with newlib or bionic (if bionic even supports x86/64)
Comment by Steven Honeyman (stevenhoneyman) - Monday, 01 September 2014, 18:03 GMT
Confirmed that[comment 1] does allow it to work... but it's not really a fix for the package. If it depends on all that, and requires a service running, busybox is not very useful.
To fix it I think the choices look like:

- Dynamically link it (avoids having to start/use nscd, would take literally seconds to implement)
- Compile statically with a different libc (then it is useful for initramfs, but requires a package not currently in the repos)
- Follow the 'unsupported' static nss guide for glibc (not worth the effort)

...depending on what you intend this package to be used for, of course; dynamic glibc seems the most 'Arch linux' suitable fix.
Comment by Sergej Pupykin (sergej) - Wednesday, 10 September 2014, 09:14 GMT
building busybox with another libc looks quite painful, so I've built dynamically.

Loading...