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
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.
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.
Not really a toolchain problem.
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?
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(-)