[gentoo-user] Re: grub weirdness

2008-05-08 Thread »Q«
On Wed, 07 May 2008 12:13:47 +0200
Sven Köhler [EMAIL PROTECTED] wrote:

   To avoid automounting and autoinstalling with /boot,
   just export the DONT_MOUNT_BOOT variable.  
 
 Which /boot partition? I don't have any ...

I believe you've already avoided it being mounted, then.  :)


--
gentoo-user@lists.gentoo.org mailing list



[gentoo-user] Re: grub weirdness

2008-05-07 Thread Sven Köhler

 To avoid automounting and autoinstalling with /boot,
 just export the DONT_MOUNT_BOOT variable.


Which /boot partition? I don't have any ...


If there's a setup-command in your grub.conf, it is indeed executed.
So if that command is outdated (something you won't notice, since that
command is not used by grub in any situation i know), the ebuild will
execute that setup-command and write to some device's boot sector. How
evil, again!

Regards,
  Sven

P.S.: here's the code from grub-0.97-r5.ebuild:

if [[ -e ${dir}/grub.conf ]] ; then
egrep \
-v
'^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)'
\
${dir}/grub.conf | \
/sbin/grub --batch \
--device-map=${dir}/device.map \
 /dev/null
fi 

And following the code of the functions which does the job:
found in ebuild: /usr/portage/sys-boot/grub/grub-0.97-r5.ebuild

setup_boot_dir() {
local boot_dir=$1
local dir=${boot_dir}

[[ ! -e ${dir} ]]  die ${dir} does not exist!
[[ ! -L ${dir}/boot ]]  ln -s . ${dir}/boot
dir=${dir}/grub
if [[ ! -e ${dir} ]] ; then
mkdir ${dir} || die ${dir} does not exist!
fi

# change menu.lst to grub.conf
if [[ ! -e ${dir}/grub.conf ]]  [[ -e ${dir}/menu.lst ]] ; then
mv -f ${dir}/menu.lst ${dir}/grub.conf
ewarn
ewarn *** IMPORTANT NOTE: menu.lst has been renamed to grub.conf
ewarn
fi

if [[ -e ${dir}/stage2 ]] ; then
mv ${dir}/stage2{,.old}
ewarn *** IMPORTANT NOTE: you must run grub and install
ewarn the new version's stage1 to your MBR.  Until you do,
ewarn stage1 and stage2 will still be the old version, but
ewarn later stages will be the new version, which could
ewarn cause problems such as an unbootable system.
ebeep
fi

einfo Copying files from /lib/grub and /usr/lib/grub to ${dir}
for x in ${ROOT}/lib*/grub/*/* ${ROOT}/usr/lib*/grub/*/* ; do
[[ -f ${x} ]]  cp -p ${x} ${dir}/
done

if [[ -e ${dir}/grub.conf ]] ; then
egrep \
-v
'^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)'
\
${dir}/grub.conf | \
/sbin/grub --batch \
--device-map=${dir}/device.map \
 /dev/null
fi

# the grub default commands silently piss themselves if
# the default file does not exist ahead of time
if [[ ! -e ${dir}/default ]] ; then
grub-set-default --root-directory=${boot_dir} default
fi
}


How you can see isn't the message piped to /dev/null, only
the command /sbin/grub -batch -device-map


Why should i worry about the message being piped to /dev/null?

I worry about a message saying you have to do it by hand although some 
harmful magic is going on behind the scenes (the egrep+grub command) 
although we are not informed about it (command is piped to /dev/null, 
not message about it, etc.).




signature.asc
Description: OpenPGP digital signature


[gentoo-user] Re: grub weirdness

2008-05-06 Thread Sven Köhler

When you emerged grub-0.97-r5, this was displayed on your console:
WARN: postinst
*** IMPORTANT NOTE: you must run grub and install
the new version's stage1 to your MBR.  Until you do,
stage1 and stage2 will still be the old version, but
later stages will be the new version, which could
cause problems such as an unbootable system.


Yes, the ebuild writes that to the screen.

But silently, in the background (because every output is piped to 
/dev/null - how evil!), the ebuild calls grub with some commands inside 
your grub.conf.


If there's a setup-command in your grub.conf, it is indeed executed. So 
if that command is outdated (something you won't notice, since that 
command is not used by grub in any situation i know), the ebuild will 
execute that setup-command and write to some device's boot sector. How 
evil, again!


Regards,
  Sven

P.S.: here's the code from grub-0.97-r5.ebuild:

if [[ -e ${dir}/grub.conf ]] ; then
egrep \
-v 
'^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)' 
\

${dir}/grub.conf | \
/sbin/grub --batch \
--device-map=${dir}/device.map \
 /dev/null
fi




signature.asc
Description: OpenPGP digital signature


Re: [gentoo-user] Re: grub weirdness

2008-05-06 Thread Wolf Canis
Sven Köhler wrote:
 When you emerged grub-0.97-r5, this was displayed on your console:
 WARN: postinst
 *** IMPORTANT NOTE: you must run grub and install
 the new version's stage1 to your MBR.  Until you do,
 stage1 and stage2 will still be the old version, but
 later stages will be the new version, which could
 cause problems such as an unbootable system.

 Yes, the ebuild writes that to the screen.

 But silently, in the background (because every output is piped to
 /dev/null - how evil!), the ebuild calls grub with some commands
 inside your grub.conf.

I just updated grub to version 0.97-r5 and this was,
at the end, displayed:

 To avoid automounting and autoinstalling with /boot,
 just export the DONT_MOUNT_BOOT variable.


 Your boot partition was not mounted as /boot, but portage
 was able to mount it without additional intervention.
 Files will be installed there for grub to function correctly.

 *** IMPORTANT NOTE: you must run grub and install
 the new version's stage1 to your MBR.  Until you do,
 stage1 and stage2 will still be the old version, but
 later stages will be the new version, which could
 cause problems such as an unbootable system.
 Copying files from /lib/grub and /usr/lib/grub to //boot/grub
 To install grub files to another device (like a usb stick), just run:
emerge --config =grub-0.97-r5


 If there's a setup-command in your grub.conf, it is indeed executed.
 So if that command is outdated (something you won't notice, since that
 command is not used by grub in any situation i know), the ebuild will
 execute that setup-command and write to some device's boot sector. How
 evil, again!

 Regards,
   Sven

 P.S.: here's the code from grub-0.97-r5.ebuild:

 if [[ -e ${dir}/grub.conf ]] ; then
 egrep \
 -v
 '^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)'
 \
 ${dir}/grub.conf | \
 /sbin/grub --batch \
 --device-map=${dir}/device.map \
  /dev/null
 fi 
And following the code of the functions which does the job:
found in ebuild: /usr/portage/sys-boot/grub/grub-0.97-r5.ebuild

setup_boot_dir() {
local boot_dir=$1
local dir=${boot_dir}

[[ ! -e ${dir} ]]  die ${dir} does not exist!
[[ ! -L ${dir}/boot ]]  ln -s . ${dir}/boot
dir=${dir}/grub
if [[ ! -e ${dir} ]] ; then
mkdir ${dir} || die ${dir} does not exist!
fi

# change menu.lst to grub.conf
if [[ ! -e ${dir}/grub.conf ]]  [[ -e ${dir}/menu.lst ]] ; then
mv -f ${dir}/menu.lst ${dir}/grub.conf
ewarn
ewarn *** IMPORTANT NOTE: menu.lst has been renamed to grub.conf
ewarn
fi

if [[ -e ${dir}/stage2 ]] ; then
mv ${dir}/stage2{,.old}
ewarn *** IMPORTANT NOTE: you must run grub and install
ewarn the new version's stage1 to your MBR.  Until you do,
ewarn stage1 and stage2 will still be the old version, but
ewarn later stages will be the new version, which could
ewarn cause problems such as an unbootable system.
ebeep
fi

einfo Copying files from /lib/grub and /usr/lib/grub to ${dir}
for x in ${ROOT}/lib*/grub/*/* ${ROOT}/usr/lib*/grub/*/* ; do
[[ -f ${x} ]]  cp -p ${x} ${dir}/
done

if [[ -e ${dir}/grub.conf ]] ; then
egrep \
-v
'^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)'
\
${dir}/grub.conf | \
/sbin/grub --batch \
--device-map=${dir}/device.map \
 /dev/null
fi

# the grub default commands silently piss themselves if
# the default file does not exist ahead of time
if [[ ! -e ${dir}/default ]] ; then
grub-set-default --root-directory=${boot_dir} default
fi
}


How you can see isn't the message piped to /dev/null, only
the command /sbin/grub -batch -device-map

Have fun,
W. Canis




signature.asc
Description: OpenPGP digital signature


[gentoo-user] Re: grub weirdness [solved]

2008-05-06 Thread »Q«
Peter Ruskin [EMAIL PROTECTED] wrote:

 On Wednesday 07 May 2008, »Q« wrote:
  Earlier today, I emerged grub-0.97-r5 on my x86 laptop, replacing
  0.97-r4. I didn't run grub and didn't expect anything to be done
  to my boot partition. Now I've read
  http://bugs.gentoo.org/show_bug.cgi?id=218599, and I suspect my
  current problem has to do with that, though I don't recall
  anything in grub.conf that would lead to trouble.
 
  I can't access the boot partition right now, and I'm posting this
  in hopes of pointers for what to look at once I get the chance to
  boot from a livecd.
 
  When I try to boot, the word GRUB gets written to the screen over
  and over and over, filling the screen.  Pressing keys, AFAICT so
  far, doesn't stop this.  The screen is just filled with GRUB,
  and I think it's an ongoing thing because of a little flicker at
  the bottom right.
 
 When you emerged grub-0.97-r5, this was displayed on your console:
 WARN: postinst
 *** IMPORTANT NOTE: you must run grub and install
 the new version's stage1 to your MBR.  Until you do,
 stage1 and stage2 will still be the old version, but
 later stages will be the new version, which could
 cause problems such as an unbootable system.

Thanks.  I had assumed (d'oh!) that I could wait and read the elog if I
ever decided to install the new grub to my boot partition.  I'm not so
happy with the boot partition being mounted and screwed with by the
ebuild, especially given I was using a grub from Fedora, not Gentoo.
Now I've got DONT_MOUNT_BOOT=yes in make.conf, so I should never have
this kind of problem again.

Once I booted a livecd, running the setup command within grub fixed
the problem.  Then once I booted Gentoo, I did it again, to get
whatever goodness is in this latest revision.

 To make life easier for situations like this, you could install grub 
 on a floppy.

Even if I had a floppy drive, I'm not sure portage wouldn't find the
floppy and overwrite it.  ;)

I usually have a livecd or two in my bag, but of course not when I most
need one.


--
gentoo-user@lists.gentoo.org mailing list