Help: DNS Resolver and Root Shell

Tito farmatito at tiscali.it
Sun Oct 20 20:04:46 UTC 2013


On Sunday 20 October 2013 18:31:26 Hui Li wrote:
> Hi,
> 
> I'm new to busybox and encountered 2 issues currently during building up
> small rootfs.
> 
> 1). DNS resolver is not valid. I googled some and it seems I need to
> copy libnss_files/libnss_dns/libresolv libs to proper directory(/lib),
> however it's still failed. The busybox is compiled in shared libraries
> way. Here's arm ldd output:
> 
> $ arm-rpi-linux-gnueabi-ldd
> --root /opt/arm/arm-rpi-linux-gnueabi/arm-rpi-linux-gnueabi/sysroot
> busybox 
>         libm.so.6 => /lib/libm.so.6 (0xdeadbeef)
>         ld-linux-armhf.so.3 => /lib/ld-linux-armhf.so.3 (0xdeadbeef)
>         libc.so.6 => /lib/libc.so.6 (0xdeadbeef)

Hi,
I think you should copy the relative libs for your architecture to your /lib dir
libresolv.so.*
libnss*.so
and set up a /etc/nsswitch.conf file.
However if there are no libnss*.so files on your rootfs
you can eventually opt to use busybox's own  internal password and
group functions rather than system functions   
by enabling the relevant options in
Login/Password Management Utilities.
Also take a look at http://busybox.net/downloads/BusyBox.html:

LIBC NSS

GNU Libc (glibc) uses the Name Service Switch (NSS) to configure the behavior of the C library for the
local environment, and to configure how it reads system data, such as passwords and group information.
This is implemented using an /etc/nsswitch.conf configuration file, and using one or more of the /lib/libnss_* libraries.
BusyBox tries to avoid using any libc calls that make use of NSS. Some applets however, such as login and su,
will use libc functions that require NSS.
If you enable CONFIG_USE_BB_PWD_GRP, BusyBox will use internal functions to directly access the /etc/passwd,
/etc/group, and /etc/shadow files without using NSS. This may allow you to run your system without the need
for installing any of the NSS configuration files and libraries.
When used with glibc, the BusyBox 'networking' applets will similarly require that you install at least some of the
glibc NSS stuff (in particular, /etc/nsswitch.conf, /lib/libnss_dns*, /lib/libnss_files*, and /lib/libresolv*).
Shameless Plug: As an alternative, one could use a C library such as uClibc. In addition to making your system
significantly smaller, uClibc does not require the use of any NSS support files or libraries.


Hope this helps.

Ciao,
Tito
> And I also took reference to this thread
> http://lists.busybox.net/pipermail/busybox/2001-November/005103.html to
> add those LDFLAGS in menuconfig but looks like busybox does not use it
> when I try to do make:
> 
> Trying libraries: crypt m nss_dns nss_files resolv
>  Library crypt is not needed, excluding it
>  Library m is needed, can't exclude it (yet)
>  Library nss_dns is not needed, excluding it
>  Library nss_files is not needed, excluding it
>  Library resolv is not needed, excluding it
>  Library m is needed, can't exclude it (yet)
> Final link with: m
> 
> 2). Root shell does start from /root. After I created the rootfs and
> booting to login prompt the root user is under '/' not '/root'. I am
> sure root user's home dir is /root in /etc/passwd and I have defined
> HOME shell variable is '/root' in /etc/profile. I also found a bug
> thread which opened to OpenWRT project related to this issue.
> Unfortunately, this issue was marked as 'wontfix'. Bug URL:
> https://dev.openwrt.org/ticket/2657
> 
> Can anyone show me some tips there?
> 
> Thanks.
> 
> Hui


More information about the busybox mailing list