Bug 429187
| Summary: | grub-install does not work on /dev/cciss/c0d0 (MBR) | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Flavio Leitner <fleitner> |
| Component: | grub | Assignee: | Peter Jones <pjones> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 5.1 | CC: | tao |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2008-02-04 19:52:33 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: | |||
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 release. |
Description of problem: After restoring the system files on Linux Rescue mode, the grub-install command reported following messages: # grub-install /dev/cciss/c0d0 expr: non-numeric argument <---------------------- Installation finished. No error reported. This is the contents of the device map /boot/grub/device.map. Check if this is correct or not. If any of the lines is incorrect, fix it and re-run the script `grub-install'. # this device map was generated by anaconda (hd0) /dev/cciss/c0d0 Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. run the comment above Additional info: This problem also was happened on customer LAB system with RHEL 5 and 5.1. This problem was in grub-install script file. "expr: non-numeric argument" message showed in error of expr command. When customer compared RHEL 4 and 5.1, the following if statements were not executed on RHEL 4. So, they found the problem was in $tmp_part variable. if test "x$tmp_part" != x; then # If a partition is specified, we need to translate it into the # GRUB's syntax. case "$host_os" in linux*) echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%" ;; Then, they checked $tmp_part variable set statements and found the problem in the followings: case "$host_os" in linux*) tmp_disk=`echo "$1" | grep -v '/mapper/control$' | grep -v '/mapper/[[:alnum:]]+-[[:alnum:]]+$' | uniq | sed -e 's%([sh]d[a-z])[0-9]*$%1%' -e 's%(d[0-9]*)p[0-9]*$%1%' -e 's%(fd[0-9]*)$%1%' -e 's%/part[0-9]*$%/disc%' -e 's%(c[0-7]d[0-9]*).*$%1%' -e 's%(/mapper/[[:alpha:]]+[[:digit:]]+)p[[:digit:]]+$%1%' -e 's%(/mapper/[[:alpha:]]+_[[:alpha:]]+)[[:digit:]]+$%1%'` tmp_part=`echo "$1" | grep -v '/mapper/control$' | grep -v '/mapper/[[:alnum:]]+-[[:alnum:]]+$' | uniq | sed -e 's%.*/[sh]d[a-z]([0-9]*)$%1%' -e 's%.*d[0-9]*p%%' <--- HERE -e 's%.*/fd[0-9]*$%%' -e 's%.*/floppy/[0-9]*$%%' -e 's%.*/(disc|part([0-9]*))$%2%' -e 's%.*c[0-7]d[0-9]*p%%' <--- HERE -e 's%.*/mapper/[[:alpha:]]+[[:digit:]]+p([[:digit:]]+)$%1%' -e 's%.*/mapper/[[:alpha:]]+_[[:alpha:]]+([[:digit:]]+)$%1%' | grep -v '.*/mapper/.*'` ;; Marked " <--- HERE" showed the statements wrong. Proposed diff: --- grub-0.97/util/grub-install.in.org 2008-01-07 14:37:34.000000000 +0900 +++ grub-0.97/util/grub-install.in 2008-01-07 14:48:39.000000000 +0900 @@ -112,11 +112,11 @@ tmp_part=`echo "$1" | grep -v '/mapper/control$' | grep -v '/mapper/[[:alnum:]]\+-[[:alnum:]]\+$' | uniq | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \ - -e 's%.*d[0-9]*p%%' \ + -e 's%.*d[0-9]*p*%%' \ -e 's%.*/fd[0-9]*$%%' \ -e 's%.*/floppy/[0-9]*$%%' \ -e 's%.*/\(disc\|part\([0-9]*\)\)$%\2%' \ - -e 's%.*c[0-7]d[0-9]*p%%' \ + -e 's%.*c[0-7]d[0-9]*p*%%' \ -e 's%.*/mapper/[[:alpha:]]\+[[:digit:]]\+p\([[:digit:]]\+\)$%\1%' \ -e 's%.*/mapper/[[:alpha:]]\+_[[:alpha:]]\+\([[:digit:]]\+\)$%\1%' | grep -v '.*/mapper/.*'`