Bug 1884149

Summary: dracut generates broken initramfs images when /etc/ld.so.preload contains a non-existing library
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: dracutAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.2CC: dracut-maint-list, dtardon, fsumsal
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: dracut-049-129.git20210107.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:02:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Renaud Métrich 2020-10-01 07:54:16 UTC
This bug was initially created as a copy of Bug #1884147

I am copying this bug because: 

Also applies to RHEL 8.


Description of problem:

When specifying a non-existing library in /etc/ld.so.preload, dracut generates a broken initramfs image, containing everything except a few binaries which are symlinks to other binaries, e.g.:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
lrwxrwxrwx   1 root     root            4 Feb 28  2020 usr/bin/awk -> gawk
lrwxrwxrwx   1 root     root           16 Feb 28  2020 usr/sbin/halt -> ../bin/systemctl
lrwxrwxrwx   1 root     root           11 Feb 28  2020 usr/sbin/ping -> ../bin/ping
lrwxrwxrwx   1 root     root           14 Feb 28  2020 usr/sbin/udevadm -> ../bin/udevadm
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

This prevents the system from booting.


Version-Release number of selected component (if applicable):

dracut from RHEL 7 and RHEL 8


How reproducible:

Always


Steps to Reproduce:
1. Create /etc/ld.so.preload with a non-existing library

  # echo "/lib64/libfoo.so" > /etc/ld.so.preload

2. Build the initramfs

  # dracut /tmp/initramfs.img $(uname -r)

3. Compare with the good one in /boot

  # diff -u /tmp/initramfs.img $(uname -r).img /boot/initramfs-$(uname -r).img

Actual results:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
+lrwxrwxrwx   1 root     root            4 Feb 28  2020 usr/bin/awk -> gawk
+lrwxrwxrwx   1 root     root           16 Feb 28  2020 usr/sbin/halt -> ../bin/systemctl
+lrwxrwxrwx   1 root     root           11 Feb 28  2020 usr/sbin/ping -> ../bin/ping
+lrwxrwxrwx   1 root     root           14 Feb 28  2020 usr/sbin/udevadm -> ../bin/udevadm
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Output may vary.


Expected results:

All files included and symlinks created

Additional info:

Running dracut in debug shows "dracut-install" is failing but reporting success anyway:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
dracut-install: Handle 'ping'
dracut-install: find_binary(ping) == /usr/sbin/ping
dracut-install: find_binary(ping) == /usr/bin/ping
dracut-install: dracut_install '/usr/sbin/ping'
dracut-install: dracut_install('/usr/sbin/ping', '/usr/sbin/ping')
dracut-install: dracut_install('/usr/bin/ping', '/usr/bin/ping')
ERROR: ld.so: object '/lib64/libfoo.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
dracut-install: ldd: 'ERROR: ld.so: object '/lib64/libfoo.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
dracut-install: '
dracut-install: dracut_install('/lib64/libfoo.so'', '/lib64/libfoo.so'')
...
dracut-install: cp '/usr/bin/ping' '/var/tmp/dracut.yEP3o0/initramfs/usr/bin/ping'
dracut-install: dracut_install ret = 2
dracut-install: '/usr/bin/ping' install error
dracut-install: dracut_install '/usr/bin/ping'
dracut-install: dracut_install('/usr/bin/ping', '/usr/bin/ping')
dracut-install: hash hit items for '/usr/bin/ping'
dracut-install: dracut_install '/usr/bin/ping' OK
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Comment 7 errata-xmlrpc 2021-05-18 15:02:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (dracut bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1661