Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dracut searches nfsidmap plugins for dependencies bogusly #1087

Closed
classabbyamp opened this issue Jan 4, 2025 · 5 comments · Fixed by #1088
Closed

dracut searches nfsidmap plugins for dependencies bogusly #1087

classabbyamp opened this issue Jan 4, 2025 · 5 comments · Fixed by #1088
Labels
bug Our bugs

Comments

@classabbyamp
Copy link

Describe the bug

libnfsidmap (from nfs-utils) includes several plugins that are dlopened with the expectation of some symbols being loaded already. glibc's ldd hides this, but musl's does not, producing an error like this:

$ ldd /usr/lib/libnfsidmap/regex.so
	ldd (0x7f0f5f58f000)
	libc.so => ldd (0x7f0f5f58f000)
Error relocating /usr/lib/libnfsidmap/regex.so: nfsidmap_config_get: symbol not found
Error relocating /usr/lib/libnfsidmap/regex.so: nfs4_get_default_domain: symbol not found
Error relocating /usr/lib/libnfsidmap/regex.so: idmap_verbosity: symbol not found
Error relocating /usr/lib/libnfsidmap/regex.so: idmap_log_func: symbol not found

This causes dracut to fail to build when including libnfsidmap.

These plugins have no dependencies that dracut should care about, so they should not be searched when added.

dracut log

dracut[I]: Executing: /usr/bin/dracut /tmp/foo.img
dracut[I]: 62bluetooth: Could not find any command of '/usr/lib/bluetooth/bluetoothd /usr/libexec/bluetooth/bluetoothd'!
dracut[I]: *** Including module: dash ***
dracut[I]: *** Including module: shell-interpreter ***
dracut[I]: *** Including module: i18n ***
dracut[I]: *** Including module: network-legacy ***
dracut[I]: *** Including module: network ***
dracut[I]: *** Including module: net-lib ***
dracut[I]: *** Including module: drm ***
dracut[I]: *** Including module: btrfs ***
dracut[I]: *** Including module: crypt ***
dracut[I]: *** Including module: dm ***
dracut[I]: *** Including module: kernel-modules ***
dracut[I]: *** Including module: kernel-modules-extra ***
dracut[I]: *** Including module: kernel-network-modules ***
dracut[I]: *** Including module: lvm ***
dracut[I]: *** Including module: nvdimm ***
dracut[I]: *** Including module: qemu ***
dracut[I]: *** Including module: qemu-net ***
dracut[I]: *** Including module: hwdb ***
dracut[I]: *** Including module: lunmask ***
dracut[I]: *** Including module: nfs ***
dracut[I]: *** Including module: resume ***
dracut[I]: *** Including module: rootfs-block ***
dracut[I]: *** Including module: terminfo ***
dracut[I]: *** Including module: udev-rules ***
dracut[I]: *** Including module: virtfs ***
dracut[I]: *** Including module: virtiofs ***
dracut[I]: *** Including module: usrmount ***
dracut[I]: *** Including module: base ***
dracut[I]: *** Including module: fs-lib ***
dracut[I]: *** Including module: shutdown ***
dracut[I]: *** Including modules done ***
dracut[I]: *** Installing kernel module dependencies ***
dracut[I]: *** Installing kernel module dependencies done ***
dracut[I]: *** Resolving executable dependencies ***
dracut-install: ERROR: 'ldd /var/tmp/dracut.L8ax5l/initramfs/usr/lib/libnfsidmap/nsswitch.so' failed with 141
dracut-install: ERROR: 'ldd /var/tmp/dracut.L8ax5l/initramfs/usr/lib/libnfsidmap/regex.so' failed with 127
dracut-install: ERROR: 'ldd /var/tmp/dracut.L8ax5l/initramfs/usr/lib/libnfsidmap/static.so' failed with 127
dracut-install: ERROR: 'ldd /var/tmp/dracut.L8ax5l/initramfs/usr/lib/libnfsidmap/umich_ldap.so' failed with 127
dracut[F]: Resolving executable dependencies failed

Distribution used

Void

Dracut version

105

Init system

runit

To Reproduce

On a musl system, build a dracut image with nfs-utils installed.

Expected behavior

An image is built.

Additional context

see also:

@jozzsi
Copy link
Contributor

jozzsi commented Jan 5, 2025

These plugins have no dependencies that dracut should care about

What would be a condition in the system for dracut to know which .so's dependencies it should care about and which .so dependencies it should not ?

Would it be appropriate just ignore the ldd failure in this case and continue ?

@richfelker
Copy link

richfelker commented Jan 5, 2025

How do these .so's end up in the scan? They're not dependencies of anything else, only dynamic loaded. If it's just via scan of *.so from the package, perhaps these should be treated differently if they're not in lib path, not named lib*.so, not referenced by anything else, or something like that.

Or maybe ldd should have a mode to ignore undefined so you can scan libs that expect symbols from main programs just for deps. I wonder what glibc is doing that makes it report missing syms for dynamic linked programs but not for shared libs...?

@jozzsi
Copy link
Contributor

jozzsi commented Jan 5, 2025

How do these .so's end up in the scan?

Explicitly included here: https://github.com/dracut-ng/dracut-ng/blob/main/modules.d/95nfs/module-setup.sh#L97

Assumption is that these .so's are actually needed for nfs to work in the initrd (at least for glibc but perhaps regardless). The original commit is from 2010 (yes almost 15 years ago) - 0679a6d

I need help from the Void community to explore a workaround where dracut does not call ldd on these without regressing other distro's - there is also a parallel discussion at void-linux/void-packages#53785

@classabbyamp
Copy link
Author

on glibc, ldd does notice the symbols with --function-relocs (but still exits 0)

$ ldd --function-relocs /usr/lib/libnfsidmap/regex.so      
	linux-vdso.so.1 (0x00007ffe073f8000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f217922f000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f2179453000)
undefined symbol: idmap_verbosity	(/usr/lib/libnfsidmap/regex.so)
undefined symbol: idmap_log_func	(/usr/lib/libnfsidmap/regex.so)
undefined symbol: nfsidmap_config_get	(/usr/lib/libnfsidmap/regex.so)
undefined symbol: nfs4_get_default_domain	(/usr/lib/libnfsidmap/regex.so)
$ echo $?
0

jozzsi added a commit to jozzsi/dracut-ng that referenced this issue Jan 7, 2025
Also move inst_libdir_file as the last step to handle
the error case better.

Fixes dracut-ng#1087
jozzsi added a commit to jozzsi/dracut-ng that referenced this issue Jan 7, 2025
Also move inst_libdir_file as the last step to handle
the error case better.

Fixes dracut-ng#1087
jozzsi added a commit to jozzsi/dracut-ng that referenced this issue Jan 7, 2025
Also move inst_libdir_file as the last step to handle
the error case better.

Fixes dracut-ng#1087
jozzsi added a commit to jozzsi/dracut-ng that referenced this issue Jan 7, 2025
Also move inst_libdir_file as the last step to handle
the error case better.

Fixes dracut-ng#1087
@Vaelatern
Copy link

Not-setting DRACUT_RESOLVE_LAZY results in some angry looking warnings:

dracut[I]: *** Including module: nfs ***
dracut-install: ERROR: failed to install '/lib/libnfsidmap/nsswitch.so:' for '/lib/libnfsidmap/nsswitch.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/nsswitch.so:' for '/lib/libnfsidmap/nsswitch.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/nsswitch.so:' for '/lib/libnfsidmap/nsswitch.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/nsswitch.so:' for '/lib/libnfsidmap/nsswitch.so'
dracut-install: ERROR: 'ldd /lib/libnfsidmap/nsswitch.so' failed with 127
dracut-install: ERROR: installing '/lib/libnfsidmap/nsswitch.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/regex.so:' for '/lib/libnfsidmap/regex.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/regex.so:' for '/lib/libnfsidmap/regex.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/regex.so:' for '/lib/libnfsidmap/regex.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/regex.so:' for '/lib/libnfsidmap/regex.so'
dracut-install: ERROR: 'ldd /lib/libnfsidmap/regex.so' failed with 127
dracut-install: ERROR: installing '/lib/libnfsidmap/regex.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/static.so:' for '/lib/libnfsidmap/static.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/static.so:' for '/lib/libnfsidmap/static.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/static.so:' for '/lib/libnfsidmap/static.so'
dracut-install: ERROR: 'ldd /lib/libnfsidmap/static.so' failed with 127
dracut-install: ERROR: installing '/lib/libnfsidmap/static.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/umich_ldap.so:' for '/lib/libnfsidmap/umich_ldap.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/umich_ldap.so:' for '/lib/libnfsidmap/umich_ldap.so'
dracut-install: ERROR: failed to install '/lib/libnfsidmap/umich_ldap.so:' for '/lib/libnfsidmap/umich_ldap.so'
dracut-install: ERROR: 'ldd /lib/libnfsidmap/umich_ldap.so' failed with 127
dracut-install: ERROR: installing '/lib/libnfsidmap/umich_ldap.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/nsswitch.so:' for '/usr/lib/libnfsidmap/nsswitch.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/nsswitch.so:' for '/usr/lib/libnfsidmap/nsswitch.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/nsswitch.so:' for '/usr/lib/libnfsidmap/nsswitch.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/nsswitch.so:' for '/usr/lib/libnfsidmap/nsswitch.so'
dracut-install: ERROR: 'ldd /usr/lib/libnfsidmap/nsswitch.so' failed with 127
dracut-install: ERROR: installing '/usr/lib/libnfsidmap/nsswitch.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/regex.so:' for '/usr/lib/libnfsidmap/regex.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/regex.so:' for '/usr/lib/libnfsidmap/regex.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/regex.so:' for '/usr/lib/libnfsidmap/regex.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/regex.so:' for '/usr/lib/libnfsidmap/regex.so'
dracut-install: ERROR: 'ldd /usr/lib/libnfsidmap/regex.so' failed with 127
dracut-install: ERROR: installing '/usr/lib/libnfsidmap/regex.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/static.so:' for '/usr/lib/libnfsidmap/static.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/static.so:' for '/usr/lib/libnfsidmap/static.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/static.so:' for '/usr/lib/libnfsidmap/static.so'
dracut-install: ERROR: 'ldd /usr/lib/libnfsidmap/static.so' failed with 127
dracut-install: ERROR: installing '/usr/lib/libnfsidmap/static.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/umich_ldap.so:' for '/usr/lib/libnfsidmap/umich_ldap.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/umich_ldap.so:' for '/usr/lib/libnfsidmap/umich_ldap.so'
dracut-install: ERROR: failed to install '/usr/lib/libnfsidmap/umich_ldap.so:' for '/usr/lib/libnfsidmap/umich_l
dap.so'
dracut-install: ERROR: 'ldd /usr/lib/libnfsidmap/umich_ldap.so' failed with 127
dracut-install: ERROR: installing '/usr/lib/libnfsidmap/umich_ldap.so'
dracut[E]: FAILED: /usr/lib/dracut/dracut-install -D /var/tmp/dracut.JUmb4k/initramfs -a -l /lib/libnfsidmap/nsswitch.so /lib/libnfsidmap/regex.so /lib/libnfsidmap/static.so /lib/libnfsidmap/umich_ldap.so /lib/libnfsidmap.so /lib/libnfsidmap.so.1 /lib/libnfsidmap.so.1.0.0 /usr/lib/libnfsidmap/nsswitch.so /usr/lib/libnfsidmap/regex.so /usr/lib/libnfsidmap/static.so /usr/lib/libnfsidmap/umich_ldap.so /usr/lib/libnfsidmap.so /usr/lib/libnfsidmap.so.1 /usr/lib/libnfsidmap.so.1.0.0
dracut[I]: *** Including module: nvmf ***

but does cause a clean return code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Our bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants