Red Hat Bugzilla – Bug 503567
local variable clobbers global rootdev
Last modified: 2010-10-25 07:10:31 EDT
Description of problem:
The mkinitrd script uses a global variable "rootdev" to store the name of the root device. This is either auto-detected or passed in via the command line --rootdev= parameter.
The changes to mkinitrd to support boot from multipath introduces code to build a list of root WWIDs (root_wwids) from a list of component root devices (rootdevs). The local variable used in the body of this loop is named "rootdev" allowing this code to clobber the global variable.
This results in an incorrect root device being emitted into the /init script; instead of the root multipath partition or logical volume a component scsi device is emitted, e.g. we get:
$ mkrootdev -t ext3 -o defaults,ro /dev/sdc
$ mkrootdev -t ext3 -o defaults,ro /dev/mapper/mpath1p1
This prevents the system from booting.
Version-Release number of selected component (if applicable):
Depends on system configuration; doesn't seem to affect systems with root on a logical volume.
Steps to Reproduce:
1. run mkinitrd on a multipath boot system
2. unpack resulting initrd.img
3. verify root device passed on mkrootdev line
component device (/dev/sd*)
Actual root device (usually a /dev/mapper/mpath?p? device)
I think the reason we don't always see this is here:
1250 if [ -z "$rootdevs" ]; then
This appears right after dm device dependencies have been discovered. If we arrive here with a zero-length rootdevs then the value of rootdev at the end of the following loop is always equal to rootdev and the generated init script is correct. Otoh, if rootdevs is a list of component devices (e.g. "/dev/sdc /dev/sdf" etc.) then we get the incorrect behaviour.
Created attachment 346118 [details]
rename local variable to avoid conflict with global rootdev
Patch from John Ruemker to correct rootdev aliasing.
After patch review, adding dev ack for this one.
I'll take care of this one.
This is fixed in mkinitrd-126.96.36.199-55 .
~~ Attention Customers and Partners - RHEL 5.5 Beta is now available on RHN ~~
RHEL 5.5 Beta has been released! There should be a fix present in this
release that addresses your request. Please test and report back results
here, by March 3rd 2010 (2010-03-03) or sooner.
Upon successful verification of this request, post your results and update
the Verified field in Bugzilla with the appropriate value.
If you encounter any issues while testing, please describe them and set
this bug into NEED_INFO. If you encounter new defects or have additional
patch(es) to request for inclusion, please clone this bug per each request
and escalate through your support representative.
Fix confirmed in 5.5 beta. initrd-orig contains initrd contents from a 5.4 mpath install, initrd-503567 contains initrd contents created from mkinitrd-5.1.19-6.56:
# grep mkrootdev initrd-orig/init initrd-503567/init
initrd-orig/init:mkrootdev -t ext3 -o defaults,ro /dev/sdc
initrd-503567/init:mkrootdev -t ext3 -o defaults,ro /dev/VolGroup00/LogVol00
# rpm -q mkinitrd
Moving to VERIFIED as per comment #14
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
*** Bug 457216 has been marked as a duplicate of this bug. ***