Bug 512892

Summary: mkinitrd can add modules multiple times
Product: Red Hat Enterprise Linux 5 Reporter: Issue Tracker <tao>
Component: mkinitrdAssignee: Brian Lane <bcl>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.3CC: atodorov, ddumas, jstodola, mpoole, rhel, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: mkinitrd- Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-21 05:33:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 726828    

Description Issue Tracker 2009-07-21 08:43:12 UTC
Escalated to Bugzilla from IssueTracker

Comment 1 Issue Tracker 2009-07-21 08:43:14 UTC
Event posted on 2009-07-21 07:33 BST by pyaduvan

Description of problem: Customer installed RHEL5.3 on ASUS P6T7 motherboard, after reboot system shows following messages at boot time :

PCI: BIOS Bug: MCFG area at e0000000 is not E820-reserved
Red Hat nash version starting
insmod: error inserting '/lib/raid456.ko': -1 File exists
insmod: error inserting '/lib/raid456.ko': -1 File exists

Above messages are not creating nay functional issue to the system however the customer need this fixed as they want to move the system to production.

How reproducible: Always

Steps to Reproduce: 
Install RHEL 5.3 with RAID5 device created at install time.
Create multiple RAID5 devices.
Reboot the system.
Error message will appear at boot time.

Actual results: System boots fine with error message.

Expected results: System should boot normally without the error message.

Additional info:

Test Environment :

1. If I install RHEL5u3 on a non-RAID filesystem and create RAID5 filesystems later (I created three md0, md1, md2), I am unable to see any such message during bootup. The init script in initrd image have no mention of the module being added, nor the raid456.ko module is present in the modules library of the image.

2. If I create two RAID5 filesystems during installation (/ and swap), during booting, I see the message "insmod: error inserting '/lib/raid456.ko': -1 File exists" once. The init script shows that the module raid456.ko getting added twice.

2a. If after the above installation I create more RAID5 filesystems and create a new initrd image and boot with it, the message still shows up once (as it was before), the number of RAID5 filesystems created after installation does not have any effect on the number of occurrence of the message.

So, it seems that if two RAID5 are created during installation, raid456.ko module gets loaded for the first md device, and for the second, it prints the message once. If three RAID5 are created, the message prints twice (for the second and third md). But if RAID5 filesystems are created after installation, it has no effect on the message.
This event sent from IssueTracker by mpoole  [SEG - Base OS]
 issue 320216

Comment 2 Martin Poole 2009-07-21 08:48:45 UTC
Problem is most easily triggered by having multiple raid devices of the same level.

The code inserted in the initrd image will attempt to load the relevant raid module for each device, causing the error message on 2nd and subsequent occurences.

Although there is a comment in the mkinitrd script regarding eliminating duplicates there is no code.

    # only need to add each module once
    MODULES="$MODULES $fmPath"

Current upstream has the following at this point

    # only need to add each module once
    case " $(eval echo \${$modlist}) " in
        *" $modName "*)
            return ;;
            eval $modlist=\"\${$modlist} $modName\"

Obviously there has been some refactoring which needs to be accounted for, but the elimination code seems sound.

Comment 3 Martin Poole 2009-07-21 10:37:56 UTC
The upstream seems to be only adding the module name to the list if not duplicate whereas the RHEL5 code is using the full path.  Assuming there is still a 1-1 relationship involved this probably makes the de-dupe for RHEL5 something like

    # only need to add each module once
    case " $MODULES " in
        *" $fmPath "*)
            return ;;
            MODULES="$MODULES $fmPath"

Comment 8 RHEL Program Management 2011-08-05 12:33:48 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update

Comment 10 Jan Stodola 2012-01-02 09:11:22 UTC
Reproduced with mkinitrd- and three RAID5 devices:

Memory for crash kernel (0x0 to 0x0) notwithin permissible range
Warning: pci_mmcfg_init marking 256MB space uncacheable.
ed Hat nash version starting
insmod: error inserting '/lib/raid456.ko': -1 File exists
insmod: error inserting '/lib/raid456.ko': -1 File exists
raid5: raid level 5 set md1 active with 2 out of 3 devices, algorithm 2
                Welcome to Red Hat Enterprise Linux Server
                Press 'I' to enter interactive startup.

After creating new initramdisk using updated mkinitrd (mkinitrd- and rebooting, there were no error messages.

Also unable to reproduce with clean installation of RHEL-5.8 Snapshot 2 (mkinitrd- and three RAID5 devices.

Moving to VERIFIED.

Comment 11 errata-xmlrpc 2012-02-21 05:33:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.