Bug 996245

Summary: dracut fails to include dm and dmraid even when specified in dracut.conf (after latest update)
Product: [Fedora] Fedora Reporter: Peter Trenholme <PTrenholme>
Component: dracutAssignee: dracut-maint
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: dracut-maint, harald, jonathan
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-15 06:51:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Requested dracut --debug log file (gziped) none

Description Peter Trenholme 2013-08-12 18:23:03 UTC
Description of problem: The initramfs file cannot boot from a raid1 drive without the dm and dmraid modules.


Version-Release number of selected component (if applicable):
031-24.git20130809.fc20031-24.git20130809.fc20

How reproducible:
Every time

Steps to Reproduce:
1.dracut --force --kver 3.11.0-0.rc4.git5.1.fc20.x86_64
2.
3.

Actual results:
# lsinitrd /boot/initramfs-3.11.0-0.rc4.git5.1.fc20.x86_64.img | head -17
Image: /boot/initramfs-3.11.0-0.rc4.git5.1.fc20.x86_64.img: 9.0M
========================================================================
dracut-031-24.git20130809.fc20 with dracut modules:
caps
i18n
drm
plymouth
kernel-modules
rootfs-block
terminfo
udev-rules
biosdevname
systemd
base
fs-lib
shutdown
========================================================================


Expected results:
# lsinitrd /boot/initramfs-3.11.0-0.rc4.git2.1.fc20.x86_64.img | head -19
Image: /boot/initramfs-3.11.0-0.rc4.git2.1.fc20.x86_64.img: 9.9M
========================================================================
dracut-031-7.git20130801.fc20 with dracut modules:
i18n
drm
plymouth
dm
dmraid
kernel-modules
mdraid
rootfs-block
terminfo
udev-rules
biosdevname
systemd
base
fs-lib
shutdown
========================================================================


Additional info:
I've been running yum -y --skip-broken update daily, and only the git2 kernel is bootable.

Comment 1 Peter Trenholme 2013-08-12 18:44:48 UTC
Oops! I just noticed that I'd forgotten to remove the comment from the "add_drivers" command. After correcting that, the dm modules ARE included. (I haven't yet tried booting, but I expect it will work.)

So the problem is that, with 'hostonly="yes",' the needed raid drives are, apparently, not included.

Comment 2 Peter Trenholme 2013-08-12 20:48:58 UTC
Well, that didn't work: dm and dmraid were there, but mdraid was not included. I tried adding it:

$ grep -v '#' /etc/dracut.conf | grep -v '^[[:space:]]*$'
add_dracutmodules+="dm dmraid"
add_drivers+="mdraid"
hostonly="yes"
mdadmconf="yes"
lvmconf="no"

but all I got was:

$ sudo dracut --force -kver 3.11.0-0.rc4.git2.1.fc20.x86_64
/usr/lib/dracut/dracut-functions.sh: line 78: vercmp: command not found
/usr/lib/dracut/dracut-functions.sh: line 129: 14 > 3 7: syntax error in expression (error token is "7")
/usr/lib/dracut/dracut-functions.sh: line 130: 14 < 3 7: syntax error in expression (error token is "7")
/usr/lib/dracut/dracut-functions.sh: line 129: 14 > 3 7: syntax error in expression (error token is "7")
/usr/lib/dracut/dracut-functions.sh: line 130: 14 < 3 7: syntax error in expression (error token is "7")
Failed to install module mdraid

So I tried to fix the vercmp function, after repositioning its use to follow its definition:

# Version comparison function.  Assumes Linux style version scheme.
# $1 = version a
# $2 = comparison op (gt, ge, eq, le, lt, ne)
# $3 = version b
vercmp() {
    local _n1=${1//./""/} _op=$2 _n2=${3//./""/} _i _res

    for ((_i=0; ; _i++))
    do
        if [[ ! ${_n1[_i]}${_n2[_i]} ]]; then _res=0
        elif ((${_n1[_i]:-0} > ${_n2[_i]:-0})); then _res=1
        elif ((${_n1[_i]:-0} < ${_n2[_i]:-0})); then _res=2
        else continue
        fi
        break
    done

    case $_op in
        gt) ((_res == 1));;
        ge) ((_res != 2));;
        eq) ((_res == 0));;
        le) ((_res != 1));;
        lt) ((_res == 2));;
        ne) ((_res != 0));;
    esac
}

This "fixed" it so that no error message was generated, but the mdraid module sill is not loaded.

I think that someone more attuned to the details on the "standard" versioning system may do better. (And I suspect that the new version of bash is not doing what the author of this function expected with the _n1=${1//./ }.

Comment 3 Harald Hoyer 2013-08-14 10:48:23 UTC
Thanks for finding the "vercmp()" bug!

Please attach the output of:

# sudo dracut --force -kver 3.11.0-0.rc4.git2.1.fc20.x86_64 --debug

Comment 4 Peter Trenholme 2013-08-14 23:39:47 UTC
Created attachment 786726 [details]
Requested dracut --debug log file (gziped)

OK, here it is, but the error seems to have been fixed. (Note the update to -29 made yesterday.)

$ sudo grep dracut /var/log/yum.log | grep 'Aug'
Aug 11 10:04:43 Updated: dracut-031-24.git20130809.fc20.x86_64
Aug 11 10:05:08 Updated: dracut-network-031-24.git20130809.fc20.x86_64
Aug 11 10:05:09 Updated: dracut-config-rescue-031-24.git20130809.fc20.x86_64
Aug 13 15:37:57 Updated: dracut-031-29.git20130812.fc20.x86_64
Aug 13 15:41:05 Updated: dracut-network-031-29.git20130812.fc20.x86_64
Aug 13 15:41:06 Updated: dracut-caps-031-29.git20130812.fc20.x86_64
Aug 13 15:41:07 Updated: dracut-config-rescue-031-29.git20130812.fc20.x86_64