* grub-probe fails to find PC partition due to Apple disklabel
@ 2008-04-13 21:34 Chris Knadle
2008-04-14 12:07 ` Robert Millan
0 siblings, 1 reply; 21+ messages in thread
From: Chris Knadle @ 2008-04-13 21:34 UTC (permalink / raw)
To: The development of GRUB 2
Greetings.
I've run into an interesting problem on a PC running Debian Sid (Linux)
where grub-probe fails to find partitions on the first hard disk because it
finds an Apple disklabel, causing the 'update-grub' program to fail and thus
not allow installing a new Linux kernel. [The drive may at one time been in
an Apple or in an external drive enclosure used by both Apple and PC's
running Linux.] The latest grub on Debian Sid now uses grub2 code for the
grub-common package, so even though the bug report is for grub 0.97-36, it's
using grub2 code.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=475718
As far as I can tell, (and forgive me if my terminology is slightly off),
this boils down to the question of how to handle the situation where a disk
has multiple disklabels / partition maps from different architectures but
only has allocated partitions in one of the partition maps.
Is there, or can we think of, a good way of handling this?
-- Chris
--
Chris Knadle
Chris.Knadle@coredump.us
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-04-13 21:34 grub-probe fails to find PC partition due to Apple disklabel Chris Knadle
@ 2008-04-14 12:07 ` Robert Millan
2008-04-14 14:21 ` Chris Knadle
0 siblings, 1 reply; 21+ messages in thread
From: Robert Millan @ 2008-04-14 12:07 UTC (permalink / raw)
To: The development of GRUB 2
On Sun, Apr 13, 2008 at 05:34:50PM -0400, Chris Knadle wrote:
> Greetings.
>
> I've run into an interesting problem on a PC running Debian Sid (Linux)
> where grub-probe fails to find partitions on the first hard disk because it
> finds an Apple disklabel, causing the 'update-grub' program to fail and thus
> not allow installing a new Linux kernel. [The drive may at one time been in
> an Apple or in an external drive enclosure used by both Apple and PC's
> running Linux.] The latest grub on Debian Sid now uses grub2 code for the
> grub-common package, so even though the bug report is for grub 0.97-36, it's
> using grub2 code.
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=475718
>
> As far as I can tell, (and forgive me if my terminology is slightly off),
> this boils down to the question of how to handle the situation where a disk
> has multiple disklabels / partition maps from different architectures but
> only has allocated partitions in one of the partition maps.
>
> Is there, or can we think of, a good way of handling this?
Hi Chris,
Initially, all partmaps were arch-specific, so that "pc" arch had msdos
and gpt partmaps, etc. This avoided the problem; so maybe what we could do
is probe for "native" partmaps first, and then for all the rest? I can think
of two ways of doing this:
- Explicitly probe for native partmaps for each arch (#ifdef MACHINE_BIOS,
etc), then probe for all. This is ugly and also inefficient (some partmaps
are probed twice).
- Change the partmap order in partmap.lst (can be complicated because of the
build system), and make the prober follow the order in that file. But, uhm,
how would we access the file in the first place, before partmaps are probed?
How does it work _now_ actually?
another way would be to add sanity checks in the prober, so that a partmap is
never identified as "good" when one of its partitions are out of bounds or so.
But then again:
- Failing completely for an otherwise perfectly-sane partmap just because one
partition is out of bounds sounds like a bad idea.
- It doesn't completely fix the problem anyway.
Comments?
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-04-14 12:07 ` Robert Millan
@ 2008-04-14 14:21 ` Chris Knadle
2008-04-14 17:20 ` Pavel Roskin
0 siblings, 1 reply; 21+ messages in thread
From: Chris Knadle @ 2008-04-14 14:21 UTC (permalink / raw)
To: The development of GRUB 2
On Monday 14 April 2008, Robert Millan wrote:
> Hi Chris,
>
> Initially, all partmaps were arch-specific, so that "pc" arch had msdos
> and gpt partmaps, etc. This avoided the problem; so maybe what we could
> do is probe for "native" partmaps first, and then for all the rest? I can
> think of two ways of doing this:
>
> - Explicitly probe for native partmaps for each arch (#ifdef
> MACHINE_BIOS, etc), then probe for all. This is ugly and also inefficient
> (some partmaps are probed twice).
> - Change the partmap order in partmap.lst (can be complicated because of
> the build system), and make the prober follow the order in that file. But,
> uhm, how would we access the file in the first place, before partmaps are
> probed? How does it work _now_ actually?
>
> another way would be to add sanity checks in the prober, so that a partmap
> is never identified as "good" when one of its partitions are out of bounds
> or so. But then again:
>
> - Failing completely for an otherwise perfectly-sane partmap just because
> one partition is out of bounds sounds like a bad idea.
> - It doesn't completely fix the problem anyway.
>
> Comments?
The thought I had on this is that the search order for particular partition
maps probably needs to be arbitrary; i.e. there probably isn't a particular
search order that would cover this type of situation for all architectures
that grub2 functions on. And as you mentioned, there probably isn't a good
way of specifying that search order before grub2 is installed.
Going back to probing for native partmaps first... hmm. Is there any case
where that may create the opposite problem? i.e. would it be possible for a
disk in a portable drive that's been used for both an Apple and an IBM PC but
which is actually currently partitioned for an Apple may be falsely detected
as being set up for an IBM PC? I don't know.
If there was a design decision to move away from doing this then there was
likely a reason for doing so; perhaps there was a similar situation where a
more flexible design was required. i.e. my first thought would be to look
into why the design decision was made because there may be use cases where the
current design is required.
Instead of probing for partmaps in a particular order, it seems that
solving for this might best be done by probing for all of the possible
partmaps for the architecture and trying to figure out which one best fits.
grub2's grub-probe is clearly already doing this; _however_, somehow the PC
partmap probe is subtly different depending on whether partmap/apple.c is
included in the search.
The debug output files --
with partmap/apple.c detection:
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=15;filename=grub-probe_0.97-36.txt;att=1;bug=475718
without partmap/apple.c detection:
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=23;filename=grub-probe_noapple.txt;att=1;bug=475718
Comparing between the two outputs:
with partmap/apple.c detection:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
partmap/pc.c:141: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
partmap/pc.c:141: partition 1: flag 0x0, type 0x0, start 0x0, len 0x0
partmap/pc.c:141: partition 2: flag 0x0, type 0x0, start 0x0, len 0x0
partmap/pc.c:141: partition 3: flag 0x0, type 0x0, start 0x0, len 0x0
without partmap/apple.c detection:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
partmap/pc.c:141: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
partmap/pc.c:141: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
partmap/pc.c:141: partition 2: flag 0x0, type 0x83, start 0x4c92c06, len 0x274c3c5
partmap/pc.c:141: partition 3: flag 0x0, type 0x5, start 0x73defcb, len 0xb639af6
Look at the detection of partition 0 between the two; both the type and the
len numbers are different. So I'm wondering, why would pc partmap detection
be different if the apple partmap was searched first?
-- Chris
--
Chris Knadle
Chris.Knadle@coredump.us
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-04-14 14:21 ` Chris Knadle
@ 2008-04-14 17:20 ` Pavel Roskin
2008-04-15 13:15 ` Robert Millan
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: Pavel Roskin @ 2008-04-14 17:20 UTC (permalink / raw)
To: The development of GRUB 2
On Mon, 2008-04-14 at 10:21 -0400, Chris Knadle wrote:
> Instead of probing for partmaps in a particular order, it seems that
> solving for this might best be done by probing for all of the possible
> partmaps for the architecture and trying to figure out which one best fits.
> grub2's grub-probe is clearly already doing this; _however_, somehow the PC
> partmap probe is subtly different depending on whether partmap/apple.c is
> included in the search.
Apple and PC partition maps can coexist. The place occupied by the PC
partition and the PC magic is not used by the Apple partition.
The way to differentiate them would be to check at the first sector. If
it starts with 0x45 0x52, then it's an Apple partition. A PC partition
would have an executable entry there. The Apple magic would decode to:
inc %bp
push %dx
It's highly unlikely to be used in the first two instructions of the PC
boot code.
partmap/apple.c starts reading with the second sector (unsigned pos =
GRUB_DISK_SECTOR_SIZE). Perhaps it should read the first sector to
check the magic.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-04-14 17:20 ` Pavel Roskin
@ 2008-04-15 13:15 ` Robert Millan
2008-04-15 15:17 ` Pavel Roskin
2008-04-15 14:06 ` Chris Knadle
2008-07-23 2:53 ` Chris Knadle
2 siblings, 1 reply; 21+ messages in thread
From: Robert Millan @ 2008-04-15 13:15 UTC (permalink / raw)
To: The development of GRUB 2
On Mon, Apr 14, 2008 at 01:20:49PM -0400, Pavel Roskin wrote:
> On Mon, 2008-04-14 at 10:21 -0400, Chris Knadle wrote:
>
> > Instead of probing for partmaps in a particular order, it seems that
> > solving for this might best be done by probing for all of the possible
> > partmaps for the architecture and trying to figure out which one best fits.
> > grub2's grub-probe is clearly already doing this; _however_, somehow the PC
> > partmap probe is subtly different depending on whether partmap/apple.c is
> > included in the search.
>
> Apple and PC partition maps can coexist. The place occupied by the PC
> partition and the PC magic is not used by the Apple partition.
>
> The way to differentiate them would be to check at the first sector. If
> it starts with 0x45 0x52, then it's an Apple partition. A PC partition
> would have an executable entry there. The Apple magic would decode to:
>
> inc %bp
> push %dx
>
> It's highly unlikely to be used in the first two instructions of the PC
> boot code.
>
> partmap/apple.c starts reading with the second sector (unsigned pos =
> GRUB_DISK_SECTOR_SIZE). Perhaps it should read the first sector to
> check the magic.
Are you sure checking for the code part would be a good idea? One could be
using i8088 bootstrap code in an Apple first sector, or vice-versa.
Btw, how does Linux handle this? Maybe this issue has been beaten to death
already.
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-04-14 17:20 ` Pavel Roskin
2008-04-15 13:15 ` Robert Millan
@ 2008-04-15 14:06 ` Chris Knadle
2008-07-23 2:53 ` Chris Knadle
2 siblings, 0 replies; 21+ messages in thread
From: Chris Knadle @ 2008-04-15 14:06 UTC (permalink / raw)
To: The development of GRUB 2
On Monday 14 April 2008, Pavel Roskin wrote:
> On Mon, 2008-04-14 at 10:21 -0400, Chris Knadle wrote:
> > Instead of probing for partmaps in a particular order, it seems that
> > solving for this might best be done by probing for all of the possible
> > partmaps for the architecture and trying to figure out which one best
> > fits. grub2's grub-probe is clearly already doing this; _however_,
> > somehow the PC partmap probe is subtly different depending on whether
> > partmap/apple.c is included in the search.
>
> Apple and PC partition maps can coexist. The place occupied by the PC
> partition and the PC magic is not used by the Apple partition.
>
> The way to differentiate them would be to check at the first sector. If
> it starts with 0x45 0x52, then it's an Apple partition. A PC partition
> would have an executable entry there.
I can verify that this disk does not have 0x45 0x52 in the first sector.
To check I used 'hexedit /dev/hde' as root, and I've copy-pasted the relevant
text of the first 2120 bytes.
Rather than attach it (some mailing lists don't appreciate attachments --
let me know if you'd prefer an attachment), I've placed the above file at the
link below if you want to have a look. Regardless of the fact that there are
bits of text like "Apple", "Apple_partition_map", "Apple_Free", "Apple_HFS",
etc, I assure you that this disk is not in an Apple and has been in my
Desktop IBM PC for six months as the main boot disk.
I regularly build and install new Linux kernels on this disk, and grub +
update-grub handled all of those very well up until this point, which in
itself is amazing given that the first couple of sectors seem to be full of
false information as far as reading it as a human being goes. ;-)
ftp://ftp.coredump.us/grub-debug/Linux-apple-disk_2120bytes.txt
-- Chris
--
Chris Knadle
Chris.Knadle@coredump.us
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-04-15 13:15 ` Robert Millan
@ 2008-04-15 15:17 ` Pavel Roskin
0 siblings, 0 replies; 21+ messages in thread
From: Pavel Roskin @ 2008-04-15 15:17 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, 2008-04-15 at 15:15 +0200, Robert Millan wrote:
> > partmap/apple.c starts reading with the second sector (unsigned pos =
> > GRUB_DISK_SECTOR_SIZE). Perhaps it should read the first sector to
> > check the magic.
>
> Are you sure checking for the code part would be a good idea? One could be
> using i8088 bootstrap code in an Apple first sector, or vice-versa.
Apple partition table requires the magic in the first two bytes of the
first sector, followed by the sector size. Even if those instructions
are survivable by x86 processors, executing data is a very bad hack.
> Btw, how does Linux handle this? Maybe this issue has been beaten to death
> already.
fs/partitions/mac.c checks the magic in the first sector in
mac_partition()
fs/partitions/msdos.c doesn't check for the Apple magic, but it makes
some other sanity checks. It rejects the partition table if any boot
flags is not 0x00 or 0x80. It also refuses to accept the table if there
is an EFI GPT partition.
To fix the issue at hand (PC partition mistaken as Apple), all we need
is to check the Apple magic in the Apple partition code.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-04-14 17:20 ` Pavel Roskin
2008-04-15 13:15 ` Robert Millan
2008-04-15 14:06 ` Chris Knadle
@ 2008-07-23 2:53 ` Chris Knadle
2008-07-23 3:48 ` Pavel Roskin
2 siblings, 1 reply; 21+ messages in thread
From: Chris Knadle @ 2008-07-23 2:53 UTC (permalink / raw)
To: The development of GRUB 2
Felix Zielcke asked me about the Apple/PC hybrid disk problem, so I'm trying
to figure out how to fix it. Sorry for letting this fall through the cracks;
this is from three months ago.
On Monday 14 April 2008, Pavel Roskin wrote:
> On Mon, 2008-04-14 at 10:21 -0400, Chris Knadle wrote:
> > Instead of probing for partmaps in a particular order, it seems that
> > solving for this might best be done by probing for all of the possible
> > partmaps for the architecture and trying to figure out which one best
> > fits. grub2's grub-probe is clearly already doing this; _however_,
> > somehow the PC partmap probe is subtly different depending on whether
> > partmap/apple.c is included in the search.
>
> Apple and PC partition maps can coexist. The place occupied by the
> PC partition and the PC magic is not used by the Apple partition.
Yeah, I see -- this includes the Apple magic of 0xAA55 that's placed in
Sector 0, so searching for that won't help.
> The way to differentiate them would be to check at the first sector. If
> it starts with 0x45 0x52, then it's an Apple partition. A PC partition
> would have an executable entry there. The Apple magic would decode to:
>
> inc %bp
> push %dx
>
> It's highly unlikely to be used in the first two instructions of the PC
> boot code.
>
> partmap/apple.c starts reading with the second sector (unsigned pos =
> GRUB_DISK_SECTOR_SIZE). Perhaps it should read the first sector to
> check the magic.
I see where you got 0x4552 from; it's the HFS+ magic descriptor. For the
moment I'm using the following #define for that:
#define GRUB_APPLE_FIRST_SECTOR_MAGIC 0x4552
I'm trying to figure out how to get grub to check the first sector. Mainly
I'm asking for hints. I think it involves running a new instance of
grub_disk_read for the first sector (sector 0 of the partition) within the
apple_partition_map_iterate function -- something like:
grub_disk_read(&raw, 0, 0, sizeof (struct grub_apple_part), (char *)&apart))
But then I want to check the first block against 0x4552, and
apart.first_phys_block is 32-bits. Since I want the first (high) 16 bits, I
think I need to make the comparison in a way such as:
if ((apart.first_phys_block & 0xFFFF0000) == (0x4552 << 16))
Is this vaguely on the right track?
Thanks.
-- Chris
--
Chris Knadle
Chris.Knadle@coredump.us
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-23 2:53 ` Chris Knadle
@ 2008-07-23 3:48 ` Pavel Roskin
2008-07-23 19:10 ` Chris Knadle
0 siblings, 1 reply; 21+ messages in thread
From: Pavel Roskin @ 2008-07-23 3:48 UTC (permalink / raw)
To: grub-devel
Quoting Chris Knadle <Chris.Knadle@coredump.us>:
> I'm trying to figure out how to get grub to check the first
> sector. Mainly
> I'm asking for hints. I think it involves running a new instance of
> grub_disk_read for the first sector (sector 0 of the partition) within the
> apple_partition_map_iterate function -- something like:
>
> grub_disk_read(&raw, 0, 0, sizeof (struct grub_apple_part), (char *)&apart))
I'm not sure grub_apple_part would describe the first sector
correctly. Besides, you only need two bytes. Why reuse "apart"? You
can use a 16-bit variable and read those two bytes there.
> But then I want to check the first block against 0x4552, and
> apart.first_phys_block is 32-bits.
Why first_phys_block? The first field is 16 bit wide and is called "magic".
> Since I want the first (high) 16 bits, I
> think I need to make the comparison in a way such as:
>
> if ((apart.first_phys_block & 0xFFFF0000) == (0x4552 << 16))
That won't work on little endian systems, including ordinary PC. You
are assuming big endian byte order here. Instead, the data from the
disk should be converted to CPU-endian from whatever it is and
compared to the magic value.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-23 3:48 ` Pavel Roskin
@ 2008-07-23 19:10 ` Chris Knadle
2008-07-23 20:47 ` Chris Knadle
0 siblings, 1 reply; 21+ messages in thread
From: Chris Knadle @ 2008-07-23 19:10 UTC (permalink / raw)
To: The development of GRUB 2
Thanks for your pointsers, Pavel; they were all helpful.
On Tuesday 22 July 2008, Pavel Roskin wrote:
> Quoting Chris Knadle <Chris.Knadle@coredump.us>:
> > Since I want the first (high) 16 bits, I
> > think I need to make the comparison in a way such as:
> >
> > if ((apart.first_phys_block & 0xFFFF0000) == (0x4552 << 16))
>
> That won't work on little endian systems, including ordinary PC. You
> are assuming big endian byte order here. Instead, the data from the
> disk should be converted to CPU-endian from whatever it is and
> compared to the magic value.
Yes, I did suspect that problem; so this needs a #ifdef for CPU
architecture and choosing the appropriate conversion with one of the
functions in include/grub/type.h -- okay.
The next problem is that I'm not able to figure out how to get partition.c
to "give up" the Apple_partition_map that is detected, and to re-detect for
others. Right now part_map_iterate() detects an Apple partition based on
Sector 0 [which is unavoidable, since Sector 0 is not going to have an HFS+
magic number], after which it becomes "fixated" on it. Calling
grub_partition_map_unregister() does lead to secceding in detection of a
pc_partition_map, but then still isn't fully successful in a grub-probe.
Below is a patch based on the git tree if you want to see where I'm
currently at.
--
Chris Knadle
Chris.Knadle@coredump.us
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
diff --git a/partmap/apple.c b/partmap/apple.c
index 4e5c481..3786301 100644
--- a/partmap/apple.c
+++ b/partmap/apple.c
@@ -23,6 +23,7 @@
#include <grub/partition.h>
#define GRUB_APPLE_PART_MAGIC 0x504D
+#define GRUB_APPLE_HFSPLUS_MAGIC 0x4552
struct grub_apple_part
{
@@ -102,6 +103,7 @@ apple_partition_map_iterate (grub_disk_t disk,
struct grub_disk raw;
int partno = 0;
unsigned pos = GRUB_DISK_SECTOR_SIZE;
+ grub_uint16_t magic;
/* Enforce raw disk access. */
raw = *disk;
@@ -111,6 +113,21 @@ apple_partition_map_iterate (grub_disk_t disk,
for (;;)
{
+
+ /* load + check partition magic number */
+ if (grub_disk_read (&raw, 0, 0, sizeof(grub_uint16_t), (char *)
&magic))
+ return grub_errno;
+ if (grub_be_to_cpu16(magic) != GRUB_APPLE_HFSPLUS_MAGIC && partno >
0 ) {
+ grub_dprintf("partition",
+ "non-Apple partition %d: bad magic (found 0x%x; wanted 0x%x\n",
+ partno, grub_be_to_cpu16 (magic),
+ GRUB_APPLE_HFSPLUS_MAGIC);
+ grub_errno = 1;
+ grub_partition_map_unregister(part.partmap);
+ return 1;
+ }
+
+
if (grub_disk_read (&raw, pos / GRUB_DISK_SECTOR_SIZE,
pos % GRUB_DISK_SECTOR_SIZE,
sizeof (struct grub_apple_part), (char *) &apart))
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-23 19:10 ` Chris Knadle
@ 2008-07-23 20:47 ` Chris Knadle
2008-07-25 20:27 ` Robert Millan
0 siblings, 1 reply; 21+ messages in thread
From: Chris Knadle @ 2008-07-23 20:47 UTC (permalink / raw)
To: The development of GRUB 2
On Wednesday 23 July 2008, Chris Knadle wrote:
> Right now part_map_iterate() detects an Apple partition based on Sector 0
> [which is unavoidable, since Sector 0 is not going to have an HFS+ magic
> number]
Sorry, I meant *partition 0*, not Sector 0...
-- Chris
--
Chris Knadle
Chris.Knadle@coredump.us
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-23 20:47 ` Chris Knadle
@ 2008-07-25 20:27 ` Robert Millan
2008-07-25 23:09 ` Chris Knadle
0 siblings, 1 reply; 21+ messages in thread
From: Robert Millan @ 2008-07-25 20:27 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Jul 23, 2008 at 04:47:42PM -0400, Chris Knadle wrote:
> On Wednesday 23 July 2008, Chris Knadle wrote:
> > Right now part_map_iterate() detects an Apple partition based on Sector 0
> > [which is unavoidable, since Sector 0 is not going to have an HFS+ magic
> > number]
>
> Sorry, I meant *partition 0*, not Sector 0...
Assuming the problem is the missing check for the other magic number in
sector 0 (of the whole disk), I just sent a patch in:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=475718#70
which supposedly fixes this problem. Please test!
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-25 20:27 ` Robert Millan
@ 2008-07-25 23:09 ` Chris Knadle
2008-07-27 19:53 ` Felix Zielcke
0 siblings, 1 reply; 21+ messages in thread
From: Chris Knadle @ 2008-07-25 23:09 UTC (permalink / raw)
To: The development of GRUB 2
On Friday 25 July 2008, Robert Millan wrote:
> On Wed, Jul 23, 2008 at 04:47:42PM -0400, Chris Knadle wrote:
> > On Wednesday 23 July 2008, Chris Knadle wrote:
> > > Right now part_map_iterate() detects an Apple partition based on Sector
> > > 0 [which is unavoidable, since Sector 0 is not going to have an HFS+
> > > magic number]
> >
> > Sorry, I meant *partition 0*, not Sector 0...
>
> Assuming the problem is the missing check for the other magic number in
> sector 0 (of the whole disk), I just sent a patch in:
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=475718#70
>
> which supposedly fixes this problem. Please test!
Just tested -- nope, grub-probe still can't find the device. Have a look
at the following snippit of a 'grub-probe -vv /dev/hde3' output to see the
interesting behavior this generates -- note that the first two bytes on this
disk /dev/hde (i.e. the first two bytes on the disk, which should be part of
the JUMP VECTOR to Grub) are 0xFC31. So this:
kern/partition.c:106: Detecting apple_partition_map...
kern/disk.c:368: Reading `hd0'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/partition.c:112: apple_partition_map detection failed.
means that this patch is trying to match the HFS magic number on the first
sector of the drive, when that doesn't have a filesystem magic number at
all. :-( Do you see the problem -- or am I wrong about this? If I'm
correct (and I really hope I'm not), it means that there's no good way of
discarding Apple partition detection based solely on Sector 0 of the drive --
which was already suspected anyway, since Apple and PC partition maps can
coexist.
I'm going to attach the full 'grub-probe' output and a dd of the first 1024
bytes of /dev/hde to the Debian bug report.
-- Chris
--
Chris Knadle
Chris.Knadle@coredump.us
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-25 23:09 ` Chris Knadle
@ 2008-07-27 19:53 ` Felix Zielcke
2008-07-27 20:33 ` Felix Zielcke
2008-07-28 18:41 ` Chris Knadle
0 siblings, 2 replies; 21+ messages in thread
From: Felix Zielcke @ 2008-07-27 19:53 UTC (permalink / raw)
To: The development of GRUB 2
Am Freitag, den 25.07.2008, 19:09 -0400 schrieb Chris Knadle:
> Just tested -- nope, grub-probe still can't find the device.
> So this:
>
> kern/partition.c:106: Detecting apple_partition_map...
> kern/disk.c:368: Reading `hd0'...
> partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
> kern/partition.c:112: apple_partition_map detection failed.
>
> means that this patch is trying to match the HFS magic number on the first
> sector of the drive, when that doesn't have a filesystem magic number at
> all.
kern/partition.c:117: pc_partition_map detection succeeded.
Just after the snippet you wrote.
So I think it should work.
Maybe you didn't test this right?
Wipe a disk, then make an apple partition, and then make msdos
partitions and make a filesystem on it.
Just like it probable was as you reported the bug initially.
Btw. I just read the whole story again and I was wrong saying that
grub-legacy won't have a fix for this.
grub-legacy now uses grub-probe so if grub-probe works then both are
fixed for you.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-27 19:53 ` Felix Zielcke
@ 2008-07-27 20:33 ` Felix Zielcke
2008-07-28 18:41 ` Chris Knadle
1 sibling, 0 replies; 21+ messages in thread
From: Felix Zielcke @ 2008-07-27 20:33 UTC (permalink / raw)
To: The development of GRUB 2
Am Sonntag, den 27.07.2008, 21:53 +0200 schrieb Felix Zielcke:
> Wipe a disk, then make an apple partition, and then make msdos
> partitions and make a filesystem on it.
> Just like it probable was as you reported the bug initially.
>
Urm I forgot:
probable better if you make also an apple filesystem on it
and check your device.map that it's right and has an try for the /dev/
you're testing with.
grub-mkdevicemap makes a new one if you don't want to run grub-install
--recheck
The best would be a real test, not something constructed
So grabbing a harddisk used on an apple and then overwriting it with a
msdos partition scheme and linux filesystem and having linux installed
on it
So basicly as I already said in my mail before:
Almost the same situation as you had as you reported the bug :)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-27 19:53 ` Felix Zielcke
2008-07-27 20:33 ` Felix Zielcke
@ 2008-07-28 18:41 ` Chris Knadle
2008-07-28 18:55 ` Felix Zielcke
1 sibling, 1 reply; 21+ messages in thread
From: Chris Knadle @ 2008-07-28 18:41 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 2333 bytes --]
On Sunday 27 July 2008, Felix Zielcke wrote:
> Am Freitag, den 25.07.2008, 19:09 -0400 schrieb Chris Knadle:
> > Just tested -- nope, grub-probe still can't find the device.
> >
> > So this:
> >
> > kern/partition.c:106: Detecting apple_partition_map...
> > kern/disk.c:368: Reading `hd0'...
> > partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
> > kern/partition.c:112: apple_partition_map detection failed.
> >
> > means that this patch is trying to match the HFS magic number on the
> > first sector of the drive, when that doesn't have a filesystem magic
> > number at all.
>
> kern/partition.c:117: pc_partition_map detection succeeded.
>
> Just after the snippet you wrote.
> So I think it should work.
> Maybe you didn't test this right?
I went back and looked at the bug report again. Early on Robert suggested
removing Apple partition detection, after which 'grub-probe -d /dev/hde2'
succeeds (ext2). [It's not in the bug report, but 'grub-probe -d /dev/hde3'
also succeeds (xfs)]. So I'm satisfied that at least the overall testing
method is fine.
However on the last test I did make an error and left out the -d option to
grub-probe, and that's required for the grub-probe to succeed, so
unfortunately the output I posted is erroneous.
A new one is attached which has Robert's patch applied -- it does succeed
in finding the partition, but unfortunately we can't fix the problem this way
because I believe it makes Apple partition detection *always* fail.
> Wipe a disk, then make an apple partition, and then make msdos
> partitions and make a filesystem on it.
> Just like it probable was as you reported the bug initially.
Duplicating the problem is fine, but I don't see how this changes the
testing method. I'm probably willing to duplicate this on another system
later, although independent verification would probably be better. Right now
I'm more interested in focusing on trying to remove Apple partmap detection
for the PC architecture, since we already know that will fix the problem.
> Btw. I just read the whole story again and I was wrong saying that
> grub-legacy won't have a fix for this.
> grub-legacy now uses grub-probe so if grub-probe works then both are
> fixed for you.
Right.
-- Chris
--
Chris Knadle
Chris.Knadle@coredump.us
[-- Attachment #2: apple-patch_partmap-detect.txt --]
[-- Type: text/plain, Size: 23411 bytes --]
# ./grub-probe -vv -d /dev/hde3 2>&1
kern/disk.c:220: Opening `hd0'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0'...
grub-probe: info: opening the device `/dev/hde'
kern/disk.c:368: Reading `hd0'...
kern/disk.c:368: Reading `hd0'...
kern/disk.c:368: Reading `hd0'...
kern/disk.c:312: Closing `hd0'.
kern/disk.c:220: Opening `hd0'...
grub-probe: info: the size of hd0 is 312581808
kern/partition.c:106: Detecting gpt_partition_map...
kern/disk.c:368: Reading `hd0'...
kern/partition.c:112: gpt_partition_map detection failed.
kern/partition.c:106: Detecting apple_partition_map...
kern/disk.c:368: Reading `hd0'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/partition.c:112: apple_partition_map detection failed.
kern/partition.c:106: Detecting pc_partition_map...
kern/disk.c:368: Reading `hd0'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
kern/partition.c:117: pc_partition_map detection succeeded.
kern/disk.c:368: Reading `hd0'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
kern/disk.c:220: Opening `hd0,1'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0,1'...
kern/disk.c:368: Reading `hd0,1'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/disk.c:368: Reading `hd0,1'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
kern/disk.c:368: Reading `hd0,1'...
grub-probe: info: opening the device `/dev/hde1'
grub-probe: info: opening the device `/dev/hde1'
kern/disk.c:368: Reading `hd0,1'...
grub-probe: info: opening the device `/dev/hde1'
kern/disk.c:368: Reading `hd0,1'...
kern/disk.c:368: Reading `hd0,1'...
kern/disk.c:312: Closing `hd0,1'.
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
kern/disk.c:220: Opening `hd0,2'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0,2'...
kern/disk.c:368: Reading `hd0,2'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/disk.c:368: Reading `hd0,2'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
kern/disk.c:368: Reading `hd0,2'...
grub-probe: info: opening the device `/dev/hde2'
grub-probe: info: opening the device `/dev/hde2'
kern/disk.c:368: Reading `hd0,2'...
grub-probe: info: opening the device `/dev/hde2'
grub-probe: info: opening the device `/dev/hde2'
kern/disk.c:368: Reading `hd0,2'...
grub-probe: info: opening the device `/dev/hde2'
grub-probe: info: opening the device `/dev/hde2'
kern/disk.c:368: Reading `hd0,2'...
grub-probe: info: opening the device `/dev/hde2'
grub-probe: info: opening the device `/dev/hde2'
kern/disk.c:312: Closing `hd0,2'.
partmap/pc.c:143: partition 2: flag 0x0, type 0x83, start 0x4c92c06, len 0x274c3c5
kern/disk.c:220: Opening `hd0,3'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0,3'...
kern/disk.c:368: Reading `hd0,3'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/disk.c:368: Reading `hd0,3'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
partmap/pc.c:143: partition 2: flag 0x0, type 0x83, start 0x4c92c06, len 0x274c3c5
kern/disk.c:368: Reading `hd0,3'...
grub-probe: info: opening the device `/dev/hde3'
grub-probe: info: opening the device `/dev/hde3'
kern/disk.c:368: Reading `hd0,3'...
grub-probe: info: opening the device `/dev/hde3'
grub-probe: info: opening the device `/dev/hde3'
kern/disk.c:368: Reading `hd0,3'...
grub-probe: info: opening the device `/dev/hde3'
kern/disk.c:368: Reading `hd0,3'...
kern/disk.c:312: Closing `hd0,3'.
partmap/pc.c:143: partition 3: flag 0x0, type 0x5, start 0x73defcb, len 0xb639af6
kern/disk.c:368: Reading `hd0'...
grub-probe: info: opening the device `/dev/hde'
partmap/pc.c:143: partition 0: flag 0x0, type 0x82, start 0x73df00a, len 0x686ceb
kern/disk.c:220: Opening `hd0,5'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0,5'...
kern/disk.c:368: Reading `hd0,5'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/disk.c:368: Reading `hd0,5'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
partmap/pc.c:143: partition 2: flag 0x0, type 0x83, start 0x4c92c06, len 0x274c3c5
partmap/pc.c:143: partition 3: flag 0x0, type 0x5, start 0x73defcb, len 0xb639af6
kern/disk.c:368: Reading `hd0,5'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x82, start 0x73df00a, len 0x686ceb
kern/disk.c:368: Reading `hd0,5'...
grub-probe: info: opening the device `/dev/hde5'
grub-probe: info: opening the device `/dev/hde5'
kern/disk.c:368: Reading `hd0,5'...
grub-probe: info: opening the device `/dev/hde5'
grub-probe: info: opening the device `/dev/hde5'
kern/disk.c:368: Reading `hd0,5'...
grub-probe: info: opening the device `/dev/hde5'
grub-probe: info: opening the device `/dev/hde5'
kern/disk.c:368: Reading `hd0,5'...
grub-probe: info: opening the device `/dev/hde5'
grub-probe: info: opening the device `/dev/hde5'
kern/disk.c:312: Closing `hd0,5'.
partmap/pc.c:143: partition 1: flag 0x0, type 0x5, start 0x7a65cf5, len 0xafb2dcc
partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x73defcb, len 0x0
partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x73defcb, len 0x0
kern/disk.c:368: Reading `hd0'...
grub-probe: info: opening the device `/dev/hde'
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x7a65d34, len 0xafb2d8d
kern/disk.c:220: Opening `hd0,6'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0,6'...
kern/disk.c:368: Reading `hd0,6'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/disk.c:368: Reading `hd0,6'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
partmap/pc.c:143: partition 2: flag 0x0, type 0x83, start 0x4c92c06, len 0x274c3c5
partmap/pc.c:143: partition 3: flag 0x0, type 0x5, start 0x73defcb, len 0xb639af6
kern/disk.c:368: Reading `hd0,6'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x82, start 0x73df00a, len 0x686ceb
partmap/pc.c:143: partition 1: flag 0x0, type 0x5, start 0x7a65cf5, len 0xafb2dcc
partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x73defcb, len 0x0
partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x73defcb, len 0x0
kern/disk.c:368: Reading `hd0,6'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x7a65d34, len 0xafb2d8d
kern/disk.c:368: Reading `hd0,6'...
grub-probe: info: opening the device `/dev/hde6'
grub-probe: info: opening the device `/dev/hde6'
kern/disk.c:368: Reading `hd0,6'...
grub-probe: info: opening the device `/dev/hde6'
grub-probe: info: opening the device `/dev/hde6'
kern/disk.c:368: Reading `hd0,6'...
grub-probe: info: opening the device `/dev/hde6'
grub-probe: info: opening the device `/dev/hde6'
kern/disk.c:368: Reading `hd0,6'...
grub-probe: info: opening the device `/dev/hde6'
grub-probe: info: opening the device `/dev/hde6'
kern/disk.c:312: Closing `hd0,6'.
partmap/pc.c:143: partition 1: flag 0x0, type 0x0, start 0x7a65cf5, len 0x0
partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x7a65cf5, len 0x0
partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x7a65cf5, len 0x0
kern/disk.c:312: Closing `hd0'.
kern/disk.c:220: Opening `hd1'...
grub-probe: info: the size of hd1 is 976773168
kern/disk.c:368: Reading `hd1'...
grub-probe: info: opening the device `/dev/hdg'
kern/disk.c:368: Reading `hd1'...
kern/disk.c:368: Reading `hd1'...
kern/disk.c:368: Reading `hd1'...
kern/disk.c:312: Closing `hd1'.
kern/disk.c:220: Opening `hd1'...
grub-probe: info: the size of hd1 is 976773168
kern/partition.c:106: Detecting gpt_partition_map...
kern/disk.c:368: Reading `hd1'...
kern/partition.c:112: gpt_partition_map detection failed.
kern/partition.c:106: Detecting apple_partition_map...
kern/disk.c:368: Reading `hd1'...
partmap/apple.c:129: bad magic (found 0x0; wanted 0x4552
kern/partition.c:112: apple_partition_map detection failed.
kern/partition.c:106: Detecting pc_partition_map...
kern/disk.c:368: Reading `hd1'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
kern/partition.c:117: pc_partition_map detection succeeded.
kern/disk.c:368: Reading `hd1'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
kern/disk.c:220: Opening `hd1,1'...
grub-probe: info: the size of hd1 is 976773168
kern/disk.c:368: Reading `hd1,1'...
kern/disk.c:368: Reading `hd1,1'...
partmap/apple.c:129: bad magic (found 0x0; wanted 0x4552
kern/disk.c:368: Reading `hd1,1'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
kern/disk.c:368: Reading `hd1,1'...
grub-probe: info: opening the device `/dev/hdg1'
grub-probe: info: opening the device `/dev/hdg1'
kern/disk.c:368: Reading `hd1,1'...
grub-probe: info: opening the device `/dev/hdg1'
kern/disk.c:368: Reading `hd1,1'...
kern/disk.c:368: Reading `hd1,1'...
kern/disk.c:312: Closing `hd1,1'.
partmap/pc.c:143: partition 1: flag 0x0, type 0x0, start 0x0, len 0x0
partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x0, len 0x0
partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x0, len 0x0
kern/disk.c:312: Closing `hd1'.
kern/disk.c:220: Opening `hd2'...
grub-probe: info: the size of hd2 is 976773168
kern/disk.c:368: Reading `hd2'...
grub-probe: info: opening the device `/dev/hdh'
kern/disk.c:368: Reading `hd2'...
kern/disk.c:368: Reading `hd2'...
kern/disk.c:368: Reading `hd2'...
kern/disk.c:312: Closing `hd2'.
kern/disk.c:220: Opening `hd2'...
grub-probe: info: the size of hd2 is 976773168
kern/partition.c:106: Detecting gpt_partition_map...
kern/disk.c:368: Reading `hd2'...
kern/partition.c:112: gpt_partition_map detection failed.
kern/partition.c:106: Detecting apple_partition_map...
kern/disk.c:368: Reading `hd2'...
partmap/apple.c:129: bad magic (found 0x0; wanted 0x4552
kern/partition.c:112: apple_partition_map detection failed.
kern/partition.c:106: Detecting pc_partition_map...
kern/disk.c:368: Reading `hd2'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
kern/partition.c:117: pc_partition_map detection succeeded.
kern/disk.c:368: Reading `hd2'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
kern/disk.c:220: Opening `hd2,1'...
grub-probe: info: the size of hd2 is 976773168
kern/disk.c:368: Reading `hd2,1'...
kern/disk.c:368: Reading `hd2,1'...
partmap/apple.c:129: bad magic (found 0x0; wanted 0x4552
kern/disk.c:368: Reading `hd2,1'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
kern/disk.c:368: Reading `hd2,1'...
grub-probe: info: opening the device `/dev/hdh1'
grub-probe: info: opening the device `/dev/hdh1'
kern/disk.c:368: Reading `hd2,1'...
grub-probe: info: opening the device `/dev/hdh1'
kern/disk.c:368: Reading `hd2,1'...
kern/disk.c:368: Reading `hd2,1'...
kern/disk.c:312: Closing `hd2,1'.
partmap/pc.c:143: partition 1: flag 0x0, type 0x0, start 0x0, len 0x0
partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x0, len 0x0
partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x0, len 0x0
kern/disk.c:312: Closing `hd2'.
disk/raid.c:361: Scanning for RAID devices
kern/disk.c:220: Opening `hd0'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0'...
grub-probe: info: opening the device `/dev/hde'
kern/disk.c:312: Closing `hd0'.
kern/disk.c:220: Opening `hd0'...
grub-probe: info: the size of hd0 is 312581808
kern/partition.c:106: Detecting gpt_partition_map...
kern/disk.c:368: Reading `hd0'...
kern/partition.c:112: gpt_partition_map detection failed.
kern/partition.c:106: Detecting apple_partition_map...
kern/disk.c:368: Reading `hd0'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/partition.c:112: apple_partition_map detection failed.
kern/partition.c:106: Detecting pc_partition_map...
kern/disk.c:368: Reading `hd0'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
kern/partition.c:117: pc_partition_map detection succeeded.
kern/disk.c:368: Reading `hd0'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
disk/raid.c:361: Scanning for RAID devices
kern/disk.c:220: Opening `hd0,1'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0,1'...
kern/disk.c:368: Reading `hd0,1'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/disk.c:368: Reading `hd0,1'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
kern/disk.c:368: Reading `hd0,1'...
grub-probe: info: opening the device `/dev/hde1'
grub-probe: info: opening the device `/dev/hde1'
kern/disk.c:312: Closing `hd0,1'.
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
disk/raid.c:361: Scanning for RAID devices
kern/disk.c:220: Opening `hd0,2'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0,2'...
kern/disk.c:368: Reading `hd0,2'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/disk.c:368: Reading `hd0,2'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
kern/disk.c:368: Reading `hd0,2'...
grub-probe: info: opening the device `/dev/hde2'
grub-probe: info: opening the device `/dev/hde2'
kern/disk.c:312: Closing `hd0,2'.
partmap/pc.c:143: partition 2: flag 0x0, type 0x83, start 0x4c92c06, len 0x274c3c5
disk/raid.c:361: Scanning for RAID devices
kern/disk.c:220: Opening `hd0,3'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0,3'...
kern/disk.c:368: Reading `hd0,3'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/disk.c:368: Reading `hd0,3'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
partmap/pc.c:143: partition 2: flag 0x0, type 0x83, start 0x4c92c06, len 0x274c3c5
kern/disk.c:368: Reading `hd0,3'...
grub-probe: info: opening the device `/dev/hde3'
grub-probe: info: opening the device `/dev/hde3'
kern/disk.c:312: Closing `hd0,3'.
partmap/pc.c:143: partition 3: flag 0x0, type 0x5, start 0x73defcb, len 0xb639af6
kern/disk.c:368: Reading `hd0'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x82, start 0x73df00a, len 0x686ceb
disk/raid.c:361: Scanning for RAID devices
kern/disk.c:220: Opening `hd0,5'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0,5'...
kern/disk.c:368: Reading `hd0,5'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/disk.c:368: Reading `hd0,5'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
partmap/pc.c:143: partition 2: flag 0x0, type 0x83, start 0x4c92c06, len 0x274c3c5
partmap/pc.c:143: partition 3: flag 0x0, type 0x5, start 0x73defcb, len 0xb639af6
kern/disk.c:368: Reading `hd0,5'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x82, start 0x73df00a, len 0x686ceb
kern/disk.c:368: Reading `hd0,5'...
grub-probe: info: opening the device `/dev/hde5'
grub-probe: info: opening the device `/dev/hde5'
kern/disk.c:312: Closing `hd0,5'.
partmap/pc.c:143: partition 1: flag 0x0, type 0x5, start 0x7a65cf5, len 0xafb2dcc
partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x73defcb, len 0x0
partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x73defcb, len 0x0
kern/disk.c:368: Reading `hd0'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x7a65d34, len 0xafb2d8d
disk/raid.c:361: Scanning for RAID devices
kern/disk.c:220: Opening `hd0,6'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0,6'...
kern/disk.c:368: Reading `hd0,6'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/disk.c:368: Reading `hd0,6'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
partmap/pc.c:143: partition 2: flag 0x0, type 0x83, start 0x4c92c06, len 0x274c3c5
partmap/pc.c:143: partition 3: flag 0x0, type 0x5, start 0x73defcb, len 0xb639af6
kern/disk.c:368: Reading `hd0,6'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x82, start 0x73df00a, len 0x686ceb
partmap/pc.c:143: partition 1: flag 0x0, type 0x5, start 0x7a65cf5, len 0xafb2dcc
partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x73defcb, len 0x0
partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x73defcb, len 0x0
kern/disk.c:368: Reading `hd0,6'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x7a65d34, len 0xafb2d8d
kern/disk.c:368: Reading `hd0,6'...
grub-probe: info: opening the device `/dev/hde6'
grub-probe: info: opening the device `/dev/hde6'
kern/disk.c:312: Closing `hd0,6'.
partmap/pc.c:143: partition 1: flag 0x0, type 0x0, start 0x7a65cf5, len 0x0
partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x7a65cf5, len 0x0
partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x7a65cf5, len 0x0
kern/disk.c:312: Closing `hd0'.
disk/raid.c:361: Scanning for RAID devices
kern/disk.c:220: Opening `hd1'...
grub-probe: info: the size of hd1 is 976773168
kern/disk.c:368: Reading `hd1'...
grub-probe: info: opening the device `/dev/hdg'
kern/disk.c:312: Closing `hd1'.
kern/disk.c:220: Opening `hd1'...
grub-probe: info: the size of hd1 is 976773168
kern/partition.c:106: Detecting gpt_partition_map...
kern/disk.c:368: Reading `hd1'...
kern/partition.c:112: gpt_partition_map detection failed.
kern/partition.c:106: Detecting apple_partition_map...
kern/disk.c:368: Reading `hd1'...
partmap/apple.c:129: bad magic (found 0x0; wanted 0x4552
kern/partition.c:112: apple_partition_map detection failed.
kern/partition.c:106: Detecting pc_partition_map...
kern/disk.c:368: Reading `hd1'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
kern/partition.c:117: pc_partition_map detection succeeded.
kern/disk.c:368: Reading `hd1'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
disk/raid.c:361: Scanning for RAID devices
kern/disk.c:220: Opening `hd1,1'...
grub-probe: info: the size of hd1 is 976773168
kern/disk.c:368: Reading `hd1,1'...
kern/disk.c:368: Reading `hd1,1'...
partmap/apple.c:129: bad magic (found 0x0; wanted 0x4552
kern/disk.c:368: Reading `hd1,1'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
kern/disk.c:368: Reading `hd1,1'...
grub-probe: info: opening the device `/dev/hdg1'
grub-probe: info: opening the device `/dev/hdg1'
kern/disk.c:312: Closing `hd1,1'.
partmap/pc.c:143: partition 1: flag 0x0, type 0x0, start 0x0, len 0x0
partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x0, len 0x0
partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x0, len 0x0
kern/disk.c:312: Closing `hd1'.
disk/raid.c:361: Scanning for RAID devices
kern/disk.c:220: Opening `hd2'...
grub-probe: info: the size of hd2 is 976773168
kern/disk.c:368: Reading `hd2'...
grub-probe: info: opening the device `/dev/hdh'
kern/disk.c:312: Closing `hd2'.
kern/disk.c:220: Opening `hd2'...
grub-probe: info: the size of hd2 is 976773168
kern/partition.c:106: Detecting gpt_partition_map...
kern/disk.c:368: Reading `hd2'...
kern/partition.c:112: gpt_partition_map detection failed.
kern/partition.c:106: Detecting apple_partition_map...
kern/disk.c:368: Reading `hd2'...
partmap/apple.c:129: bad magic (found 0x0; wanted 0x4552
kern/partition.c:112: apple_partition_map detection failed.
kern/partition.c:106: Detecting pc_partition_map...
kern/disk.c:368: Reading `hd2'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
kern/partition.c:117: pc_partition_map detection succeeded.
kern/disk.c:368: Reading `hd2'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
disk/raid.c:361: Scanning for RAID devices
kern/disk.c:220: Opening `hd2,1'...
grub-probe: info: the size of hd2 is 976773168
kern/disk.c:368: Reading `hd2,1'...
kern/disk.c:368: Reading `hd2,1'...
partmap/apple.c:129: bad magic (found 0x0; wanted 0x4552
kern/disk.c:368: Reading `hd2,1'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x83, start 0x3f, len 0x3a384c02
kern/disk.c:368: Reading `hd2,1'...
grub-probe: info: opening the device `/dev/hdh1'
grub-probe: info: opening the device `/dev/hdh1'
kern/disk.c:312: Closing `hd2,1'.
partmap/pc.c:143: partition 1: flag 0x0, type 0x0, start 0x0, len 0x0
partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x0, len 0x0
partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x0, len 0x0
kern/disk.c:312: Closing `hd2'.
grub-probe: info: /dev/hde3 starts from 80292870
grub-probe: info: opening the device hd0
kern/disk.c:220: Opening `hd0'...
grub-probe: info: the size of hd0 is 312581808
kern/partition.c:106: Detecting gpt_partition_map...
kern/disk.c:368: Reading `hd0'...
kern/partition.c:112: gpt_partition_map detection failed.
kern/partition.c:106: Detecting apple_partition_map...
kern/disk.c:368: Reading `hd0'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/partition.c:112: apple_partition_map detection failed.
kern/partition.c:106: Detecting pc_partition_map...
kern/disk.c:368: Reading `hd0'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
kern/partition.c:117: pc_partition_map detection succeeded.
kern/disk.c:368: Reading `hd0'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
grub-probe: info: DOS partition 0 starts from 63
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
grub-probe: info: DOS partition 1 starts from 80084025
partmap/pc.c:143: partition 2: flag 0x0, type 0x83, start 0x4c92c06, len 0x274c3c5
grub-probe: info: DOS partition 2 starts from 80292870
grub-probe: info: opening hd0,3
kern/disk.c:220: Opening `hd0,3'...
grub-probe: info: the size of hd0 is 312581808
kern/disk.c:368: Reading `hd0,3'...
kern/disk.c:368: Reading `hd0,3'...
partmap/apple.c:129: bad magic (found 0xfc31; wanted 0x4552
kern/disk.c:368: Reading `hd0,3'...
partmap/pc.c:143: partition 0: flag 0x0, type 0x7, start 0x3f, len 0x4c5fbfa
partmap/pc.c:143: partition 1: flag 0x80, type 0x83, start 0x4c5fc39, len 0x32fcd
partmap/pc.c:143: partition 2: flag 0x0, type 0x83, start 0x4c92c06, len 0x274c3c5
kern/fs.c:83: Detecting afs...
kern/disk.c:368: Reading `hd0,3'...
kern/disk.c:368: Reading `hd0,3'...
kern/fs.c:89: afs detection failed.
kern/fs.c:83: Detecting xfs...
kern/disk.c:368: Reading `hd0,3'...
grub-probe: info: opening the device `/dev/hde3'
grub-probe: info: opening the device `/dev/hde3'
kern/disk.c:368: Reading `hd0,3'...
grub-probe: info: opening the device `/dev/hde3'
kern/disk.c:368: Reading `hd0,3'...
grub-probe: info: opening the device `/dev/hde3'
grub-probe: info: opening the device `/dev/hde3'
kern/disk.c:368: Reading `hd0,3'...
xfs
kern/disk.c:312: Closing `hd0,3'.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-28 18:41 ` Chris Knadle
@ 2008-07-28 18:55 ` Felix Zielcke
2008-07-28 19:25 ` Chris Knadle
0 siblings, 1 reply; 21+ messages in thread
From: Felix Zielcke @ 2008-07-28 18:55 UTC (permalink / raw)
To: The development of GRUB 2
Am Montag, den 28.07.2008, 14:41 -0400 schrieb Chris Knadle:
>
> However on the last test I did make an error and left out the -d option to
> grub-probe, and that's required for the grub-probe to succeed, so
> unfortunately the output I posted is erroneous.
> A new one is attached which has Robert's patch applied -- it does succeed
> in finding the partition, but unfortunately we can't fix the problem this way
> because I believe it makes Apple partition detection *always* fail.
>
Urgs, yeah didn't see that.
You have to use -d if you give a device.
Why do you think that with this it will always fail?
Maybe you can try this out? :)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-28 18:55 ` Felix Zielcke
@ 2008-07-28 19:25 ` Chris Knadle
2008-07-28 21:20 ` Robert Millan
0 siblings, 1 reply; 21+ messages in thread
From: Chris Knadle @ 2008-07-28 19:25 UTC (permalink / raw)
To: The development of GRUB 2
On Monday 28 July 2008, Felix Zielcke wrote:
> Am Montag, den 28.07.2008, 14:41 -0400 schrieb Chris Knadle:
> > However on the last test I did make an error and left out the -d
> > option to grub-probe, and that's required for the grub-probe to succeed,
> > so unfortunately the output I posted is erroneous.
> > A new one is attached which has Robert's patch applied -- it does
> > succeed in finding the partition, but unfortunately we can't fix the
> > problem this way because I believe it makes Apple partition detection
> > *always* fail.
>
> Urgs, yeah didn't see that.
> You have to use -d if you give a device.
> Why do you think that with this it will always fail?
Because the test that the patch does is to check for an HFS+ filesystem
magic number against the first 2 bytes on the drive, which contains a jump
vector for the Grub stage1 binary. i.e. in order for the test to pass, Grub
has to be unbootable.
> Maybe you can try this out? :)
I normally don't run Apple machines. I have an old 400MHz iMac G3 (the
type that is housed inside of a monitor) available to me, but replacing the
hard disk requires a somewhat messy disassembly effort. I also have an
external Firewire enclosure I could theoretically try this with, but I don't
know how I'd get the G3 to attempt to boot on it.
I'd much rather be looking at C code than spending the next two days
futzing with an old Apple box. :-/
-- Chris
--
Chris Knadle
Chris.Knadle@coredump.us
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-28 19:25 ` Chris Knadle
@ 2008-07-28 21:20 ` Robert Millan
2008-07-28 22:38 ` Robert Millan
2008-07-29 2:25 ` Chris Knadle
0 siblings, 2 replies; 21+ messages in thread
From: Robert Millan @ 2008-07-28 21:20 UTC (permalink / raw)
To: The development of GRUB 2
On Mon, Jul 28, 2008 at 03:25:00PM -0400, Chris Knadle wrote:
> On Monday 28 July 2008, Felix Zielcke wrote:
> > Am Montag, den 28.07.2008, 14:41 -0400 schrieb Chris Knadle:
> > > However on the last test I did make an error and left out the -d
> > > option to grub-probe, and that's required for the grub-probe to succeed,
> > > so unfortunately the output I posted is erroneous.
> > > A new one is attached which has Robert's patch applied -- it does
> > > succeed in finding the partition, but unfortunately we can't fix the
> > > problem this way because I believe it makes Apple partition detection
> > > *always* fail.
> >
> > Urgs, yeah didn't see that.
> > You have to use -d if you give a device.
> > Why do you think that with this it will always fail?
>
> Because the test that the patch does is to check for an HFS+ filesystem
> magic number against the first 2 bytes on the drive, which contains a jump
> vector for the Grub stage1 binary. i.e. in order for the test to pass, Grub
> has to be unbootable.
My check has nothing to do with HFS+, it's based on the header magic number
(0x4552), which differs from the partition magic (0x504D) but also from the
HFS+ magic (0x482B, 0x4858).
Please could you test it against an apple partmap?
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-28 21:20 ` Robert Millan
@ 2008-07-28 22:38 ` Robert Millan
2008-07-29 2:25 ` Chris Knadle
1 sibling, 0 replies; 21+ messages in thread
From: Robert Millan @ 2008-07-28 22:38 UTC (permalink / raw)
To: The development of GRUB 2
On Mon, Jul 28, 2008 at 11:20:26PM +0200, Robert Millan wrote:
> On Mon, Jul 28, 2008 at 03:25:00PM -0400, Chris Knadle wrote:
> > On Monday 28 July 2008, Felix Zielcke wrote:
> > > Am Montag, den 28.07.2008, 14:41 -0400 schrieb Chris Knadle:
> > > > However on the last test I did make an error and left out the -d
> > > > option to grub-probe, and that's required for the grub-probe to succeed,
> > > > so unfortunately the output I posted is erroneous.
> > > > A new one is attached which has Robert's patch applied -- it does
> > > > succeed in finding the partition, but unfortunately we can't fix the
> > > > problem this way because I believe it makes Apple partition detection
> > > > *always* fail.
> > >
> > > Urgs, yeah didn't see that.
> > > You have to use -d if you give a device.
> > > Why do you think that with this it will always fail?
> >
> > Because the test that the patch does is to check for an HFS+ filesystem
> > magic number against the first 2 bytes on the drive, which contains a jump
> > vector for the Grub stage1 binary. i.e. in order for the test to pass, Grub
> > has to be unbootable.
>
> My check has nothing to do with HFS+, it's based on the header magic number
> (0x4552), which differs from the partition magic (0x504D) but also from the
> HFS+ magic (0x482B, 0x4858).
>
> Please could you test it against an apple partmap?
Actually, it was simple for me to test, since Parted supports apple/mac
partition tables. The test I added succeeds with the partition I created,
so it must be good.
I just checked that in. Thanks a lot for the long & tedious debugging process.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: grub-probe fails to find PC partition due to Apple disklabel
2008-07-28 21:20 ` Robert Millan
2008-07-28 22:38 ` Robert Millan
@ 2008-07-29 2:25 ` Chris Knadle
1 sibling, 0 replies; 21+ messages in thread
From: Chris Knadle @ 2008-07-29 2:25 UTC (permalink / raw)
To: The development of GRUB 2
On Monday 28 July 2008, Robert Millan wrote:
> On Mon, Jul 28, 2008 at 03:25:00PM -0400, Chris Knadle wrote:
> > On Monday 28 July 2008, Felix Zielcke wrote:
> > > Am Montag, den 28.07.2008, 14:41 -0400 schrieb Chris Knadle:
> > > > However on the last test I did make an error and left out the -d
> > > > option to grub-probe, and that's required for the grub-probe to
> > > > succeed, so unfortunately the output I posted is erroneous.
> > > > A new one is attached which has Robert's patch applied -- it does
> > > > succeed in finding the partition, but unfortunately we can't fix the
> > > > problem this way because I believe it makes Apple partition detection
> > > > *always* fail.
> > >
> > > Urgs, yeah didn't see that.
> > > You have to use -d if you give a device.
> > > Why do you think that with this it will always fail?
> >
> > Because the test that the patch does is to check for an HFS+
> > filesystem magic number against the first 2 bytes on the drive, which
> > contains a jump vector for the Grub stage1 binary. i.e. in order for the
> > test to pass, Grub has to be unbootable.
>
> My check has nothing to do with HFS+, it's based on the header magic number
> (0x4552), which differs from the partition magic (0x504D) but also from the
> HFS+ magic (0x482B, 0x4858).
>
> Please could you test it against an apple partmap?
I just tested this on the iMac with a different HD and installing Debian
Lenny Beta2 (since I couldn't find a download for Etch) -- took forever to do
but turns out it was worth it -- your patch WORKS! :-) Congratulations.
This also means I misunderstood several things. I must have misread what
exactly the 0x4552 magic number pertained to. Ugh.
Thanks very much for hanging in there and fixing this.
-- Chris
--
Chris Knadle
Chris.Knadle@coredump.us
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2008-07-29 2:25 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-13 21:34 grub-probe fails to find PC partition due to Apple disklabel Chris Knadle
2008-04-14 12:07 ` Robert Millan
2008-04-14 14:21 ` Chris Knadle
2008-04-14 17:20 ` Pavel Roskin
2008-04-15 13:15 ` Robert Millan
2008-04-15 15:17 ` Pavel Roskin
2008-04-15 14:06 ` Chris Knadle
2008-07-23 2:53 ` Chris Knadle
2008-07-23 3:48 ` Pavel Roskin
2008-07-23 19:10 ` Chris Knadle
2008-07-23 20:47 ` Chris Knadle
2008-07-25 20:27 ` Robert Millan
2008-07-25 23:09 ` Chris Knadle
2008-07-27 19:53 ` Felix Zielcke
2008-07-27 20:33 ` Felix Zielcke
2008-07-28 18:41 ` Chris Knadle
2008-07-28 18:55 ` Felix Zielcke
2008-07-28 19:25 ` Chris Knadle
2008-07-28 21:20 ` Robert Millan
2008-07-28 22:38 ` Robert Millan
2008-07-29 2:25 ` Chris Knadle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.