Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
When dracut silently produces a broken initramfs, then the system will likely not boot and this can be very problematic.
It appears that dracut is not protected against the BASH_ENV variable, causing various scripts called by dracut to possibly fail or provide wrong output (e.g. "ldd" is one of these).
Having a broken output for "ldd" makes the generated initramfs be not usable, typically because vital binaries will be missing (e.g. "modprobe").
Version-Release number of selected component (if applicable):
all on RHEL7 at least
How reproducible:
Always
Steps to Reproduce:
1. As root, setup the BASH_ENV environment variable to a script displaying a banner which will break "dracut_install"
# echo > evil_banner.sh << EOF
echo "Evil Banner /dracut/killer"
EOF
# export BASH_ENV=~/evil_banner.sh
2. Run dracut
# dracut /tmp/initramfs.img $(uname -r)
3. Verify that some binaries are missing (modprobe, awk, rmmod)
# lsinitrd /tmp/initramfs.img | egrep -w "modprobe|awk|rmmod" | grep -v "modprobe.d"
Actual results:
No result
Expected results:
lrwxrwxrwx 1 root root 4 May 24 13:22 usr/bin/awk -> gawk
lrwxrwxrwx 1 root root 11 May 24 13:22 usr/sbin/modprobe -> ../bin/kmod
lrwxrwxrwx 1 root root 11 May 24 13:22 usr/sbin/rmmod -> ../bin/kmod
Additional info:
When setting BASH_ENV to a file generating some path (e.g. "/dracut/killer" in the example), dracut-install fails to create the symlink to the binary, because it relies on the output of "ldd" which is broken due to "ldd" being a bash script and hence sourcing $BASH_ENV.
Proposed quickfix is to unset BASH_ENV at the beginning of the script:
# diff -u /usr/bin/dracut.orig /usr/bin/dracut
--- /usr/bin/dracut.orig 2018-06-07 14:05:29.382000000 +0200
+++ /usr/bin/dracut 2018-06-07 14:25:55.741000000 +0200
@@ -27,6 +27,7 @@
dracut_args=( "$@" )
set -o pipefail
+unset BASH_ENV
usage() {
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
This will guarantee the expected output for "ldd" being called internally (in find_binary).
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, 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-2019:2289