Gentoo Archives: gentoo-user

From: Hans-Werner Hilse <hilse@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] grub hell
Date: Wed, 14 Nov 2007 23:26:17
Message-Id: 20071115002045.f256d54a.hilse@web.de
In Reply to: Re: [gentoo-user] grub hell by maxim wexler
1 Hi,
2
3 On Wed, 14 Nov 2007 13:27:49 -0800 (PST)
4 maxim wexler <blissfix@×××××.com> wrote:
5
6 > > the only option seems to be to properly install grub
7 > > to the first HD.
8 >
9 > grub-install /dev/hda renders the PC completely
10 > unusable
11
12 Hm, yeah, that's why I generally distrust running grub from within an
13 booted OS: You can't be sure that the setting is anywhere near what
14 happens before the OS got loaded (e.g. no ACPI kicking in yet, BIOS
15 "disk drivers"...).
16
17 > > I would start with a grub floppy disk or boot
18 > > CD(-RW) and look what
19 >
20 > Both drives are bootable provided I make a detour to
21 > the BIOS and change the boot order.
22
23 Somehow I suspect that the BIOS gets something wrong when you change
24 the boot order. But that's just a suspicion. So my suggestion was to
25 change it to "default" (first HD first). Then check from a grub running
26 from floppy or CDRW what that can see. So you can try if my suspicion
27 is wrong, what might well be the case: That grub (from floppy or CD)
28 will only see one drive, too, if I'm wrong. Otherwise you know that I
29 was probably right and your only option then is to leave the BIOS boot
30 order untouched.
31
32 > > devices that sees when booting. In order to have
33 > > grub list disks, you
34 >
35 > dmesg reports ALL drives and appropriate partitions.
36
37 But that is what _Linux_ sees. Linux has its own drivers, working
38 completely independent from what the BIOS was doing before -- and
39 that's what a grub (at boot stage) has to rely on. So Linux' output
40 only tells us that generally:
41 - your drives are OK, the cabling too.
42 - your controllers are working.
43
44 But we need to make sure the BIOS initializes everything right. It
45 might not do so if boot order is changed (and from a certain point of
46 view, that might actually be a "feature").
47
48 > > enter "root (" and press TAB. The same goes for
49 > > partitions after the
50 > > setting device and a comma (e.g. "(hd0," + TAB).
51 >
52 > Now this is really wierd. When I'm at the prompt using
53 > the grub that appears when the PC boots, ie when the
54 > second drive is given preference in BIOS, tab
55 > completion reports only a string of fdn's followed by
56 > hd0. But, when having booted and logged in, I issue
57 > the grub command, tab completion reports possible
58 > disks as hd0 and hd1 as it should. And it correctly
59 > sees the "unknown" partition on /dev/hda and the four
60 > linux partitions on /dev/hdc. But that's with
61 > device.map like so: (fd0) /dev/fd0
62 > (hd0) /dev/hda
63 > (hd2) /dev/hdc
64 > ^!?!?
65
66 It might be that the second HD is just (hd1). Grub doesn't necessarily
67 follow the kernel way of enumeration. But then again, don't rely on
68 what grub tells when run with an loaded OS.
69
70 > > If all devices are seen, then set root (as indicated
71 > > above) to the
72 > > partition holding the grub stages (i.e. partition of
73 > > /boot in Gentoo
74 > > or /lib/grub/i386-pc/). Then have grub write the MBR
75 > > using
76 > > "setup (hd0)". Note that this will overwrite the
77 > > Windows MBR, which
78 > > will make it unbootable at that point. So better
79 >
80 > OK, this throws me. Isn't it supposed to be bootable?
81
82 Oh, the Windows MBR is just giving control to the boot block of the
83 partition holding Windows, which itself then stages ntldr. So when I
84 said it'll make it unbootable, I was talking about the Windows MBR.
85 Grub should run anyway nevertheless, and then it should be able to give
86 control to the Windows partition boot block -- but I was just giving a
87 warning that what definately happens is that the Windows MBR is gone.
88
89 > There's more...
90 >
91 > I followed the instructions here:
92 >
93 > http://gentoo-wiki.com/HOWTO_Dual_Boot_from_Windows_Bootloader_(NTLDR)_and_why
94 >
95 > And, provided I'm booting from /dev/hda, I'm presented
96 > with two choices, Gentoo and XP. XP boots OK but
97 > gentoo halts at:
98 >
99 > GRUB Loading stage1.5
100 >
101 > GRUB loading, please wait...
102 > Error 21
103 >
104 > even though the boot routine is identical to the one
105 > that WORKS when the second drive is given boot
106 > preference.
107
108 Personally, I don't see much difference, this approach shares similar
109 problems. Apropos problem, error 21 is "Selected disk does not exist".
110 I think it might have happened because you probably switched drive
111 order again when doing the Linux based steps descibed in the link
112 you've give. When the MBR is written, it stores references to the stage
113 files. They might point to an invalid location if you change the boot
114 order back again. That's what I think why you're seeing this error.
115
116 Grub can perfectly from a floppy disk. See "info grub" (the full grub
117 documentation, the man page is crap) in order to learn how to create a
118 grub floppy disk (or CD/R(W)). You will then be able to set the BIOS
119 boot order to default and see what a freshly booted grub sees then.
120 >From within the grub booted this way, you can order grub to setup
121 itself to an MBR or boot block. Basically, you have to set "root", then
122 issue "setup". The first takes the device of the stage files as
123 argument, the latter the target disk (or partition).
124
125 After being through this "grub hell", at least will have learnt a lot
126 about broken BIOSes and different boot stages of today's PC hardware (a
127 lot of ancient compatibility bullshit).
128
129 -hwh
130 --
131 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] grub hell maxim wexler <blissfix@×××××.com>