POV-Ray : Newsgroups : povray.off-topic : GRUB uglies Server Time
5 Nov 2024 18:26:33 EST (-0500)
  GRUB uglies (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Darren New
Subject: GRUB uglies
Date: 7 Nov 2008 23:42:35
Message: <491518bb$1@news.povray.org>
OK, quick summary of below:
Got SuSE 11 x64 installed on /dev/sda2, all one big primary partition. 
If I tar up all the files, zero out the partition, reformat it, and 
restore the files, how do I fix GRUB so that I can chainloader to 
partition 1 of disk 0 (aka /dev/sda2) and have GRUB boot?




So I have my new 64-bit computer, and I'm putting Linux (SuSE 11 x64)
and Vista on it, and I'm trying to figure out how to recover from
disaster. As in, the main drive fails and has to be replaced.

Vista makes this pretty easy. The drive ghosting works fabulously, and
you just slap the backup drive in and boot the CD and say "Here, put
that back."  If the boot sector's screwed, you can fix that too from the
recovery CD, with a bit of googling.  The file-at-a-time backup program
is really nice, except for the unacceptable glaring hole that MS put in
it, namely that it picks what file extensions it'll back up, and you
can't change that. Sheesh. Yes, really, I want to back up both PHP files
*and* executables, thanks.  Oh well.  Easy enough to script around if
you need per-file backups (assuming you can find the 64-bit versions of
some of the utilities, which was another hour of hunting, since they're 
not labeled with bit size).

Anyway, on to GRUB.  I put Vista in the first partition, and Linux in
the second. Install works fine. I "dd" the boot sector off /dev/sda2 and
copy it to Vista and set up Vista to give me the choice of what to boot.
Picking Linux from Vista gives me the Grub menu. Cool.

Now I boot the Linux rescue CD, mount /dev/sda2 on /tmp/root and my
backup drive on /tmp/back, and then
   cd /tmp/root ; tar cvfzp /tmp/back/linux.tgz .
All goes well.

Now the test:  Wipe the drive to zeros, restore vista (which restores
the partition table since it isn't there), and then use the Linux rescue
  CD to do the following:
   mkfs.ext3 -L SUSE /dev/sda2
   mount /dev/sda2 /tmp/root
   cd /tmp/root
   tar xvfzp /tmp/back/linux.tgz
All the stuff restores correctly.

Now, at this point, I've been unable to get GRUB to do its thing.

grub
   device (hd0) /dev/sda
   root (hd0,1)
   setup (hd0)

This leaves me with a system that when I boot it, just says "GRUB" or
basically never gets anywhere close to the menu or booting.  Using "dd"
to put the boot sector back (from a copy on the backup drive) before or
after doesn't help either.

The partition type is indeed 0x83.

Using the repair option and telling it to repair the boot system leaves
me with a boot menu that doesn't match what I backed up, and boots me
into a text console with an apparently passworded root account. F'ing weird.

Never had this problem with SuSE 10 x86. That was very straightforward
once I figured out GRUB was hiding information outside the file system
and had to be reset. (Or, rather, that it was encoding parts of the file 
system into executable files, or whatever it's doing.)

Any suggestions on what to try?

-- 
Darren New / San Diego, CA, USA (PST)


Post a reply to this message

From: Fredrik Eriksson
Subject: Re: GRUB uglies
Date: 8 Nov 2008 06:09:10
Message: <op.ukarxkam7bxctx@e6600.bredbandsbolaget.se>
On Sat, 08 Nov 2008 05:42:35 +0100, Darren New <dne### [at] sanrrcom> wrote:
>
> Now, at this point, I've been unable to get GRUB to do its thing.
>
> grub
>    device (hd0) /dev/sda
>    root (hd0,1)
>    setup (hd0)
>
> This leaves me with a system that when I boot it, just says "GRUB" or
> basically never gets anywhere close to the menu or booting.  Using "dd"
> to put the boot sector back (from a copy on the backup drive) before or
> after doesn't help either.

I think you may have to chroot into the Linux installation before setting  
up GRUB if the installed version is not the same as the one on the CD.  
GRUB will crap out if stage1 and stage2 are from different versions.

You did not show the contents of grub.conf, so we will just have to assume  
it is correct.


It is not clear to me exactly what you are trying to accomplish. Do you  
want GRUB to chain-load Vista, or do you want the Vista loader to  
chain-load GRUB?



-- 
FE


Post a reply to this message

From: Darren New
Subject: Re: GRUB uglies
Date: 8 Nov 2008 11:45:16
Message: <4915c21c$1@news.povray.org>
Fredrik Eriksson wrote:
> I think you may have to chroot into the Linux installation before 
> setting up GRUB if the installed version is not the same as the one on 
> the CD. GRUB will crap out if stage1 and stage2 are from different 
> versions.

Hmmm. Fair enough. But I didn't do any updates on at least some of the 
tests, so I'm assuming the two versions were the same.

> You did not show the contents of grub.conf, so we will just have to 
> assume it is correct.

I didn't touch it, other than to copy it to a tar file and back. No 
manual editing at all.

> It is not clear to me exactly what you are trying to accomplish. Do you 
> want GRUB to chain-load Vista, or do you want the Vista loader to 
> chain-load GRUB?

I want Vista to chain-load GRUB. (More precisely, I want Vista to chain 
load Linux, but LILO wasn't happy either.)  I can do it easily when I 
first install Linux, but if I get into a situation with an unrecoverable 
error (dead hard drive, user screw-up, etc) where I have to restore from 
backups, I can't get Linux to boot again.

Having GRUB chain-load Vista would be acceptable too. If the Linux gets 
screwed up, I have the tools on bootable CD to fix stuff to boot 
directly into the Vista partition, so I could back up anything I hadn't 
backed up there if I screw up GRUB, for example. But I need to be able 
to recover from a crash that makes the partition unbootable.

-- 
Darren New / San Diego, CA, USA (PST)


Post a reply to this message

From: Fredrik Eriksson
Subject: Re: GRUB uglies
Date: 8 Nov 2008 12:15:27
Message: <op.uka8v0qw7bxctx@e6600.bredbandsbolaget.se>
On Sat, 08 Nov 2008 17:45:16 +0100, Darren New <dne### [at] sanrrcom> wrote:
> Fredrik Eriksson wrote:
>> I think you may have to chroot into the Linux installation before  
>> setting up GRUB if the installed version is not the same as the one on  
>> the CD. GRUB will crap out if stage1 and stage2 are from different  
>> versions.
>
> Hmmm. Fair enough. But I didn't do any updates on at least some of the  
> tests, so I'm assuming the two versions were the same.

The version that gets installed from the CD might not be the same as the  
one installed *on* the CD.


> I want Vista to chain-load GRUB. (More precisely, I want Vista to chain  
> load Linux, but LILO wasn't happy either.)

Personally I use grub4dos for that. That way, I do not need to change  
anything on the Windows side when I update GRUB on the Linux side. Not  
sure how well it works with Vista though; setting it up on XP is trivial.

Also, should you not be doing "setup (hd0,1)" if you want to chain-load  
 from the Vista boot-loader?



-- 
FE


Post a reply to this message

From: Darren New
Subject: Re: GRUB uglies
Date: 8 Nov 2008 12:22:45
Message: <4915cae5@news.povray.org>
Fredrik Eriksson wrote:
> The version that gets installed from the CD might not be the same as the 
> one installed *on* the CD.

Good point, good point. I never ran into that before, but you could be 
right there.

> Personally I use grub4dos for that. That way, I do not need to change 
> anything on the Windows side when I update GRUB on the Linux side. 

Unless GRUB rewrites the per-sector partition, I don't need to change 
anything on the Vista side either. I didn't have trouble changing, for 
example, the menus, IIRC.  I'll check it out.

There's also a program called EditBCD or some such that can install a 
variety of boot loaders. I was just trying to do it all with native code.

> Also, should you not be doing "setup (hd0,1)" if you want to chain-load 
> from the Vista boot-loader?

Should I?  What GRUB actually does when it sets up is still kind of 
mysterious to my. I'm basing my commands on what I did when I set up a 
bunch of 32-bit machines at work - after restoring the dump, the script 
ran those grub commands and then it would boot. (Well, not exactly, 
because it was a RAID at work, so it had to do it with two different 
devices as root.)

I'll try it with setup (hd0,1) next, and with a chroot first. Thanks for 
the advice!

-- 
Darren New / San Diego, CA, USA (PST)


Post a reply to this message

From: Fredrik Eriksson
Subject: Re: GRUB uglies
Date: 8 Nov 2008 12:35:38
Message: <op.uka9tnk07bxctx@e6600.bredbandsbolaget.se>
On Sat, 08 Nov 2008 18:22:44 +0100, Darren New <dne### [at] sanrrcom> wrote:
>> Personally I use grub4dos for that. That way, I do not need to change  
>> anything on the Windows side when I update GRUB on the Linux side.
>
> Unless GRUB rewrites the per-sector partition, I don't need to change  
> anything on the Vista side either. I didn't have trouble changing, for  
> example, the menus, IIRC.  I'll check it out.

Changing the config is not a problem. Updating GRUB to a newer version is.  
Anytime you re-setup the GRUB boot-loader you have to update the copy you  
keep on the Windows side.

>> Also, should you not be doing "setup (hd0,1)" if you want to chain-load  
>> from the Vista boot-loader?
>
> Should I?  What GRUB actually does when it sets up is still kind of  
> mysterious to my.

"setup (hd0)" installs GRUB to the MBR of hd0, i.e. it overwrites the  
first stage of the Vista boot-loader. If you want to chain-load Linux, you  
should install GRUB to the boot sector of the Linux boot partition.



-- 
FE


Post a reply to this message

From: Darren New
Subject: Re: GRUB uglies
Date: 8 Nov 2008 12:44:51
Message: <4915d013$1@news.povray.org>
Fredrik Eriksson wrote:
> Changing the config is not a problem. Updating GRUB to a newer version 
> is. Anytime you re-setup the GRUB boot-loader you have to update the 
> copy you keep on the Windows side.

Yes, that I'm aware of. Fortunately easy to fix from the SuSE rescue 
disk, if it updates and I don't notice.

> "setup (hd0)" installs GRUB to the MBR of hd0, i.e. it overwrites the 
> first stage of the Vista boot-loader. If you want to chain-load Linux, 
> you should install GRUB to the boot sector of the Linux boot partition.

Mwa ha!  Very good!  Thanks!  I'll give that a try as soon as I get 
stuff reinstalled. :-)

{I guess I should have put off the wipe until I got an answer. ;-)

-- 
Darren New / San Diego, CA, USA (PST)


Post a reply to this message

From: Darren New
Subject: Re: GRUB uglies
Date: 8 Nov 2008 14:33:49
Message: <4915e99d$1@news.povray.org>
Darren New wrote:
> Mwa ha!  Very good!  Thanks!  I'll give that a try as soon as I get 
> stuff reinstalled. :-)

Using setup (hd0,1) seems to have done the trick. Thanks!

I can't chroot, since /tmp/root/dev doesn't seem to be set up, but that 
shouldn't be much of a problem, methinks. I wouldn't think grub gets 
updated incompatibly very often. :-)  Given that it's pretty trivial to 
back up every file on a partition under Linux and to frob the results 
off a live or rescue CD, I don't expect even a disaster where I have to 
reinstall would be that much of a problem.

Thanks for the clue!

-- 
Darren New / San Diego, CA, USA (PST)


Post a reply to this message

From: Jim Henderson
Subject: Re: GRUB uglies
Date: 8 Nov 2008 15:00:43
Message: <4915efeb$1@news.povray.org>
On Sat, 08 Nov 2008 12:09:10 +0100, Fredrik Eriksson wrote:

> I think you may have to chroot into the Linux installation before
> setting up GRUB if the installed version is not the same as the one on
> the CD. GRUB will crap out if stage1 and stage2 are from different
> versions.

Yeah, I would concur with that - have had that experience myself.

Jim


Post a reply to this message

From: Darren New
Subject: Re: GRUB uglies
Date: 9 Nov 2008 13:00:23
Message: <49172537@news.povray.org>
Jim Henderson wrote:
> Yeah, I would concur with that - have had that experience myself.

My stumbling block here is that if I use chroot, I no longer have /dev 
for GRUB to write things to. If it comes to that much of a disaster, 
I'll reinstall stuff and rescue things on a per-file/per-directory 
basis. :-)

-- 
Darren New / San Diego, CA, USA (PST)


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.