As I explained in yesterday’s post, I rendered the Mac Book Pro that Red Hat sent me unbootable in OSX. So I spent some time trying to restore OSX on that machine. In the end, I was forced to wipe the disk clean and start over.

Before I did that, here are some things I tried that did not work.

Failure #1: Create a copy of a recovery HD

I first tried to create a copy of a Recovery HD partition on another similar laptop. The partition is only 650MB. It shows as follows with diskutil list:

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Macintosh HD            499.4 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

So I put an external USB stick and did a simple dd to copy that partition on the USB drive. Insert the drive into the dead laptop, boot while holding Alt, and sure enough, I have a new boot option.

What’s strange is that the boot option is called Marypuce, not Recovery HD as it shows in diskutil list or when I mount the stick on the Finder. In any case, it starts to boot, then dies miserably and reboots. No luck this way.

I could create a bootable install disk following these instructions, but I need to find a 8GB USB stick in my collection. The one I was using for install is 4GB only. Since I tend to keep USB sticks around without caring much for eons, they often “go bad” (which, in practice means that whatever you write, you read back FFFF on some sectors). So it’s not just a matter of finding a USB stick, I also need to spend some time to test it. Will do that later if all else fails.

Failure #2: Internet Recovery and hard disk repair

One of the nice features of Macs is Internet Recovery. If your copy of OSX no longer works at all, you can still boot OSX straight from an Apple server somewhere. All you need is to hold Command-R at boot time.

So I booted that and repaired the hard disk. It looked promising:

Checking prerequisites
Checking the partition list
Checking the partition map size
Checking for an EFI system partition
Checking the EFI system partition’s size
Checking the EFI system partition’s file system
Checking the EFI system partition’s folder content
Checking all HFS data partition loader spaces
Checking booter partitions
Checking Core Storage Physical Volume partitions
Verifying storage system
Checking volume
disk1s2: Scan for Volume Headers
disk1s2: Scan for Disk Labels
...

I really liked the part about checking the EFI system partition’s file system and folder content, since I thought this might be my problem. (And just I case you wonder, I did not manually copied the text above, the Internet Recovery has a fully functional copy of Safari, good enough to connect to a blog and copy-paste some tools’ output).

Well, my hopes were up, but it does not work. I still only have the Fedora option at boot time.

Failure #3: Install macOS Sierra from Internet Recovery

My third try was to install macOS Sierra directly from Internet Recovery. That this third attempt failed hints at something more sinister. The installer shows two partitions, the PtitPuce partition containing my OSX installation, and the Linux HFS+ ESP that Fedora created.

  • If I try to install OSX on the partition where it already is, I get the message “This disk cannot be used to start up your computer”.
  • If I click on the Linux HFS+ ESP partition that Fedora installed, then it tells me that the partition is not HFS+.

Disk Utility also lets me format the drives, but I’d like not to loose the little data I have on this disk. So I tried to erase the Linux swap partition instead (I’m pretty sure Linux should survive booting swap-less, we’ll see). Unfortunately, that’s not good enough, 8G is not large enough to install macOS Sierra.

The disk partitioning utility tells me that the macOS Sierra volume is the first volume on disk. So that looks OK. I don’t understand yet why it tells me it can’t boot from it.

Failure #4: Blessing the existing volume

I compared the output of gpt -r show /dev/disk0 on the working laptop and on the failing machine (with /dev/disk1 instead, since that’s where the Internet Recovery puts your hard disk), as well as the output of diskutil list. For some reason, Internet Recovery has dozen of disk images. But neither the GPT layout nor the disk descriptions show anything strange, except for the fact that the recovery partition is gone.

I figured that using bless to tell the firmware where to look for a boot file might be a good idea.So I ran Terminal from the Internet Recovery boot mode, and tried:

bless --device /dev/disk1s2 --setBoot

This had strictly no effect. So the reason my disk does not show up as bootable is not because the information about the blessed folder was damaged.

Rebooting once more in Fedora to check if removing the swap had damaged things. Apparently not enough to prevent Linux from booting. Note to self: re-partition to make that partition a swap partition again.

Failure #5: Disabling SIP

System Integrity protection is active by default on this Mac. So it’s possible that I cannot actually bless the Volume using the command above. In the Recovery terminal, I used csrutil disable. But then I need one more (Internet-based) reboot. Wait.

Trying again, blessing the folder, rebooting by setting up the startup disk on exit from the recovery mode. Still not good. I get a black screen, then I reboot into Fedora.

Failure #6: Removing the Linux partition

According to Apple, the problem with being unable to install on the macOS partition may be due to lack of space for the local recovery partition. And indeed, that partition is gone (I don’t remember ever asking Fedora to wipe it out). Since my Fedora install is fresh, I can remove it and reinstall later, so I decided to go ahead and do that.

Now I have 200GB of “Free Space”, but I get weird errors every time I try to repartition the disk. Essentially, Disk Utility won’t let me touch that “Free Space”. I can’t remove it (obviously, there is no partition there). I can’t add a partition there (instead, it downsizes the existing HFS+ partition, still leaving 200GB of Free Space). I can’t erase it. Clearly, something about the partition table on that disk freaks Disk Utility out.

Clean up and start over

If the partition itself is bad, it’s probably not such a good start. I spent a couple of hours already trying various things, and I don’t have that much data on the disk anyway (the machine is new). I’m more trying to figure out what went wrong than really worrying about any data.

Time to wipe out the disk and start over. So now I have a fresh new install of OSX, where I manually created all the necessary partitions for a Fedora install directly from OSX. Hopefully, that will work better.

Next issue: now the Fedora installer tells me that my USB key has gone bad 😦 Time to find a working USB key.

img_6290

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s