Bug 503567 - local variable clobbers global rootdev
Summary: local variable clobbers global rootdev
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: mkinitrd
Version: 5.3
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Hans de Goede
QA Contact: Alexander Todorov
URL:
Whiteboard:
: 457216 (view as bug list)
Depends On:
Blocks: 499522 531114
TreeView+ depends on / blocked
 
Reported: 2009-06-01 18:29 UTC by Bryn M. Reeves
Modified: 2018-10-27 14:26 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-03-30 08:59:40 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2010:0295 0 normal SHIPPED_LIVE mkinitrd bug fix and enhancement update 2010-03-29 14:21:24 UTC

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. ***


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