Ubuntu 12.04 installer does not recognize Windows 7

I recently purchased an ASUS N56VZ-ES71 laptop which came with Windows 7 Home Premium installed on it. I wish to dual boot Windows 7 and Ubuntu 12.04 on it. I shrank the hard drive partitions to leave about 150 GB unallocated for Ubuntu 12.04. When I boot the Live CD of Ubuntu and attempt to install, the installer does not recognize any other operating systems. Through reading a few questions, I have found that this is due to a GPT partitioning table that Windows uses.

I ran boot-repair as per other threads' suggestions. This was my output: http://paste.ubuntu.com/1176988/

I suppose my question is: how do I proceed in order to get the installer to recognize Windows, so that I don't have to erase the current partition table and can get a safe install?

Thanks in advance.


Solution 1:

First, GPT is not, in and of itself, the problem. The error you report (no partitions appearing in the installer) is indicative of a partition table problem. It's a long-standing bug of libparted (which the installer uses) that broken partition tables show as if they were blank disks. GPT is supported by libparted, though, and Ubuntu will install to GPT disks.

The key is this:

/dev/sda1 ends after the last sector of /dev/sda

This error message refers to the GPT's protective MBR, which is a "fake" MBR partition table that exists just to keep GPT-unaware utilities from using the disk. Your protective MBR contains a protective 0xEE partition that's too big. This really doesn't matter, but it's triggering libparted's "broken partition table" bug.

The solution is to fix the protective MBR. This is easily done using gdisk or sgdisk, which are part of the gdisk package in Ubuntu; however, I'm not sure if that package is installable in a live CD. Therefore, I'll tell you how to do this from an emergency disk:

  1. Download Parted Magic and burn it to CD.
  2. Boot Parted Magic.
  3. Launch a terminal window (the icon of a monitor on the bottom of the screen).
  4. Type gdisk /dev/sda to launch gdisk. You should see some startup messages and a prompt that reads Command (? for help):.
  5. Type p in gdisk to view your partition table and verify that everything looks OK. If you see weird partitions, exit by typing q.
  6. Type x to get to the experts' menu. The prompt should change to read Expert command (? for help):.
  7. Type n. This generates a fresh protective MBR. The program will respond merely by displaying a new prompt.
  8. Type w to save your changes. The program will warn you it will overwrite your old partitions and prompt you for confirmation. Respond y.
  9. Reboot and try installing again. It should now work fine.

One caveat: Your computer is booting Windows in EFI mode, so you should also install Ubuntu in EFI mode. This is sometimes trouble-prone. I recommend backing up your EFI System Partition (ESP; /dev/sda1) while you're in Parted Magic or by using the Ubuntu installer. If you have problems after installing, you may need to install a new boot loader. See my EFI Boot Loaders for Linux page for details.