Bug 460823

Summary: /sbin/mkinitrd: line 368: cd: slaves: No such file or directory
Product: Red Hat Enterprise Linux 5 Reporter: Zbysek MRAZ <zmraz>
Component: mkinitrdAssignee: Peter Jones <pjones>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5.2CC: aharrison, ebenes, jlaska, wilburn
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0437 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-11-04 12:47:12 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: 439371    
Bug Blocks:    

Description Zbysek MRAZ 2008-09-01 15:27:36 UTC
+++ This bug was initially created as a clone of Bug #439371 +++

Description of problem:
New installation of RHEL5.2-Server-20080326.0 on a s390x
system:
When creating initrd for installed kernel, mkinitrd stays
cycling in an infinite loop causing the whole installation
to fail.

=================================================================

Description of problem: mkinitrd writes error message, consumes all available CPU time and stucks while creating initramdisk image on x86_64 system

Version-Release number of selected component (if applicable):
mkinitrd-5.1.19.6-28 x86_64 together with i386 arch version

How reproducible:
upgrade kernel or manually try to create initramdisk

Steps to Reproduce:
1. mkinitrd /boot/kernel-2.6.18-92.test.img 2.6.18-92.el5
or
1. yum install kernel 
(I've tried the installation of kernel-2.6.18-92.1.10 from running kernel-2.6.18-92 as well as 2.6.18-91)
  
Actual results:
/sbin/mkinitrd: line 368: cd: slaves: No such file or directory

command did not create the initramdisk


Expected results:
exit in reasonable amount of time with 0 return code

Comment 1 Andy Harrison 2008-10-01 21:13:41 UTC

I ran into this bug while testing openvz which runs mkinitrd as part of its postinstall scriptlet.  The solution in bz 439371 doesn't solve the problem because there is nothing to handle a non-existent 'slaves' directory.

Similar to 439371, my directory layout is:

 $ find /sys/block/dm-0 /sys/block/dm-0/slaves/cciss\!c0d0p2/ | xargs ls --time-style "+" -Fogd
drwxr-xr-x 4    0  /sys/block/dm-0/
-r--r--r-- 1 4096  /sys/block/dm-0/dev
drwxr-xr-x 2    0  /sys/block/dm-0/holders/
-r--r--r-- 1 4096  /sys/block/dm-0/range
-r--r--r-- 1 4096  /sys/block/dm-0/removable
-r--r--r-- 1 4096  /sys/block/dm-0/size
drwxr-xr-x 2    0  /sys/block/dm-0/slaves/
lrwxrwxrwx 1    0  /sys/block/dm-0/slaves/cciss!c0d0p2 -> ../../../block/cciss!c0d0/cciss!c0d0p2/
drwxr-xr-x 3    0  /sys/block/dm-0/slaves/cciss!c0d0p2//
-r--r--r-- 1 4096  /sys/block/dm-0/slaves/cciss!c0d0p2/dev
drwxr-xr-x 2    0  /sys/block/dm-0/slaves/cciss!c0d0p2/holders/
lrwxrwxrwx 1    0  /sys/block/dm-0/slaves/cciss!c0d0p2/holders/dm-0 -> ../../../../block/dm-0/
-r--r--r-- 1 4096  /sys/block/dm-0/slaves/cciss!c0d0p2/size
-r--r--r-- 1 4096  /sys/block/dm-0/slaves/cciss!c0d0p2/start
-r--r--r-- 1 4096  /sys/block/dm-0/slaves/cciss!c0d0p2/stat
lrwxrwxrwx 1    0  /sys/block/dm-0/slaves/cciss!c0d0p2/subsystem -> ../../../block/
--w------- 1 4096  /sys/block/dm-0/slaves/cciss!c0d0p2/uevent
-r--r--r-- 1 4096  /sys/block/dm-0/stat
lrwxrwxrwx 1    0  /sys/block/dm-0/subsystem -> ../../block/
--w------- 1 4096  /sys/block/dm-0/uevent


Here is my proposed fix.


--- mkinitrd    2008-10-01 20:11:24.000000000 +0000
+++ mkinitrd    2008-10-01 20:38:20.000000000 +0000
@@ -365,6 +365,7 @@
     if echo $PWD | grep -q "/sys/block/dm-[[:digit:]]$"; then
         while [ ! -L device ]; do
             if [ -L subsystem ]; then
+                [ ! -d slaves ] && break
                 cd slaves
                        for x in *;do
                    if [ -L $x ]; then

Comment 2 Zbysek MRAZ 2008-11-04 12:47:12 UTC

*** This bug has been marked as a duplicate of bug 447841 ***