Bug 503567

Summary: local variable clobbers global rootdev
Product: Red Hat Enterprise Linux 5 Reporter: Bryn M. Reeves <bmr>
Component: mkinitrdAssignee: Hans de Goede <hdegoede>
Status: CLOSED ERRATA QA Contact: Alexander Todorov <atodorov>
Severity: high Docs Contact:
Priority: high    
Version: 5.3CC: atodorov, borgan, cward, ddumas, hdegoede, jean.francois.lassignardie, jruemker, rprice, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-30 08:59:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 499522, 531114    
Attachments:
Description Flags
rename local variable to avoid conflict with global rootdev none

Description Bryn M. Reeves 2009-06-01 18:29:53 UTC
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

instead of:

$ mkrootdev -t ext3 -o defaults,ro /dev/mapper/mpath1p1

This prevents the system from booting.

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


How reproducible:
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
  
Actual results:
component device (/dev/sd*)

Expected results:
Actual root device (usually a /dev/mapper/mpath?p? device)

Additional info:

Comment 1 Bryn M. Reeves 2009-06-01 18:31:57 UTC
I think the reason we don't always see this is here:

1250         if [ -z "$rootdevs" ]; then
1251             rootdevs="$rootdev"
1252         fi

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.

Comment 3 Bryn M. Reeves 2009-06-01 18:38:38 UTC
Created attachment 346118 [details]
rename local variable to avoid conflict with global rootdev

Patch from John Ruemker to correct rootdev aliasing.

Comment 6 Denise Dumas 2009-10-27 15:52:57 UTC
After patch review, adding dev ack for this one.

Comment 8 Hans de Goede 2009-11-05 15:13:37 UTC
I'll take care of this one.

Comment 9 Hans de Goede 2009-11-24 09:12:59 UTC
This is fixed in mkinitrd-5.1.19.6-55 .

Comment 12 Chris Ward 2010-02-11 10:30:27 UTC
~~ 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.

Comment 14 John Ruemker 2010-02-17 20:54:19 UTC
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
mkinitrd-5.1.19.6-56

-John

Comment 15 Alexander Todorov 2010-02-18 12:02:50 UTC
Moving to VERIFIED as per comment #14

Comment 17 errata-xmlrpc 2010-03-30 08:59:40 UTC
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.

http://rhn.redhat.com/errata/RHBA-2010-0295.html

Comment 18 Peter Jones 2010-09-24 16:12:17 UTC
*** Bug 457216 has been marked as a duplicate of this bug. ***