LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   grub stage2 file moved, can't boot (https://www.linuxquestions.org/questions/linux-general-1/grub-stage2-file-moved-cant-boot-670040/)

SpLaSh212 09-15-2008 10:00 AM

grub stage2 file moved, can't boot
 
hey guys,
according to grub's documentation:
Quote:

The difference between stage1 and *_stage1_5 is that the former doesn't understand any filesystem while the latter understands one filesystem (e.g. e2fs_stage1_5 understands ext2fs). So you can move the Stage 2 image to another location safely, even after GRUB has been installed.
from http://www.gnu.org/software/grub/man...es.html#Images

So I tried to move the stage2 file to another partition, I expected to get the grub cmd so I can find the stage2 file (with the 1.5 fs drivers) but when the system boots, it just hangs with the text "GRUB"

what didn't I understand correctly ?
thanks alot !

Midas7g 09-15-2008 12:51 PM

Not that I've ever tried this before, but the way the doc describes it, it sounds like GRUB is loaded using Stage 1, which picks a Stage 1.5 filesystem. This allows GRUB to read that filesystem, so then Stage 2 can exist in any filesystem and not have to be explicitly in any exact location.

Stage 1 (load GRUB) > Stage 1.5 (pick filesystem) > Stage 2 (load OS in selected filesystem)

Quote:

These are called Stage 1.5, because they serve as a bridge between stage1 and stage2, that is to say, Stage 1.5 is loaded by Stage 1 and Stage 1.5 loads Stage 2.
Since Stage 1.5 calls Stage 2, I would assume that you'd have to adjust a Stage 1.5 file to point to the new location of Stage 2. When the docs say that the Stage 2 file can be moved anywhere, I think it means it can reside anywhere, including inside a filesystem.

Quote:

While Stage 2 cannot generally be embedded in a fixed area as the size is so large, Stage 1.5 can be installed into the area right after an MBR, or the boot loader area of a ReiserFS or a FFS.
So, to summarize:
Stage 1 fits in the MBR and boots GRUB
Stage 1.5 fits either inside or just after the MBR (since it's so small)
Stage 2 can reside anywhere because Stage 1.5 points at it. Stage 2 can't fit in the MBR (or just after) because it is too big.

SpLaSh212 09-15-2008 01:56 PM

Quote:

Originally Posted by Midas7g (Post 3281165)
Stage 1 (load GRUB) > Stage 1.5 (pick filesystem) > Stage 2 (load OS in selected filesystem)

stage 1.5 is for file system type (ext, reiserfs,iso9660 etc.), so when u say that "load OS in selected filesystem" it doesn't sounds right, because what if I had 30 hard drives with ext fs ?
I don't think grub is gonna try to find the stage 2 in all of those disks...

Quote:

Since Stage 1.5 calls Stage 2, I would assume that you'd have to adjust a Stage 1.5 file to point to the new location of Stage 2. When the docs say that the Stage 2 file can be moved anywhere, I think it means it can reside anywhere, including inside a filesystem.
The problem with that sentence is that, first of all, the root command is the command that points to the right place of needed files (including stage2).
And second of all, when u delete stage1_5 files it doesn't stops boot..
The system just boots regularly

pixellany 09-15-2008 02:49 PM

I am getting a headache trying to follow this....

The way to avoid all this is to simply install** GRUB with the first "root" statement pointing to the correct partition--ie the one that contains the /boot/grub files, menu.lst, etc.. Once you have done that, don't try to relocate any GRUB elements, stages, etc.

The "booting" link below might be helpful.


**My reading and experience both favor the GRUB shell method (as opposed to grub-install).

SpLaSh212 09-16-2008 10:24 AM

Quote:

Originally Posted by pixellany (Post 3281279)
I am getting a headache trying to follow this....

The way to avoid all this is to simply install** GRUB with the first "root" statement pointing to the correct partition--ie the one that contains the /boot/grub files, menu.lst, etc.. Once you have done that, don't try to relocate any GRUB elements, stages, etc.

The "booting" link below might be helpful.


**My reading and experience both favor the GRUB shell method (as opposed to grub-install).

well, it's always easier to install from scratch ..
the real deal is to fix it :)

mostlyharmless 09-16-2008 01:56 PM

Well, then, to fix it, start the grub shell, use the "find" command to find your stage2 files and modify your menu.lst and you should be good to go.

SpLaSh212 09-17-2008 10:37 AM

Quote:

Originally Posted by mostlyharmless (Post 3282269)
Well, then, to fix it, start the grub shell, use the "find" command to find your stage2 files and modify your menu.lst and you should be good to go.

thats the problem... if stage2 file is moved, the grub shell isn't starting, it just says "GRUB" and hangs ..

mostlyharmless 09-17-2008 03:13 PM

Actually I was thinking of using the grub shell at the command prompt or with a boot disk such as SuperGrub, not the boot shell, which, as you point out, is disabled. SO... I'd get a SuperGrub disk, boot from it, and proceed. Or copy the files back to where they were and proceed.

Quote:

so when u say that "load OS in selected filesystem" it doesn't sounds right, because what if I had 30 hard drives with ext fs ?
I don't think grub is gonna try to find the stage 2 in all of those disks...
Since you know where you moved the stage2 files presumably you could just change menu.lst to point to the new location. The "find" command will indeed look in all 30 places. Don't know about the "not needing stage 1.5"; I think you'll only proceed with booting as normal under some cicumstances that way.

Maybe I'm just confused about the problem.


All times are GMT -5. The time now is 10:48 AM.