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: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
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) (RETIRED)
Modified: 2023-05-21 20:38 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.
Comment 4 Hank Leininger 2023-05-21 19:25:37 UTC
This still happens with net-misc/dhcp-4.4.3_p1-r2

Removing libnss_dns.so from the LD_PRELOAD line avoids the error and seems to result in a working dhcp.

If the hack is needed at all, say for older supported glibcs, perhaps it could be semi-dynamic in the init script, checking which related libs are present and appending them to the list?
Comment 5 Larry the Git Cow gentoo-dev 2023-05-21 20:38:23 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9ffaa149a270cf3da67bceb9eb31541aa668810

commit c9ffaa149a270cf3da67bceb9eb31541aa668810
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-05-21 20:36:04 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-05-21 20:36:04 +0000

    net-misc/dhcp: drop broken LD_PRELOAD setting
    
    Closes: https://bugs.gentoo.org/836405
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 net-misc/dhcp/dhcp-4.4.3_p1-r2.ebuild                              | 3 +--
 net-misc/dhcp/{dhcp-4.4.3_p1-r1.ebuild => dhcp-4.4.3_p1-r3.ebuild} | 3 ++-
 net-misc/dhcp/files/dhcpd.init5                                    | 2 --
 3 files changed, 3 insertions(+), 5 deletions(-)