Ubuntu – Installer does not see windows trying to dual boot.

dual-bootinstallation

I am trying to install Ubuntu alongside windows. What I boot off the install media and run the installer I get to the patition selection window and it tells me that there are no other operating systems on the computer. I know there are, as I can restart and it will boot into windows also I can mount the two partitions (windows, data) and see everything on the partitions. Anyone have any ideas on fixing this?

Thanks.

Best Answer

  • Assuming there's not a more simple answer, I would personally opt to skip out the automated OS detection and to do it myself:

    1. Boot to the LiveCD, use GParted to shrink the Windows partition.

    2. Run the installer and install to the spare space, letting GRUB eat the boot sector.

    3. Reboot into Ubuntu (it won't give you the option of Windows)

    4. Fix GRUB to allow you to use Windows. Essentially you just want to just chainload onto the windows partition (which I assume you left as the first on the first drive) but you can't do that by simply editing a config file because GRUB is generated dynamically. You have to write a script that update-grub can call each time it rebuilds the bootloader:

      Start by running sudoedit /etc/grub.d/15_windows and in that file, paste in out:

      #!/bin/sh -e
      cat << EOF
      menuentry "Windows 7" {
          set root=(hd0,1)
          chainloader +1
      }
      EOF
      

      Save that, run sudo chmod a+x /etc/grub.d/15_windows and then run sudo update-grub. This should edit the boot sequence and now in GRUB you should see a Windows option. (You might have to hold left-shift to see grub! You can edit that option in /etc/default/grub)

    Be prepared for the worst.

    You're dealing with important things here. A smart man plans ahead.

    • Make a backup of anything on the Windows partition you cannot replace and would miss if it was nuked from orbit. You're resizing a partition. This is dangerous. Not as dangerous as swimming in a lake full of freshwater crocodiles but up there with not wearing high-SPF sun cream.

    • Make sure you have a rescue disk for Windows. Be that an original installer or some sort of other device that you can run bootrec.exe from.

    • Wear a condom. You don't know where Windows' boot sector has been.

    • Don't do this the day/hour before you really need the computer to do something. If it does go wrong, you're under pressure and you're more likely to make a mistake and make it irreparably worse.