dracutdevs / dracut

dracut the event driven initramfs infrastructure
https://github.com/dracutdevs/dracut/wiki
GNU General Public License v2.0
598 stars 397 forks source link

dracut-install --ldd on .so library does not install dependencies #2482

Open bdrung opened 1 year ago

bdrung commented 1 year ago

Describe the bug

Running dracut-install --ldd on .so libraries does not install dependencies. Example:

$ mkdir destdir
$ ./dracut-install -D destdir -v --ldd /usr/lib/x86_64-linux-gnu/plymouth/renderers/frame-buffer.so
$ find destdir/
destdir/
destdir/usr
destdir/usr/lib
destdir/usr/lib/x86_64-linux-gnu
destdir/usr/lib/x86_64-linux-gnu/plymouth
destdir/usr/lib/x86_64-linux-gnu/plymouth/renderers
destdir/usr/lib/x86_64-linux-gnu/plymouth/renderers/frame-buffer.so
$ ldd /usr/lib/x86_64-linux-gnu/plymouth/renderers/frame-buffer.so
    linux-vdso.so.1 (0x00007ffe62152000)
    libgtk3-nocsd.so.0 => /lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (0x00007f766d383000)
    libply.so.5 => /lib/x86_64-linux-gnu/libply.so.5 (0x00007f766d365000)
    libply-splash-core.so.5 => /lib/x86_64-linux-gnu/libply-splash-core.so.5 (0x00007f766d342000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f766d000000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f766d259000)
    libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f766d229000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f766d3b6000)

Distribution used Ubuntu

Dracut version dracut 059 and git HEAD

To Reproduce Run dracut-install --ldd on a .so library.

Expected behavior I expect dracut-install to inspect the .so library.

Additional context

Running dracut-install --resolvelazy afterwards will install the libraries.

living180 commented 11 months ago

I don't know if it is the same issue as the original reporter, but I ran into a similar issue today. dracut-install was failing to resolve dependencies for all binaries, whether executables or libraries. I tracked it down to the fact that I was running with a multilib glibc but with CONFIG_IA32_EMULATION disabled in the kernel. In this situation, ldd gives the following message to stderr:

/usr/bin/ldd: line 159: /lib/ld-linux.so.2: cannot execute binary file: Exec format error

but then continues on to print the shared objects to stdout.

However, dracut-install --ldd detects the cannot execute binary file string and bails out early of the resolve_deps() function if it is present: https://github.com/dracutdevs/dracut/blob/6acfecae572fb457115b276b5b64d9424ad5187b/src/install/dracut-install.c#L595

I don't know if this should be considered a bug in dracut or simply an unsupported configuration, but in my case I was able to fix the problem by rebuilding my kernel with CONFIG_IA32_EMULATION enabled.

LaszloGombos commented 11 months ago

@living180 I think the issue you described is slightly different and perhaps already resolved (just not released). Can you please check if https://github.com/dracutdevs/dracut/pull/2193 resolved the issue you run into ?

living180 commented 11 months ago

@LaszloGombos yes, that issue is exactly what I hit, and applying the patch from #2193 fixes it for me. Thanks, and sorry for the noise on this bug!