Skip to main content

Restore Grub After Installing Windows 7

Dual booting. It can be a wonderful thing or a horrible nightmare. With Windows 7, users may have more than one reason to want the ability on their HTPC machines. Especially if several pieces of hardware just don't work as they should in Ubuntu.

The trick is, Windows 7, by default, wants to be the ONLY OS on your computer, even if you've already installed other OSes. My recommendation? Install Windows 7 first, in a carefully planned partition (create using Ubuntu LiveCD and GParted, of course), and then install Ubuntu.

But what if you just HAD to install Ubuntu first in that secondary partition and now need to install Windows? Windows will erase your Grub settings from the boot sector. This means no more ability to boot into Ubuntu. Oh No!

Not to worry, there's an easy way to recover from said disaster. I found this excellent post and here are the details for archival purposes:

This post discusses the easy way of restoring Grub2 using Ubuntu Live CD. First, boot with the Ubuntu Live CD. Now mount the partition, which has Ubuntu installed on it. If you had a separate partition for /boot, then you would have to mount that too. Mounting the partitions is super easy. Just go to Places in the top Gnome menu and try browsing to your corresponding partition by clicking on it. It would automatically get mounted and open in nautilus.

Now just run the following command to install Grub2 in the Master Boot Record (MBR) of your first booting hard drive.

sudo grub-setup -d /media/XXXXX/boot/grub -m /media/YYYYY/boot/grub/device.map /dev/sda

Where XXXXX represents the name or UUID of the partition that you have mounted. If your /boot partition is separate from your / partition then YYYYY above would be different from XXXXX, else both of them would be identical. The command above assumes that /dev/sda is your primary or first device in hard disk boot order. If not then replace it with /dev/sdb or sd_ fill the blank with appropriate letter.

After you have run the command, reboot and you should be able to boot in Ubuntu but not in Windows, to fix it run the following command in a terminal and Grub boot list would be updated to include Windows in it. Also if you want to change boot order read this.

sudo update-grub

Now reboot and you should have the choice to boot in both Windows and Ubuntu.

Comments

Popular posts from this blog

Black Cursors on Win7/2008 R2 Using rdesktop for Ubuntu 10.04

I recently setup a Win 2008 R2 VM and proceeded to remote connect to it from Ubuntu 10.04. Everything worked perfectly except the mouse cursors were black (and some were corrupt). Solution? Use a newer version of rdesktop that doesn't ship with Ubuntu. There is a handy PPA that can be added using the following command: sudo apt-add-repository ppa:ricolai/ppa sudo apt-get update sudo apt-get install rdesktop [UPDATE] It appears ricolai may have removed the package from his PPA. To remedy the situation, I've uploaded the working binaries for x64. Sorry, I don't have the x86 any longer. More information on the bug can be found here: https://bugs.launchpad.net/ubuntu/+source/rdesktop/+bug/385974?comments=all

Remote Connection: Free NX vs. VNC

Apparently, there's some debate in the Linux world about remote connections. I've been using VNC for 8 years or so now. It's reliable, but definitely slow. I've found that NoMachine's NX Server (free edition) suits my needs best. It works even better than Windows' Remote Desktop, and of course much better than VNC (which really stinks). In my case, it opens a new session, when I connect to the server, but I think it can be configured to connect to an existing session as well. You might want to give it a try: http://www.nomachine.com/products.php I'll give it a try and get back to you all... UPDATE: I've installed the server on both my laptop and my desktop Ubuntu machines following the instructions found at https://help.ubuntu.com/community/FreeNX . The results are astounding! While not identical in terms of functionality to VNC, I personally prefer the results. It's actually closer to an RDP session. I haven't tested the client to the ful...

Mounting VMware VMDK Disks in Ubuntu (Linux)

Took me a while to find the info on this, but it's fairly simple once you piece together all the information out there. First off, I'm not converting this to VirtualBox. I'm simply accessing the HD as though it were mounted on my local file system (Ubuntu). The VMDK image is for a WinXP virtual machine. First off, verify you have vmware-mount on your system. Drop to terminal, type "vmware-mount". You should get info regarding usage. If not, you need to install VMware Server or VMware Workstation (it's bundled with them). When prompted during the install, say 'Yes' to installing the additional tools packages. Not sure which one it's in, but it's there. Sorry, perhaps someone else can clarify this point. Next, navigate to the location of your VMDK and type "vmware-mount -p .vmdk". This will show you a list of mount points within the file (first column). Create /mnt/ using "mkdir /mnt/ " Next, type "sudo vmware-m...