Bug 503567 - local variable clobbers global rootdev
local variable clobbers global rootdev
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: mkinitrd (Show other bugs)
5.3
All Linux
high Severity high
: rc
: ---
Assigned To: Hans de Goede
Alexander Todorov
:
: 457216 (view as bug list)
Depends On:
Blocks: 499522 531114
  Show dependency treegraph
 
Reported: 2009-06-01 14:29 EDT by Bryn M. Reeves
Modified: 2010-10-25 07:10 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-03-30 04:59:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
rename local variable to avoid conflict with global rootdev (657 bytes, patch)
2009-06-01 14:38 EDT, Bryn M. Reeves
no flags Details | Diff

  None (edit)
Description Bryn M. Reeves 2009-06-01 14:29:53 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

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 14:31:57 EDT
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 14:38:38 EDT
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 11:52:57 EDT
After patch review, adding dev ack for this one.
Comment 8 Hans de Goede 2009-11-05 10:13:37 EST
I'll take care of this one.
Comment 9 Hans de Goede 2009-11-24 04:12:59 EST
This is fixed in mkinitrd-5.1.19.6-55 .
Comment 12 Chris Ward 2010-02-11 05:30:27 EST
~~ 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 15:54:19 EST
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 07:02:50 EST
Moving to VERIFIED as per comment #14
Comment 17 errata-xmlrpc 2010-03-30 04:59:40 EDT
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 12:12:17 EDT
*** Bug 457216 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.