Recover grub2 after Windows 8 install

So, I had Windows 7, Ubuntu happily coexisting with a Grub2 on MBR. I installed Windows 8 as a fresh installation after deleting the Windows 7 files (Program Files and Windows directory) to preserve my data, and as expected the Windows 8 Bootloader overwrote Grub2, leaving me with no option to Boot into Ubuntu.

The following is the procedure I followed to recover Grub:

Boot into a Live CD of Ubuntu.

Run a terminal as root and get the hang of the partitions:

[email protected]:~$ sudo su
[email protected]:/home/ubuntu# fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00073736

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 186062847 93030400 7 HPFS/NTFS/exFAT
/dev/sda2 186062848 248309759 31123456 7 HPFS/NTFS/exFAT
/dev/sda3 248309760 268789759 10240000 83 Linux
/dev/sda4 268789760 625141759 178176000 5 Extended
/dev/sda5 549278478 592364744 21543133+ 83 Linux
Partition 5 does not start on physical sector boundary.
/dev/sda6 592375808 625141759 16382976 82 Linux swap / Solaris
[email protected]:/home/ubuntu#


Now, we bind the device which contains the Linux partition Boot (typically the First Linux partition)-/dev/sda3 in my example.

mount /dev/sda3 /mnt
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
cp /etc/resolv.conf /mnt/etc/resolv.conf
chroot /mnt
(This takes a few seconds)
grub --install --recheck /dev/sda


Note that the last command reinstalls grub to a location. In my case, I wanted to install to MBR of my first hard disk, so I used /dev/sda (Not /dev/sda3)
This procedure replaces the Windows 8 bootloader from MBR, in addition it also checks all the installed OSes that it can find on your system and adds entries for these to the new grub configuration file.

The process is now over and you can reboot now!


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

“Access denied” error while creating USB Install media for Windows 8

In my case it was simply a case of Avira Antivirus denying access to the pen drive’s boot sector. Simply disabling the antivirus worked!

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.
Clean install Windows 8 using the Upgrade license

Clean install Windows 8 using the Upgrade license

Ever since the Windows 8 was released, many people have been aware of a loophole which allowed people to upgrade even from pirated Windows versions to the latest PC Operating system by paying a pittance-actually Rs 699 for people in India. The offer was originally intended for people who have purchased a Windows based PC in the last 4 months to upgrade to Windows 8 easily. However people in India soon realized that MS wasn’t employing any verification for whther the software running on the system was actually genuine or a pirated one.

It is now known that MS has closed this loophole, and that people now need to enter the original Windows 7 key while upgrading, which is then checked against the activation date and only then is upgrade allowed. I’ve been of the opinion that it was actually a well designed strategy on the part of Microsoft to get people from India to move from pirated version of Windows to a genuine one. I’d also been of the opinion that if  software companies price the software cheaply, there are people willing to upgrade. So far Windows products had been priced at a premium price of around Rs 6000 for the basic Windows 7 HomeBasic to Rs 10,000 for the Windows 7 Pro version. Compared to this, the price of Windows 8 Pro Upgrade is indeed a massive shift from earlier trends.

Although the upgrade offer is designed to allow only people running a genuine version of Windows to upgrade, in this short writeup, I describe a method to do a clean install of Windows 8 on a system without any Windows running. This requires a single Registry edit. If however you’re running another version of Windows, you can upgrade simply by booting off the USB Key or DVD. In any case, before beginning, you need to have either burned the downloaded ISO to a DVD or made a pendrive bootable. The ISO generation and Pendrive system image is made with the Windows 8 Upgrade Assistant.

This method describes how to do a clean install of Windows 8 using the Windows 8 Upgrade option (sold by Microsoft for Rs 699).

First, visit this page for the upgrade offer. Hit “Continue” to get started.

Enter your registration details including your email address. Microsoft will now send a Discount coupon to your email and a link to download Upgrade Assistant

Run the program you just downloaded (Windows8-UpgradeAssistant.exe) from the computer you plan on upgrading to Windows 8 on. If that’s a different computer than the one you’re on, move the program file there.

On running the program, it gives a list of compatible and non-compatible programs. Then it makes you choose the kind of installation you want. If you want to do a clean install of Windows 8, choose to retain “Nothing” and proceed.

The Upgrade Assistant takes care of the Purchase from Microsoft, and after submitting your Personal Info and Credit Card/Paypal details (Indian debit cards are not supported), you will be shown a purchase confirmation screen which shows a cost of Rs 1999 for the Windows 8 pack. A DVD costs Rs 1080 in addition. There is a field to enter the Promo code that Microsoft sent emailed you.

Choosing any other option (e.g. Windows settings, personal files, and apps or Just personal files), if you get one, would actually be an upgrade download of Windows 8, and cannot be used for a clean install of Windows 8.

Click the Order button on the Windows 8 for you screen, next to Windows 8 Pro and follow the ordering instructions given.

Tip: There’s no need to order the Windows DVD since you’ll be downloading a full disc image which gives you the ability to make your own disc for backup.

Your Windows 8 Pro product key will be displayed on the Thanks for your order screen, which you’ll see after your order successfully processes. Print and keep a safe copy of the license key. A confirmation email should also follow soon.

Important: Don’t lose your product key! You’ll need your product key each time you install Windows 8. You should also have received an email with your Windows 8 Pro order and that email also contains a copy of your key. Save it, print it, whatever you need to do. Just don’t lose it.

Next, the upgrade assistant downloads Windows. You can also use a seperate program called Windows8-Setup.exe to download Windows without going through the Order process if you’ve already done it once.

Note: Windows 8 isn’t installing right now, the installation files are just being downloaded to your computer in preparation for the next step.

Once the download is complete, you’ll see Checking the download and Getting files ready screens. Just wait those out.

On the Install Windows 8 screen, choose Install by creating media and then click Next.

If you Install now, you’ll be upgrading from your current operating system (e.g. Windows 7, Windows Vista, or Windows XP) but what you want to do is boot from some media, like a disc or a flash drive, so you can perform a clean install of Windows 8.

On the Choose which media to use screen, you can choose either USB flash drive or ISO file.

If you plan on installing Windows 8 from a disc, choose ISO file, click Save.

A Windows.iso file will be created on your Desktop, or wherever you decided to have it saved to in the last step.

Next you’ll see the Burn the ISO file to a DVD screen, plus a reminder about your product key.

You can either click the Open DVD burner link and burn the ISO file to a disc that way, or you can just click Finish and use whatever other disc burning program you’d like. See How To Burn an ISO File to Disc if you don’t use the built-in tool.

For doing a clean install, reboot using the newly burned DVD and choose a Custom install option.

Before Windows Boots up for the first time, disconnect the Net connection, and make the following Registry Key change:

The upgrade DWORD is by default on a value 1. Changing it to 0 lets activation work even if it is not an upgrade but a clean install after formatting the drives (No existing Windows version at the time of install).

If you'd forgotten to disconnect the Internet, and ended up with a non-activated version, you need to make the registry change, rearm Windows activation (make it activate itself again) and reboot.

To rearm, do the following in an elevated Windows prompt, by opening Command Prompt as Administrator and enter the following:
slmgr -rearm

Now, reboot. Activation show now work!

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Recover Windows 7 in Bootloader after installing older Windows or Linux over it

It is a typical situation. You installed Ubuntu or Windows XP over Windows 7, and now you can boot only the last installed OS. You wish to get back the multi boot menu that lets you boot all OSes

The first step is to restore the Windows 7 bootloader

Boot off the Windows 7 installation disc, click through all options till you get an option “Repair your computer” in bottom left. Choose the correct Windows 7 partition and click Next.

Now you get the System recovery Command Prompt

To restore the Master Boot Record with Windows 7 entry:

bootrec /fixmbr


If this fails to fix your issue, you can write a new boot sector to System partition with:

bootrec /fixboot


All the options supported by bootrec can be viewed with:

bootrec /?


Recover Windows 7 Bootloader after installing Windows XP on top of Windows 7:

bootrec /nt60 all


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.