Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Mark Knecht
On Wed, May 21, 2008 at 11:13 AM, Neil Bothwick <[EMAIL PROTECTED]> wrote:
> On Wed, 21 May 2008 09:07:28 -0700, Mark Knecht wrote:
>
>> > dd if=/dev/sda bs=446 count=1 2>/dev/null | strings | grep GRUB
>
>>That single command would have saved me some heartache in the past.
>> I think it could be a good one-line addition to even something like
>> the Quick Install guide - I.e. "If you want to sanity check your grub
>> installation then run this command to ensure grub is located where you
>> think it's located..."
>
> You could check for all instances with
>
> for i in /dev/[hs]d*
> dd if=$i bs=446 count=1 2>/dev/null | strings | grep -q GRUB \
> && echo "GRUB found in $i"
>

This is great info. I know of one case a long time ago, maybe 2001 or
2002, where I used an older drive and got burned by a preexisting copy
of grub in the MBR conflicting with the version I had installed into a
specific partition. I kept thinking grub was working but doing the
wrong thing. I suspect that had I run some commands like the ones were
talking about here I would have found the problem. As it turned out I
didn't and went the direction of completely repartitioning the drive.
What a waste!

Cheers,
Mark
-- 
gentoo-user@lists.gentoo.org mailing list



Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Neil Bothwick
On Wed, 21 May 2008 09:07:28 -0700, Mark Knecht wrote:

> > dd if=/dev/sda bs=446 count=1 2>/dev/null | strings | grep GRUB

>That single command would have saved me some heartache in the past.
> I think it could be a good one-line addition to even something like
> the Quick Install guide - I.e. "If you want to sanity check your grub
> installation then run this command to ensure grub is located where you
> think it's located..."

You could check for all instances with

for i in /dev/[hs]d*
dd if=$i bs=446 count=1 2>/dev/null | strings | grep -q GRUB \
&& echo "GRUB found in $i"
 

-- 
Neil Bothwick

OS/2: Obsolete Soon, Too


signature.asc
Description: PGP signature


Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Mark Knecht
On Wed, May 21, 2008 at 8:31 AM, Neil Bothwick <[EMAIL PROTECTED]> wrote:
> On Wed, 21 May 2008 11:00:50 -0400, Allan Gottlieb wrote:
>
>> ajglap ~ # dd if=/dev/sda2 ibs=512 count=1 | od -c --address-radix=d
>
> dd if=/dev/sda bs=446 count=1 2>/dev/null | strings | grep GRUB
>
> Is clearer, add a partition number to check a partition.
>
>
> --
> Neil Bothwick

Neil,
   That single command would have saved me some heartache in the past.
I think it could be a good one-line addition to even something like
the Quick Install guide - I.e. "If you want to sanity check your grub
installation then run this command to ensure grub is located where you
think it's located..."

  Great info. thanks!

Cheers,
Mark
-- 
gentoo-user@lists.gentoo.org mailing list



Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Alan McKinnon
On Wednesday 21 May 2008, Mark Knecht wrote:

> I think this answer would be good to have on a Gentoo grub Wiki
> somewhere. (If it isn't already.) There have been times I've wondered
> the same thing and didn't know how to extract the data out fo the MBR
> the way you did. It would also be good to add a second example of how
> to get it out of a partition instead of the MBR in case grub is
> installed there.

I skipped over most of this thread, I now wished I hadn't :-) Not having 
the previous posts handy, this might already have been answered, but 
I'll go ahead anyway. The way I normally do the extraction is very 
simple:

from mbr:
dd if=/dev/sda of=/dev/pts/0 bs=512 count=1

from disk partition:
dd if=/dev/sda1 of=/dev/pts/0 bs=512 count=1

Change the of= appropriately, of course


-- 
Alan McKinnon
alan dot mckinnon at gmail dot com

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



Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Neil Bothwick
On Wed, 21 May 2008 11:00:50 -0400, Allan Gottlieb wrote:

> ajglap ~ # dd if=/dev/sda2 ibs=512 count=1 | od -c --address-radix=d

dd if=/dev/sda bs=446 count=1 2>/dev/null | strings | grep GRUB

Is clearer, add a partition number to check a partition.


-- 
Neil Bothwick

The trouble with the world is that everybody in it is three drinks behind.


signature.asc
Description: PGP signature


Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Allan Gottlieb
At Wed, 21 May 2008 07:12:32 -0700 Mark Knecht <[EMAIL PROTECTED]> wrote:

> I think this answer would be good to have on a Gentoo grub Wiki
> somewhere. (If it isn't already.) There have been times I've wondered
> the same thing and didn't know how to extract the data out fo the MBR
> the way you did. It would also be good to add a second example of how
> to get it out of a partition instead of the MBR in case grub is
> installed there.

Here is how to do it for a partition, in my case /dev/sda2 is the
active partition and it is a windows partition (remember that in grub
this would be (hd0,1), not sd and not 2).  Note that if `GRUB' is in
the boot block of a partition it does not mean it is not in the mbr.
However, there is no ambiguity when you check the mbr itself since
whatever is there counts.

ajglap ~ # dd if=/dev/sda2 ibs=512 count=1 | od -c --address-radix=d
1+0 records in
1+0 records out
512 bytes (512 B) copied000 353   R 220   N   T   F   S  \0 
002  \b  \0  \0
, 0.0234332 s, 21.8 kB/s
016  \0  \0  \0  \0  \0 370  \0  \0   ?  \0 377  \0  \0 200 001  \0
032  \0  \0  \0  \0 200  \0 200  \0 377 237 337 001  \0  \0  \0  \0
048  \0  \0  \f  \0  \0  \0  \0  \0 377 371 035  \0  \0  \0  \0  \0
064 366  \0  \0  \0 001  \0  \0  \0  \a   C 326 216   r 326 216 236
080  \0  \0  \0  \0 372   3 300 216 320 274  \0   | 373   h 300  \a
096 037 036   h   f  \0 313 210 026 016  \0   f 201   > 003  \0   N
112   T   F   S   u 025 264   A 273 252   U 315 023   r  \f 201 373
128   U 252   u 006 367 301 001  \0   u 003 351 322  \0 036 203 354
144 030   h 032  \0 264   H 212 026 016  \0 213 364 026 037 315 023
160 237 203 304 030 236   X 037   r 341   ; 006  \v  \0   u 333 243
176 017  \0 301   . 017  \0 004 036   Z   3 333 271  \0   + 310
192   f 377 006 021  \0 003 026 017  \0 216 302 377 006 026  \0 350
208   @  \0   + 310   w 357 270  \0 273 315 032   f   # 300   u   -
224   f 201 373   T   C   P   A   u   $ 201 371 002 001   r 036 026
240   h  \a 273 026   h   p 016 026   h  \t  \0   f   S   f   S   f
256   U 026 026 026   h 270 001   f   a 016  \a 315 032 351   j 001
272 220 220   f   ` 036 006   f 241 021  \0   f 003 006 034  \0 036
288   f   h  \0  \0  \0  \0   f   P 006   S   h 001  \0   h 020  \0
304 264   B 212 026 016  \0 026 037 213 364 315 023   f   Y   [   Z
320   f   Y   f   Y 037 017 202 026  \0   f 377 006 021  \0 003 026
336 017  \0 216 302 377 016 026  \0   u 274  \a 037   f   a 303 240
352 370 001 350  \b  \0 240 373 001 350 002  \0 353 376 264 001 213
368 360 254   <  \0   t  \t 264 016 273  \a  \0 315 020 353 362 303
384  \r  \n   A   d   i   s   k   r   e   a   d   e   r
400   r   o   r   o   c   c   u   r   r   e   d  \0  \r  \n   B
416   O   O   T   M   G   R   i   s   m   i   s   s   i   n
432   g  \0  \r  \n   B   O   O   T   M   G   R   i   s   c
448   o   m   p   r   e   s   s   e   d  \0  \r  \n   P   r   e   s
464   s   C   t   r   l   +   A   l   t   +   D   e   l   t
480   o   r   e   s   t   a   r   t  \r  \n  \0  \0  \0  \0  \0
496  \0  \0  \0  \0  \0  \0  \0  \0 200 235 262 312  \0  \0   U 252
512
ajglap ~ #


> Anyway, great info. Thanks!

You are welcome and thanks again to alan mckinnon for confirming my
guess.

allan (gottlieb)
-- 
gentoo-user@lists.gentoo.org mailing list



Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Mark Knecht
On Wed, May 21, 2008 at 7:08 AM, Allan Gottlieb <[EMAIL PROTECTED]> wrote:
> At Wed, 21 May 2008 15:31:23 +0200 Dirk Heinrichs <[EMAIL PROTECTED]> wrote:
>
>> Am Mittwoch, 21. Mai 2008 schrieb ext Allan Gottlieb:
>>
>>> This discussion is interesting and may well prove helpful.  But,
>>> unless I missed it, I didn't see an answer to my question, namely
>>
>> Although it was a little bit ironic, I gave it in my first reply.
>
> Thanks.  I thought so, but feared that my question might have been
> poorly written and suggested that I wanted to know which loader I had
> rather that where it was installed.
>
> Thanks again.
> allan

I think this answer would be good to have on a Gentoo grub Wiki
somewhere. (If it isn't already.) There have been times I've wondered
the same thing and didn't know how to extract the data out fo the MBR
the way you did. It would also be good to add a second example of how
to get it out of a partition instead of the MBR in case grub is
installed there.

Anyway, great info. Thanks!

Cheers,
Mark
-- 
gentoo-user@lists.gentoo.org mailing list



Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Allan Gottlieb
At Wed, 21 May 2008 15:31:23 +0200 Dirk Heinrichs <[EMAIL PROTECTED]> wrote:

> Am Mittwoch, 21. Mai 2008 schrieb ext Allan Gottlieb:
>
>> This discussion is interesting and may well prove helpful.  But,
>> unless I missed it, I didn't see an answer to my question, namely
>
> Although it was a little bit ironic, I gave it in my first reply.

Thanks.  I thought so, but feared that my question might have been
poorly written and suggested that I wanted to know which loader I had
rather that where it was installed.

Thanks again.
allan
-- 
gentoo-user@lists.gentoo.org mailing list



Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Dirk Heinrichs
Am Mittwoch, 21. Mai 2008 schrieb ext Allan Gottlieb:

> This discussion is interesting and may well prove helpful.  But,
> unless I missed it, I didn't see an answer to my question, namely

Although it was a little bit ironic, I gave it in my first reply.

> Am I correct in believing that seeing `GRUB' within the first 512
> bytes of /dev/sda (I have a one-hard-disk laptop) confirms my memory
> that I did install grub in the mbr (as opposed to the boot block of
> the active partition).

Yes.

Bye...

Dirk
-- 
Dirk Heinrichs  | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: [EMAIL PROTECTED]
Wanheimerstraße 68  | Web:  http://www.capgemini.com
D-40468 Düsseldorf  | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: wwwkeys.pgp.net


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Allan Gottlieb
At Wed, 21 May 2008 11:42:37 +0200 Dirk Heinrichs <[EMAIL PROTECTED]> wrote:

> Am Mittwoch, 21. Mai 2008 schrieb ext Neil Bothwick:
>> On Wed, 21 May 2008 10:53:28 +0200, Dirk Heinrichs wrote:
>> > > If you don't, the stage1 in your MBR may not work with the stage1.5
>> > > and stage2 in /boot. This happened with a recent GRUB update.
>> >
>> > Not to me.
>>
>> Aha, the old "works for me" defence :)
>
> No, it's the "couldn't happen to me because my /boot is mounted ro" defense.
>
> BTW: One doesn't really need to keep grub installed after writing the MBR. 
> Just unmerge it and your /boot and/or MBR are save.

This discussion is interesting and may well prove helpful.  But,
unless I missed it, I didn't see an answer to my question, namely

Am I correct in believing that seeing `GRUB' within the first 512
bytes of /dev/sda (I have a one-hard-disk laptop) confirms my memory
that I did install grub in the mbr (as opposed to the boot block of
the active partition).

thanks,
allan
-- 
gentoo-user@lists.gentoo.org mailing list



Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Dirk Heinrichs
Am Mittwoch, 21. Mai 2008 schrieb ext Neil Bothwick:
> On Wed, 21 May 2008 10:53:28 +0200, Dirk Heinrichs wrote:
> > > If you don't, the stage1 in your MBR may not work with the stage1.5
> > > and stage2 in /boot. This happened with a recent GRUB update.
> >
> > Not to me.
>
> Aha, the old "works for me" defence :)

No, it's the "couldn't happen to me because my /boot is mounted ro" defense.

BTW: One doesn't really need to keep grub installed after writing the MBR. 
Just unmerge it and your /boot and/or MBR are save.

Bye...

Dirk
-- 
Dirk Heinrichs  | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: [EMAIL PROTECTED]
Wanheimerstraße 68  | Web:  http://www.capgemini.com
D-40468 Düsseldorf  | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: wwwkeys.pgp.net


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Neil Bothwick
On Wed, 21 May 2008 10:53:28 +0200, Dirk Heinrichs wrote:

> > If you don't, the stage1 in your MBR may not work with the stage1.5
> > and stage2 in /boot. This happened with a recent GRUB update.  
> 
> Not to me.

Aha, the old "works for me" defence :)

It came up on this list very recently, where someone had to use a live CD
to fix GRUB after ignoring/missing the elog warnings.

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.


-- 
Neil Bothwick

Everything's back to normal. Damn.


signature.asc
Description: PGP signature


Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Dirk Heinrichs
Am Mittwoch, 21. Mai 2008 schrieb ext Neil Bothwick:
> On Wed, 21 May 2008 07:53:52 +0200, Dirk Heinrichs wrote:
> > > I believe that when I upgrade grub I am supposed to re-run it.
> >
> > Only if you want to upgrade your MBR too.
>
> If you don't, the stage1 in your MBR may not work with the stage1.5 and
> stage2 in /boot. This happened with a recent GRUB update.

Not to me.

Bye...

Dirk
-- 
Dirk Heinrichs  | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: [EMAIL PROTECTED]
Wanheimerstraße 68  | Web:  http://www.capgemini.com
D-40468 Düsseldorf  | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: wwwkeys.pgp.net


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] is grub in my mbr?

2008-05-21 Thread Neil Bothwick
On Wed, 21 May 2008 07:53:52 +0200, Dirk Heinrichs wrote:

> > I believe that when I upgrade grub I am supposed to re-run it.  
> 
> Only if you want to upgrade your MBR too.

If you don't, the stage1 in your MBR may not work with the stage1.5 and
stage2 in /boot. This happened with a recent GRUB update.


-- 
Neil Bothwick

DANGER! DANGER! Computer store ahead...hide wallet.


signature.asc
Description: PGP signature


Re: [gentoo-user] is grub in my mbr?

2008-05-20 Thread Dirk Heinrichs
Am Mittwoch, 21. Mai 2008 schrieb ext Allan Gottlieb:

> I believe that when I upgrade grub I am supposed to re-run it.

Only if you want to upgrade your MBR too.

> Am I right that seeing `GRUB' in bytes 383-386 (decimal) is proof that
> I did install grub in the MBR?

At least it isn't LiLo ;-)

Bye...

Dirk
-- 
Dirk Heinrichs  | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: [EMAIL PROTECTED]
Wanheimerstraße 68  | Web:  http://www.capgemini.com
D-40468 Düsseldorf  | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: wwwkeys.pgp.net


signature.asc
Description: This is a digitally signed message part.