Bug 429187 - grub-install does not work on /dev/cciss/c0d0 (MBR)
Summary: grub-install does not work on /dev/cciss/c0d0 (MBR)
Keywords:
Status: CLOSED DUPLICATE of bug 402151
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: grub
Version: 5.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-01-17 20:12 UTC by Flavio Leitner
Modified: 2008-02-04 19:52 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-02-04 19:52:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Flavio Leitner 2008-01-17 20:12:54 UTC
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/.*'`

Comment 3 RHEL Program Management 2008-01-25 02:15: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
release.

Comment 4 Peter Jones 2008-02-04 19:52:33 UTC

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


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