Bug 43688 - mkinitrd should keep order of scsi_hostadapter entries in /etc/modules.conf
Summary: mkinitrd should keep order of scsi_hostadapter entries in /etc/modules.conf
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: mkinitrd
Version: 7.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Matt Wilson
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-06-06 13:10 UTC by Manfred Hollstein
Modified: 2007-04-18 16:33 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-06-06 13:10:12 UTC
Embargoed:


Attachments (Terms of Use)

Description Manfred Hollstein 2001-06-06 13:10:08 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i686)

Description of problem:
I have the following system:

- Creative DVD 1240E ATAPI drive
- YAMAHA 1640 CD-RW SCSI drive

I usually don't have the SCSI drive switched on every time I boot; instead
I'm using
the following command to add it to the list of known SCSI devices on
demand:

  # echo scsi add-single-device 1 0 4 0 >/proc/scsi/scsi

My Adaptec AHA2940 module had been entered into /etc/modules.conf as a
scsi_hostadapter. Since most CD-writer programs (e.g. xcdroast) only work
with
SCSI devices, I decided to use the IDE-SCSI emulation host adapter; but,
when
I put it into /etc/modules.conf and create a new init-ramdisk using
mkinitrd, this
program is ignoring the order of the scsi_hostadapter entries. This leads
to problems
depending on whether the SCSI device is powered on or not when starting the
system. As a result I sometimes get /dev/scd0 as the ATAPI/SCSI device and
/dev/scd1 as the SCSI device, but when the SCSI device was switched on, I
get
/dev/scd0 as the SCSI device and /dev/scd1 as the ATAPI/SCSI device.
Allowing
kudzu to re-create the symbolic links /dev/cdrom and /dev/cdrom1 doesn't
help, as
I want to use the SCSI device for UDF discs, but kudzu creates ISO9660
entries in
/etc/fstab :-(

The whole problem is caused by running "sort" on the output from "grep
scsi_hostadapters /etc/fstab",
which shouldn't been done.

How reproducible:
Always

Steps to Reproduce:
1.Please find all required steps in the Description
2.
3.
	

Actual Results:  See in the Description

Expected Results:  See in the Description

Additional info:

This problem can be fixed by applying the following patch to the original
mkinitrd
sources from RHL 7.1; if you cannot apply this due to whitespace or line
wrapping
problems, the patch can also be found here:

  <http://www.cygnus.com/~manfredh/rhl7.1/mkinitrd-3.0.10-1.mh1.patch>

diff -up SPECS/mkinitrd.spec.orig SPECS/mkinitrd.spec
--- SPECS/mkinitrd.spec.orig    Fri Mar 23 22:19:38 2001
+++ SPECS/mkinitrd.spec Wed Jun  6 14:37:29 2001
@@ -1,7 +1,7 @@
 Summary: Creates an initial ramdisk image for preloading modules.
 Name: mkinitrd
 Version: 3.0.10
-Release: 1
+Release: 1.mh1
 Copyright: GPL
 Group: System Environment/Base
 Source: mkinitrd-%{version}.tar.bz2
@@ -10,6 +10,8 @@ ExclusiveOs: Linux
 Requires: e2fsprogs, /bin/sh, fileutils, grep, mount, gzip, tar,
/sbin/insmod.static, /sbin/losetup, mktemp >= 1.5-5, findutils
 BuildRoot: %{_tmppath}/%{name}-root
 
+Patch: mkinitrd-nosort.patch
+
 %description
 Mkinitrd creates filesystem images for use as initial ramdisk (initrd)
 images.  These ramdisk images are often used to preload the block
@@ -27,6 +29,7 @@ ramdisk using information found in the /
 
 %prep
 %setup -q
+%patch -p2
 
 %build
 make
@@ -46,6 +49,10 @@ rm -rf $RPM_BUILD_ROOT
 %attr(644,root,root) %{_mandir}/man8/nash.8*
 
 %changelog
+* Wed Jun 06 2001 Manfred Hollstein <manfredh>
+- don't invoke sort when looking for scsi_hostadapter entries.
+- document this in the manual page.
+
 * Fri Mar 23 2001 Matt Wilson <msw>
 - reset the state of findmodule after getting the modules we need
 
diff -rup BUILD/mkinitrd-3.0.10.orig/mkinitrd
BUILD/mkinitrd-3.0.10/mkinitrd
--- BUILD/mkinitrd-3.0.10.orig/mkinitrd Fri Mar 23 22:19:54 2001
+++ BUILD/mkinitrd-3.0.10/mkinitrd      Wed Jun  6 14:34:33 2001
@@ -208,7 +208,7 @@ if [ -z "$noscsi" ]; then
     fi
 
     if [ -f $modulefile ]; then
-       scsimodules=`grep scsi_hostadapter $modulefile | grep -v '^[   
]*#' | LC_ALL=C sort -u | awk '{ print $3 }'`
+       scsimodules=`grep scsi_hostadapter $modulefile | grep -v '^[   
]*#' | awk '{ print $3 }'`
 
        if [ -n "$scsimodules" ]; then
            for n in $PRESCSIMODS; do
diff -rup BUILD/mkinitrd-3.0.10.orig/mkinitrd.8
BUILD/mkinitrd-3.0.10/mkinitrd.8
--- BUILD/mkinitrd-3.0.10.orig/mkinitrd.8       Fri Dec  8 22:41:10 2000
+++ BUILD/mkinitrd-3.0.10/mkinitrd.8    Wed Jun  6 14:34:33 2001
@@ -1,4 +1,4 @@
-.TH MKINITRD 8 "Sat Mar 27 1999"
+.TH MKINITRD 8 "Wed Jun  6 2001"
 .UC 4
 .SH NAME
 mkinitrd \- creates initial ramdisk images for preloading modules
@@ -32,6 +32,14 @@ contains the filesystem with the loopbac
 is on the device, and the full path to the loopback image. If the
filesystem
 is modular, initrd will automatically add the filesystem's modules to the
 initrd image.
+
+Unlike earlier revisions of this package, this version of \fBmkinitrd\fR
+pays attention to the order of \fIscsi_hostadapter\fR entries in your
+\fI/etc/modules.conf\fR. This is especially useful for those people
+who have both IDE and SCSI cdrom/cd-rw drives connected to their system,
+and want to use the IDE-SCSI emulation; without this feature the devices
+may show up as different device entries (e.g. scd0 vs. scd1) when not all
+SCSI devices are switched on at power-on.
 
 .SH OPTIONS
 .TP

Comment 1 Bill Nottingham 2001-06-06 14:56:41 UTC
Um, it calls sort for a very specific reason. scsi_hostadapter is *numbered*:

e.g.:

alias scsi_hostadapter aic7xxx
alias scsi_hostadapter1 aic7xxxb
alias scsi_hostadpater2 qla1280
alias scsi_hostadapter3 megaraid

(It works in the same way as ethernet aliases, for example.)


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