Bug 171871

Summary: mkinitrd can produce broken linuxrc file
Product: Red Hat Enterprise Linux 3 Reporter: Bastien Nocera <bnocera>
Component: mkinitrdAssignee: Brian Lane <bcl>
Status: CLOSED WONTFIX QA Contact: Kevin Baker <kbaker>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: ineilsen, k.macdonald, tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 13:22:04 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: 190430    
Attachments:
Description Flags
example-fstab none

Description Bastien Nocera 2005-10-27 10:39:55 UTC
Present in RHEL3 (mkinitrd-3.5.13-6.1) and RHEL4 (mkinitrd-4.2.1.6-1).

1. Run mkinitrd on the attached fstab
2. the linuxrc will contain a 3 line root mount command:
 mount -o defaults
 defaults --ro -t ext3
 ext3 /dev/root /sysroot
instead of:
 mount -o default --ro -t ext3 /dev/root /sysroot

The fix is to replace the following awk commands:
 rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
 rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' $fstab)
with:
 rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; exit }}' $fstab)
 rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; exit }}' $fstab)

(Notice the exit after the print statement)

"Patch" by Martin Poole <mpoole>

Comment 1 Bastien Nocera 2005-10-27 10:39:56 UTC
Created attachment 120458 [details]
example-fstab

Comment 4 Kenneth MacDonald 2007-07-16 11:06:45 UTC
This happens whenever there are two lines in /etc/fstab with the "/" mount
point.  I've just been stung by this bug in FC6 too.  

Martin's suggested fix takes the first entry in /etc/fstab.  Alternatively,
using "tail -n 1" after the awk will get the last entry from /etc/fstab.

This leaves the system unbootable when it happens.  

Comment 6 Jiri Pallich 2012-06-20 13:22:04 UTC
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life. 
Please See https://access.redhat.com/support/policy/updates/errata/

If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.