Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 7892 - grub error
Summary: grub error
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Donny Davies (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-13 16:26 UTC by Maurizio Disimino
Modified: 2003-02-04 19:42 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maurizio Disimino 2002-09-13 16:26:22 UTC
sexybit grub # emerge grub
>>> emerge sys-apps/grub-0.90-r7 to /
>>> md5 ;-) grub-0.90.tar.gz
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
/dev/hdb3 on / type ext3 (rw)
[...]

sexybit root # emerge --debug grub
Calculating dependencies ...done!
>>> emerge sys-apps/grub-0.90-r7 to /
[...........]
>>> md5 ;-) grub-0.90.tar.gz
+ dyn_setup
+ pkg_setup
+ '[' / '!=' / ']'
++ grep /boot /etc/fstab
++ grep -v '^[ \t]*#'
+ '[' -z '' ']'
+ local myboot
++ cat /etc/fstab
++ grep -v '^#'
++ grep /boot
++ sed -e 's/^[^[:space:]]*[[:space:]]*\([^[:space:]]*\).*$/\1/'
+ myboot=
++ cat /proc/mounts
++ cut -f2 '-d '
++ grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
+ '[' ']'
+ mount
/dev/hdb3 on / type ext3 (rw)
[........]

This output is due to the pkg_setup() stuff in sys-apps/grub-0.90-r7
i.e. :

[ `cat /proc/mounts | cut -f2 -d" " | grep $myboot` ] && return 0
mount $myboot

I've not a /boot partition so $myboot is empty and the ^^^^ fails. 

*If $myboot is empty* we could safely assume that /boot is NOT 
a separate partition, avoid that 'errorr' stuff and provide a check.
Something like:

if [ -z $myboot ]; then
  einfo "Assuming you don't have a separate /boot partition. using /boot dir"
  [ -d /boot ] || mkdir /boot
fi

Maurizio aka j2ee
Comment 1 SpanKY gentoo-dev 2002-09-13 20:55:54 UTC
this is already taken into consideration ...
the problem is with this code ... notice the 'usage: grep' display ... 
basically whatever got passed to grep, grep did not like :)

please post your /etc/fstab

pkg_setup() {
        [ "$ROOT" != "/" ] && return 0
        #If the user doesn't have a /boot or /mnt/boot filesystem, skip.
        [ -z "`grep /boot /etc/fstab | grep -v "^[ \t]*#"`" ] || return 0
...
}
Comment 2 Maurizio Disimino 2002-09-14 03:32:49 UTC
well, the problem here is not with my fstab.
exactly, if you don't have a /boot line in /etc/fstab, and you're not
supposed to have one if your /boot isn't a separate partition,

myboot=`cat /etc/fstab | grep -v ^# | grep /boot | \
sed -e 's/^[^[:space:]]*[[:space:]]*\([^[:space:]]*\).*$/\1/'`

the ^^^^ stuff will result in an empty $myboot

and 'grep' in the following line will fail if $myboot is empty.

[ `cat /proc/mounts | cut -f2 -d" " | grep $myboot` ] 

Here's again, the verbose output of emerge grub.

++ grep /boot
++ sed -e 's/^[^[:space:]]*[[:space:]]*\([^[:space:]]*\).*$/\1/'
+ myboot=
++ cat /proc/mounts
++ cut -f2 '-d '
++ grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
Comment 3 SpanKY gentoo-dev 2002-09-14 10:57:55 UTC
im going to go ahead and say it might be your /etc/fstab :P
i say this because i have machines that dont have 'boot' anywhere in 
their /etc/fstab and emergeing grub is not a problem on them

so will you please post it ?
Comment 4 Maurizio Disimino 2002-09-15 03:54:05 UTC
You're right. What happened to me ( when you don't have a separate /boot part. )
will not prevent grub to be installed. However, we should avoid those msg to be
displayed. Instead of tweaking the grub ebuild, the solution might be 
woodchip's request in bug 7903.

I'll try to work on that eclass. (bug 7903)
Woodchip: please tell me if you've already started to work on that eclass.

Here's my poor fstab :)

/dev/hdb1       /mnt/new        ext3    defaults        0       2
/dev/hdb3       /               ext3    defaults        0       1
/dev/hdb2       none            swap    sw              0       2
/dev/cdroms/cdrom0      /mnt/cdrom      iso9660         noauto,ro       0 0
proc           /proc           proc            defaults        0 0

I'm marking this bug as dependent on 7903.
Comment 5 SpanKY gentoo-dev 2002-09-15 13:22:20 UTC
ok so the pkg_setup() has this error ... basically its is this:
        #If the user doesn't have a /boot or /mnt/boot filesystem, skip.
        [ -z "`grep /boot /etc/fstab | grep -v "^[ \t]*#"`" ] || return 0
i'm pretty sure that should be '&& return 0' and not '|| return 0'
Comment 6 Donny Davies (RETIRED) gentoo-dev 2002-09-29 20:35:08 UTC
mount-boot eclass should be in use now.