Wednesday, February 11, 2009

IE8 in Ubuntu with VirtualBox

2009-05-03 - Updated guide for Ubuntu 9.04, Virtualbox 2.2 and IE8 final.

2010-04-08 - Update - unfortunately, this is no longer a viable option, as Microsoft has changed its images to work only under Virtual PC. If you follow the directions above, you get a copy of Windows that has to be reactived, and will then shut down after 3 days (thanks anonymous).

If like me you are an Ubuntu user and web developer, you'll have been after a convenient way to test in Windows based browsers, without having to reboot or switch computers. Sure, there's IEs4Linux, but I've never found it a pleasurable experience, and what about testing other browsers in Windows?

Finally, a really convenient solution has come along in the shape of VirtualBox and some Microsoft supplied machine images. As of version 2.1.0, VirtualBox supports the VHD hard disk image format, which means it can run the images Microsoft helpfully supply for testing websites with different IE versions on Windows XP SP2, Windows XP SP3 and Windows Vista. These copies of Windows expire after 3 months or so, but it's far better than using dodgy downloaded copies. If you are comfortable installing non-free software, this is a very effective setup.

This guide is based on the great 10 Volt Media guide to installing Internet Explorer on OSX using VirtualBox, I have simply converted their procedure to make it suitable for Ubuntu 9.04 users.

The Windows images do have a habit of blue screening when booted in VirtualBox, so you have to tinker with them a little bit to get it working, but it's simple enough if you follow this guide.

After updating this guide to use Virtualbox 2.2 and the new Windows disk images, I no longer get the dreaded blue screen of death, so no need to fiddle around in safe mode. The USB and Audio devices no longer work, I will look into a fix for those.

I describe how to install the WinXP/SP2/IE8 disk image, but you can easily use one of the others if you'd prefer.

That's enough blathering, let's get on with it...

Install Virtual Box

Add the following source to /etc/apt/sources.list, or use Synaptic etc if you prefer.

deb http://download.virtualbox.org/virtualbox/debian jaunty non-free

Or, if you are still using Intepid:

deb http://download.virtualbox.org/virtualbox/debian intrepid non-free

Add the Sun public key.

$ wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add -

Install VirtualBox, accepting prompts to create the vboxusers group and compile the VirtualBox kernel module.

$ sudo apt-get update && sudo apt-get install virtualbox-2.2

Restart for good measure (and to get the VirtualBox menu item).

Download and extract the virtual hard disk image

Create a dir to hold the VHD file.

$ mkdir -p ~/VirtualMachines/HardDisks && cd ~/VirtualMachines/HardDisks

Download the IE8RC1-XPSP3.exe file, it's quite a large file so why not go and make a nice cup of tea...

$ wget http://download.microsoft.com/download/B/7/2/B72085AE-0F04-4C6F-9182-BF1EE90F5273/IE8-XPSP3.exe

Once it's finished, extract the vhd file.

$ unrar e IE8-XPSP3.exe XP\ SP3\ with\ IE8\ 2009-Apr.vhd

Remove the exe, you won't need that anymore.

$ rm IE8-XPSP3.exe

Create Virtual Machine

Launch VirtualBox from the Gnome menu, Applications > System Tools > Sun xVM VirtualBox

Create a new VM by clicking New.

Give it a name and set operating system as Windows XP.

Assign some RAM, no more than half your physical RAM is advisable.

At the Virtual Hard Disk screen click Existing to open the Virtual Media Manager.

Click Add and select the VHD file extracted earlier.

Click Select to close the Virtual Media Manager.

Click Next then Finish, you'll return to the main VirtualBox app which should now list your

new VM.

Configure Windows VM

Select the VM in Virtualbox then press Start to power it up

Dismiss any windows, dialogs, etc.

Devices > Install Guest Additions

Follow the prompts, accepting default values to install VirtuaBox Windows additions.

Choose to reboot machine when complete - Machine > Reset

Click OK to mouse pointer dialog, you won't need to maually capture the mouse again, handy!

Start > Run > "cmd"

> D:\VBoxWindowsAdditions-x86.exe /extract /D=C:\Drivers
Start > Administrative Tools > Computer Management

Select Device Manager.

Select Batteries, Unknown Device -> Disable

Select Sound, video and game controllers, Multimedia Audio Controller -> Disable

Select Universal Serial Bus controllers, Universal Serial Bus (USB) Controller -> Disable

Select Network Adapters, Ethernet Controller -> Update Driver

Select Yes, now and every time, click Next

Select Install from a list or specific location, click Next

Enter location "C:\Drivers\x86\Network\AMD"

Click Finish

Open a browser, test connection

You're done!

Bonus Tips

When closing the VM, choose "Save the machine state" to avoid watching tedious boot up screens when you restart it

Select Machine > Seamless Mode to hide the Windows desktop altogether leaving the application windows to run seamlessly alongside your Ubuntu windows. This is probably my favourite feature of VirtualBox :-)

Blue screen?

A previous version of this guide dealt with a problem where the Windows images would blue screen. This appears to have been fixed now, so try letting Windows boot first and hopefully everything will be fine, otherwise...

Hold F8 as the VM boots.

Choose "safe mode with command prompt".

Cancel any wizards, mising file dialogs that come up.

At the DOS prompt, enter

> cd \WINDOWS\system32\drivers
> ren processr.sys processr.old

Restart the VM - Machine > Reset

15 comments:

Anonymous said...

Great article - worked like a charm. I needed to modify your steps a tad because I went with IE7, but I am now proud to say that I will no longer have to boot to the Windows partition to work ever again if I don't want to!

Toni @ NavinoT said...

Thanks a blast. Be gone my days of frustation for unable to install thing IESP3. You save my day!

Philip Holly said...

Excellent article. Got past the blue screen of death with the IE6 XP Virtual PC image. I'm using Virtual Box for 64 bit and had no problems following the directions.

Dom said...

Perhaps you can help me? I tried to follow your article, and all went well until I have to enter the first command into the run box in windows: D:\VBoxWindowsAdditions-x86.exe /extract /D=C:\Drivers when I press OK, then I get the message: Please insert disk into drive D:. I thought that perhaps that was what was meant to happen, so I continued with the tutoruial, but at the stage of entering the directory for the network drivers I press next and it says: The location you specified does not exist or cannot be reached. Please enter another location or uncheck the 'include this location in the search' box. What have I done wrong?

Stephen Elson said...

Dom - it sounds like your virtual machine doesn't have the VirtualBox Guest Additions CD image mounted.

Power down the VM, then open the Settings dialog for it in VirtualBox and go to the CD/DVD-ROM section. Make sure "Mount CD/DVD ROM Drive" is ticked, and the ISO Image File dropdown is selected and set to "VBoxGuestAdditions.iso".

This is normally the default case with new VirtualBox VMs, not sure why it would not be mounted for you.

Dom said...

Thanks for that. I have another problem now. When I put the D:\VBoxWindowsAdditions-x86.exe /extract /D=C:\Drivers into the run dialogue, it starts up the guest additions image, has me run the install and then reboot (this doesn't appear in your tutorial). Then when entering the location C:\Drivers\x86\Network\AMD it gives the same error: The location you specified does not exist or cannot be reached. Please enter another location or uncheck the 'include this location in the search' box. Do you have any more thoughts?

Stephen Elson said...

Dom - running the guest additions CD image should be the same as the "Devices > Install Guest Additions" menu item, which was a previous step. No harm in doing it twice.

Have you tried entering "D:\VBoxWindowsAdditions-x86.exe /extract /D=C:\Drivers" into a DOS command window, rather than the Run dialog directly? That's actually how I do it, the instructions aren't very clear at this point I grant, but they do indicate that's the thing to do.

Let me know if that helps.

Dom said...

Nope. It just starts the setup again. What is it meant to do?

Stephen Elson said...

That is strange. The command should extract the contents of the exe file onto the C drive.
Can you confirm the command is being entered exactly as displayed in the article? Note that the backslashes are important, and should not be entered as forward slashes.
I'm sorry if that still doesn't work, I need to reinstall my VMs later today anyway, i'll follow my own instructions to make sure I didn't miss anything.

Dom said...

yes, I have put it in exactly as you have written it. I'm sure it must work normally since there are other users who have left comments saying that it works. There must be something different on my end, but I don't know what.

Anonymous said...

Hiya

Thanks for this, only problem is that XP keeps 'blue screening', telling me Unmountable Boot Volume. Anyone know how to fix this.

Stephen Elson said...

Hi Anon,

there is a section at the bottom of the guide for dealing with one cause of blue screens, but it doesn't sound like your issue. I would suggest trying the Virtualbox forums for a solution:

http://forums.virtualbox.org/

Steve

Jaran said...

Thanks for an execellent guide! Have been looking for a solution to the blue screen issue for a while. Working smoothly now :)

micmath said...

Thanks, it works on Mac 10.5 too.

clipping path services said...

I love the amount of details you gave in your instructions through this article. Looking forward to more from you.

Regards,
image clipping