Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 836405 - net-misc/dhcp with sys-libs/glibc-2.34: ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Summary: net-misc/dhcp with sys-libs/glibc-2.34: ERROR: ld.so: object 'libnss_dns.so' ...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-30 08:03 UTC by Lars Wendler (Polynomial-C)
Modified: 2022-06-09 03:16 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2022-03-30 08:03:21 UTC
This happens when running dhcpd in a chroot:

# grep '^DHCPD_CHROOT' /etc/conf.d/dhcpd
DHCPD_CHROOT="/var/chroot/dhcpd"

On each start the following output can be seen:

# /etc/init.d/dhcpd start
ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
 * Starting chrooted dhcpd ...
ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.                                                                                                                    [ ok ]
ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libnss_dns.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.


This happens because the openrc init script contains the following line:

# grep -F LD_PRELOAD /etc/init.d/dhcpd
        # Setup LD_PRELOAD so name resolution works in our chroot.
                export LD_PRELOAD="${LD_PRELOAD} libresolv.so libnss_dns.so"

But unlike prior glibc versions, glibc-2.34 does not install libnss_dns.so file anymore, only libnss_dns.so.2:

# qlist -Ce glibc | grep -F libnss_dns.so
/lib/libnss_dns.so.2
/lib64/libnss_dns.so.2
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-30 17:23:30 UTC
Upstream don't split out libraries unnecessarily anymore (which is a long-standing, ongoing effort).

The old exact libraries w/ SONAME still exist to allow old programs to work, but the symlink is gone upstream to stop new programs detecting & linking against them.

The LD_PRELOAD line in dhcpcd is wrong. On glibc only, it should only add to LD_PRELOAD if the files it wants exist. If they don't exist on glibc, it can assume the NSS stuff is built in. Obviously on non-glibc, no NSS is there.
Comment 2 Mike Gilbert gentoo-dev 2022-03-30 17:40:29 UTC
Adding arbitrary NSS modules to LD_PRELOAD seems pretty hacky to me. The set of modules necessary for name resolution really depends on what has been configured in nsswitch.conf, which is controllable by the user.

I would suggest changing this into a user-controlled variable in the conf.d file instead of hard-coding the list of libraries in the init script.
Comment 3 Andreas K. Hüttel archtester gentoo-dev 2022-04-25 22:32:27 UTC
Not really a toolchain problem.