help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Legacy Grub restore with fresh MBR boot sector


From: Felix Miata
Subject: Re: Legacy Grub restore with fresh MBR boot sector
Date: Sat, 24 Mar 2018 22:28:22 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 SeaMonkey/2.49.2

Winston Smith composed on 2018-03-25 01:49 (UTC):
...
> since it's sitting in a USB dock for now. I got around this with grub-install 
> --recheck /dev/sdb, which updated /boot/grub/device.map, all 
> /boot/grub/*stage1_5 files, as well as /boot/grub/stage{1,2}. However, when I 
> tried to boot from it, it doesn't boot. All I get is a blank screen with 
> cursor in top left corner.

> So I used the grub shell directly:

> # grub
>>root (hd1,0)
>>setup (hd1)

> which printed some information, but no error. But it still doesn't boot, 
> there's still a blank screen with a cursor after POST.

> My questions:

> 1. The above grub commands seemed to have no impact at all in the first 
> sectors of the drive. All sectors 2 through 2047 are zeroed out even after 
> the grub commands above. Where should Legacy Grub's stage 1.5 be, assuming I 
> want to use stage 1.5 because Grub stage 2 sits on a ext3 FS?

> 2. What is /grub/stage1 on sdb1? It differs from the actual MBR on the drive 
> in so far as that it let its stage 2 pointer point to 0x01 0x00 0x00 0x00. 
> The actual MBR on disk points to some location from the old drive, see above. 
> I would have expected that the sequence of commands about would update that 
> pointer to point to an existing stage 1.5 (or stage 2?), or put stage 1.5 in 
> sector 2, and update the pointer to 0x01 0x00 0x00 0x00?

> 3. All put together: How can I get Legacy Grub to either put stage 1.5 to 
> disk, and update the stage 2 pointer in stage 1 to point to it, or update the 
> state 2 pointer in stage 1 directly to point at the existing /grub/stage2?

> 4. Could I just edit the stage 2 pointer manually in the MBR to achieve 3.)? 
> But would that work, given stage 2 lives on a file system? Or could I 
> manually dd a stage 1.5 file to sector 2 and following sectors, and update 
> the pointers manually?

I still use only Grub Legacy on MBR disks. And, I only configure them using the
Grub shell. And, I keep only legacy code in each MBR, and setup Grub on an EXTx
partition. And finally, the primary partition which will host Grub I set the
only boot flag on.

I would start with device.map. In it instead of mapping disk 0 and disk 1 as
/dev/sda and /dev/sdb I would map with their names in /dev/disks/by-id/* to be
sure setup works on the correct disk. Before running root and setup I always
find /boot/grub/stage1 to be sure these two will be operating on the correct
partitions.

As to where and whether stage 1.5 is needed I leave that up to the shell's setup
command to decide, e.g.:

1-configure device.map and boot flag appropriately
2-find /boot/grub/device.map
3-root (hd1,0)
4-setup (hd1,0)
5-remove target disk to its installed destination
6-enjoy successful boot
7-ensure device.map is consistent with the disk's physical location for a future
time setup might be needed
-- 
"Wisdom is supreme; therefore get wisdom. Whatever else you
get, get wisdom." Proverbs 4:7 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]