Ubuntu 10.4 LTS (Lucid Lynx) – Dual Booting

On Thursday Canonical released the final spin of Ubuntu 10.04 (Lucid Lynx).  10.04 is a major release for Ubuntu, as it is the Long Term Support (LTS) version.  This means that Canonical will support the desktop version for  3 years and the server version for 5 years.  Other versions will be released in between that time, but they are not supported for as long as the LTS versions. When it comes to Open Source Operating Systems, my favorite has clearly become Ubuntu.  I like the community, I like the company and they way it works fits with the way I think.

I do consider myself an early adopter, so when the new versions are out, I do upgrade.  By jumping in early, I see aspects of the OS that I can learn from and can sometimes contribute back when the final version is released by helping others overcome similar problems.  Having said that, I did start using Lucid when Beta 1 was released.  Do I always upgrade my main computer right away?  Not every time, I have several older computers that I have tried upgrades and install on, so that I can make sure I am familiar with the process.  In addition to the old computers, I have a fair bit of experience with Virtual technology and do spin up virtual systems to test and play with an OS or application.

I have been known to put some peer pressure on my friends to live on the edge with me.  Yesterday was one such day.  I convinced Rich to upgrade his 9.10 install to Lucid.  He runs a dual boot system and has Windows 7 as his other OS.  Many people dual boot, there are certainly times when Windows is the only option (iTunes) and it is necessary to use it.  There is a problem here that the upgrade to Lucid is not overly intuitive when the Grub2 update is installed, nor does it explain what to do very well.  In fact, I would hazard to say that the instructions provided actually cause the wrong decision to be made.  Selecting the wrong options, will break your ability to dual boot into Windows.  I selected the wrong options when I upgraded my system, resulting in a blinking cursor when I wanted to boot to Windows.  I decided to give up Windows on my main computer, and just run Ubuntu.  I’ve running this way for a while now, and am quite happy without Windows here.

When Rich was upgrading, I advised him as to what happened to me – and believed that I had the correct options identified.  Long story short, the install broke his dual boot as well.  Rich needs his Windows install, so fixing him up is my priority.  Researching the forums, shows that many people have run into the exact same issue, and there seems to be a variety of suggestions on how to fix it.  Unfortunately, it seems as though some of the suggestions conflict with each other.  So the trick now is coming up with a plan and following it.

  • Fix the system so it boots into Windows
  • Repair or replace Grub or Reinstall Ubuntu

For the purposes of this article, we’re going to focus on fixing Grub, however I will be writing another article on how to set up Windows to give an Ubuntu option on its boot menu.

Let’s get started…

As always, please read my disclaimer.

Fixing Windows 7 Boot

This is probably the easiest part of the process.  Microsoft has a good tech document on fixing the Master Boot Record (MBR) on Windows 7, the document ID is 927392 and can be found here:  http://support.microsoft.com/kb/927392.  The document will work for Windows 7 and Vista.

Be aware, when you do this process, your Grub menu will be gone, and the computer will ONLY boot into Windows.  You are then at a point where you will need to fix grub, reinstall Ubuntu or set up the Windows boot.ini to launch Ubuntu as an option.

Rather than rewrite and risk errors, here are the high level instructions from the document.  Please do read the entire Microsoft Document before you do this.

Put the Windows Vista or Windows 7 installation disc in the disc drive, and then start the computer.

Press a key when you are prompted.

Select a language, a time, a currency, a keyboard or an input method, and then click Next.

Click Repair your computer.

Click the operating system that you want to repair, and then click Next.

In the System Recovery Options dialog box, click Command Prompt.

Type Bootrec.exe /FIXBOOT, and then press ENTER.

Remove the Windows 7 install media, and reboot.  Your computer should now boot directly into Windows.

Fixing Grub

At this point, things can get a little confusing.  There are a lot of suggestions on how to fix Grub, I’m going to use the instructions direct from Ubuntu as the first step.  They can be found here:  https://help.ubuntu.com/community/Grub2

You will need an Ubuntu  LiveCD to do this.  Make sure that it is the same version as the Ubuntu you are fixing, and is the same architecture (amd64,  i386, ppc etc…).

It is also worth noting that these instructions are specific to Grub2.  I am not certain what would be different for the original Grub, but I’m sure a little Googling will find the answer.

Here is the process to follow:

Boot to the LiveCD Desktop

Open a terminal by selecting Applications, Accessories, Terminal from the menu bar.

Identify the Ubuntu installation. The fdisk option “-l” is a lowercase “L”.

sudo fdisk -l

You should see a bunch of text scroll by that looks something like this:

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x975d2e54

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       58336   468583888+  83  Linux
/dev/sda2           58337       60801    19800112+   5  Extended
/dev/sda5           58337       60801    19800081   82  Linux swap / Solaris

What is important out of this information is the drive that is your “Linux” drive.  On my system, I would look for this:

“/dev/sda1   *           1       58336   468583888+  83  Linux”

Mount the partition containing the Ubuntu installation.

sudo mount /dev/sd”XY” /mnt

X is the letter after “sd”, for my system it is “a”
Y is the number after “sdX”, for my system it is “1”

Example: sudo mount /dev/sda1 /mnt
Note: If the user has a separate /boot partition, this must be mounted to /mnt/boot.  The default Ubuntu install does not create a separate boot partition, if you’ve gone and customized your install, I would suggest seeking additional advice from the Ubuntu Forums.

Run the grub-install command as described below. This will reinstall the GRUB 2 files on the mounted partition to the proper location and to the MBR of the designated device.

sudo grub-install ––root-directory=/mnt/ /dev/sdX

Example: sudo grub-install ––root-directory=/mnt/ /dev/sda

You should receive a message that the install completed with no errors.

Reboot

At this point, you should see a grub menu that includes your Windows option.

Refresh the GRUB 2 menu

sudo update-grub

Your dual boot system should now be up and running, with no issues.  Please provide me with feedback on this article, I will update as I am able to identify problems and/or fixes.

Alternative Solution
I was perusing the UbuntuForums and found a few people referencing another fix for this problem.  If you are uncomfortable with the above steps, you might want to take a look.

http://sourceforge.net/apps/mediawiki/bootinfoscript/index.php?title=Boot_Problems:Boot_Sector

I can’t speak for it, but it does seem to be the solution they are recommending for anyone who’s posting the Windows 7 Dual Boot blinking cursor.  It seems to me like it takes all the fun out of fixing the problem…

Credit & Sources
UbuntuForums – http://ubuntuforums.org
Microsoft Support Site – http://support.microsoft.com
Ubuntu Community Help – https://help.ubuntu.com/community/

Changes
5/3/2010 – Corrected Windows 7 repair command
5/2/2010 – Added alternative solution
5/1/2010 – Updates based on Grub fix testing
5/1/2010 – Article Created

This entry was posted in System Administration, Ubuntu and tagged , , , , , , , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback.

2 Comments

  1. prj
    Posted August 27, 2010 at 1:36 pm | Permalink

    I too had a dual boot HP laptop with Windows 7 and Ubuntu 9.10. The main partition holds Windows and Ubuntu was on sda5. When I installed Ubuntu, I put grub on sda5. I wanted to use the Windows boot loader and used a live CD to snag the Linux boot sector (once 9.10 was installed) and then bcdedit to add this boot sector to the windows loader selections. All worked well.

    Then I upgraded 9.10 to 10.4. That appeared to go well (though the question about keeping my current grub config bothered me and I answered yes to it). But when I booted after the upgrade and selected Ubuntu from the Windows loader menu, it went off and ended up in a grub2 rescue prompt. I then used a live cd to snag the boot sector again (which I am not sure is still there) from sda5, went through the bcdedit process and rebooted. Now when I select Ubuntu, I am taken to yet another Windows provided screen that says the thing I am trying to boot is broken or unrecognizable.

    I am a bit fearful of clobbering my Ubuntu partition and doing a new dual boot install of 10.4. I am afraid it will not handle the placement of grub2 properly like 9.10 did.

    Do you know of anyone else in this situation?

    Thanks!

    • Posted August 29, 2010 at 8:43 am | Permalink

      Yes – that’s the issue my dual booting article covers…. you might be able to get more help at the ubuntu community forums as well.

      Jeff

Leave a Reply

%d bloggers like this: