Author Topic: [SOLVED] Wrong OS X gets loaded despite having chosen different one  (Read 4865 times)

0 Members and 1 Guest are viewing this topic.

tempolo

  • Member
  • Posts: 82
    • My own Hackintosh page
Not sure if this is a bug or just a case of me understanding something wrong:

Until yesterday, I had installed Chameleon 2.0 RC1 only onto an USB stick. I then had several bootable OS X volumes: one on the PC's internal disk (MBR partition scheme), another one on an external hard disk connected via USB.

When booting with Chameleon, it always offered me the choice of booting either OS X installation and it all worked (ie. either one could be booted).

Then I installed Chameleon directly onto the PC's internal disk. Since then, no matter if I boot the newly installed Chameleon of the internal disk or use the one on the USB stick, the following problem exists:

I can still select between the interal and the external OS X installation, and when I choose either and press Return, the chosen disk actually starts having activity, suggesting that the OS gets loaded from there. But after a few seconds, the boot process continues only form the internal disk. Thus, I can not boot the OS X from the external disk any more.

Any idea why?

Or how could I debug this? Using -v, the messages go by way too fast. (Maybe it would be good to add a boot loader option that lets me press a key to continue once a full page of text has been printed?)
« Last Edit: June 17, 2009, 01:49:18 PM by tempolo »

tempolo

  • Member
  • Posts: 82
    • My own Hackintosh page
Re: Wrong OS X gets loaded despite having chosen different one
« Reply #1 on: June 17, 2009, 12:48:03 PM »
I am slowly getting a hunch why that happens:

I can in fact boot different OS X disks, just not that particular one.

And that particular was is a block-for-block copy of the one on the internal disk (i.e. I had originally booted OS X from the external disk and eventually copied that working OS X over to the PC's internal disk so that I did not need the external disk any more).

Maybe the kernel sees them both as identical disks (due to them having the same volume IDs) and thus they get confused.

If that's the case, this is indeed not a Chameleon bug.

To verify this, I need to figure out which IDs I need to alter on one of the volumes. Any suggestions?

(update) It's not the volume creation date stored in the volume header (sector 2, offset $10)

« Last Edit: June 17, 2009, 01:11:16 PM by tempolo »

zef

  • Administrator
  • Posts: 265
Re: Wrong OS X gets loaded despite having chosen different one
« Reply #2 on: June 17, 2009, 01:20:21 PM »
The booter passes the selected volume's UUID, but in your case you have two volumes sharing the same ID, so you can't control exactly what system should be booted by the kernel. Take a look at i386/boot2/options.c/processBootOptions():

Code: [Select]
if (!uuidSet && gBootVolume->fs_getuuid && gBootVolume->fs_getuuid (gBootVolume, uuidStr) == 0) {
    verbose("Setting boot-uuid to: %s\n", uuidStr);
    copyArgument(kBootUUIDKey, uuidStr, strlen(uuidStr), &argP, &cntRemaining);
    uuidSet = YES;
}
ASUS P8Z68-V PRO/GEN3 | i5-2500k | 16GB RAM | GTX560 | Keyboard | Mouse | Devilsound DAC

tempolo

  • Member
  • Posts: 82
    • My own Hackintosh page
Re: Wrong OS X gets loaded despite having chosen different one
« Reply #3 on: June 17, 2009, 01:31:06 PM »
Thanks, zef.

But where does the booter take the volume's UUID from? Because I'd like to change one of them so that they have different ones.

(update, after looking at the 1.0.11 source, which is a bit different from what zef quoted:)

Aha, it takes it from 8 bytes in the volume header's FInfo/FXInfo, at offset 24 therein (that's at offset $68 in the 3rd sector of the HFS+ partition).

So, to summarize:

If you have copied an OS X volume to another partition and if then either of the copies won't boot up any more if you choose it in the boot loader, then make sure that the two volumes in question have different UUID codes: Using a sector editor (such as http://apps.tempel.org/iBored/ ), look at sector #2 of each of the HFS+ volumes (i.e. partitions) and compare the 8 bytes at offset 68(hex). If they are equal, you have a UUID conflict. Simply alter any of the bytes to some other value of your own choice, and you should be good.


(@rocksteady: you're welcome to move this from "bugs" to general questions in this forum)
« Last Edit: June 17, 2009, 03:17:35 PM by tempolo »

BladeRunner

  • Member
  • Posts: 88
Re: Wrong OS X gets loaded despite having chosen different one
« Reply #4 on: June 17, 2009, 06:09:07 PM »
Thanks, zef.

But where does the booter take the volume's UUID from? Because I'd like to change one of them so that they have different ones.

(update, after looking at the 1.0.11 source, which is a bit different from what zef quoted:)

Aha, it takes it from 8 bytes in the volume header's FInfo/FXInfo, at offset 24 therein (that's at offset $68 in the 3rd sector of the HFS+ partition).

So, to summarize:

If you have copied an OS X volume to another partition and if then either of the copies won't boot up any more if you choose it in the boot loader, then make sure that the two volumes in question have different UUID codes: Using a sector editor (such as http://apps.tempel.org/iBored/ ), look at sector #2 of each of the HFS+ volumes (i.e. partitions) and compare the 8 bytes at offset 68(hex). If they are equal, you have a UUID conflict. Simply alter any of the bytes to some other value of your own choice, and you should be good.


(@rocksteady: you're welcome to move this from "bugs" to general questions in this forum)


This is just my opinion, but I think the best way to clone a copy of OS X is the following:
  • Boot your USB stick or your installer disk and use disk utility to make an image (dmg) of the system to be cloned.
  • Use Disk utility to format the partition where the clone will live
  • Use disk utility to restore the image to the newly formatted partition

At this point, you have two copies of OS X each having a different UUID.  If you are using Chameleon2 you should have an Extra folder in each copy of OS X.  Use disk utility -> Info to get the UUID for each copy of OS X.

Edit Extra/com.apple.Boot.plist in each copy of OS X and insert the boot-uuid like this:

Code: [Select]
    <key>boot-uuid</key>
    <string>4892AA6A-D880-388D-BEB5-7BF25907C5CB</string>

That should eliminate the problems.  At least it did for me.  I have multiple drives with OS X installed and some drives have two different copies of OS X on them.
Base system: HP Pavilion P6340f Desktop  Intel� Core2Quad�  CPU: Speed: 2.66 GHz   Package: Socket 775 LGA:  L2 Cache 2 x 2048 KB  RAM : 8.0 GB:  DDR3

Disks : 2 eSATA @ 2 TB (hardware raid 1), NAS 4 x 2 TB raid 5 Display : 21" Samsung on EVGA GeForce 9400 GT - PCIe - 1900x1080  Keyboard/mouse :  USB connected  OS Version : 10.6.0 from retail DVD + SW update to 10.6.5 - Kernel:  Vanilla mach_kernel

tempolo

  • Member
  • Posts: 82
    • My own Hackintosh page
Re: [SOLVED] Wrong OS X gets loaded despite having chosen different one
« Reply #5 on: June 17, 2009, 06:26:57 PM »
Bladerunner, no need to quote the entire long msg when it's just above/below it.

Yes, I usually also recommend using Disk Utility for this, especially because it also adjusts the volume size to the partition it's copied into.

I had done a block-by-block copy for other reasons, though, without realizing this caveat.

Edit Extra/com.apple.Boot.plist in each copy of OS X and insert the boot-uuid like this:
Code: [Select]
    <key>boot-uuid</key>
    <string>4892AA6A-D880-388D-BEB5-7BF25907C5CB</string>
That should eliminate the problems.  At least it did for me.  I have multiple drives with OS X installed and some drives have two different copies of OS X on them.
OK, that's goot advice if one needs to change the UUID.

However, I think that this is not necessary when cloning drives using Disk Utility because DU then modifies the volume's UUID automatically. Or did you run into this problem despite using DU?

« Last Edit: June 17, 2009, 06:28:59 PM by tempolo »

BladeRunner

  • Member
  • Posts: 88
Re: [SOLVED] Wrong OS X gets loaded despite having chosen different one
« Reply #6 on: June 17, 2009, 10:39:15 PM »
I understand that disk utility sets the partition UUID.  That's why I suggested using it.  That way there is no chance of two systems with the same ID. 

The reason for putting the boot-uuid key/value in the Extra/com.apple.Boot.plist is to insure that the correct partition is started when there is more than one to chose from on a drive.  Better to be explicit

Like I said, it's my preferred methodology, and it saves me problems.
Base system: HP Pavilion P6340f Desktop  Intel� Core2Quad�  CPU: Speed: 2.66 GHz   Package: Socket 775 LGA:  L2 Cache 2 x 2048 KB  RAM : 8.0 GB:  DDR3

Disks : 2 eSATA @ 2 TB (hardware raid 1), NAS 4 x 2 TB raid 5 Display : 21" Samsung on EVGA GeForce 9400 GT - PCIe - 1900x1080  Keyboard/mouse :  USB connected  OS Version : 10.6.0 from retail DVD + SW update to 10.6.5 - Kernel:  Vanilla mach_kernel