Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Virtualization
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Virtualization
For questions on VMWare, VirtualBox, Xen, QEMU and other virtualization software.

 
Thread Tools Display Modes
Old April 26th, 2008   #1
Sand Lee
Way Too Much Ubuntu
 
Sand Lee's Avatar
 
Join Date: Mar 2007
Location: Georgia, USA
Beans: 303
Ubuntu Studio 9.04 Jaunty Jackalope
..::Updates::..

HowTo for Vista 1,2
VBoxForums Version


Introduction
I made this tutorial because I have been searching for an open source virtualization solution. I've tried VMware, but didn't like the GUI (it felt too slow) and the fact that it was closed source. Virtualbox was more appealing because it is open source and because it doesn't currently require a hack to get running in Hardy. After tons of research, I've found that the solution couldn't be simpler.
Please read or skim the tutorial before attempting it. Note: This tutorial was tested to work with VBox 1.6 and may not work for users w/ SATA drives.



Step 1: Create a grub boot cd
Creating a grub cd will let you boot straight into your target Windows partition.
Following method adapted from grub manual.

Code:
 cd ; mkdir -p iso/boot/grub ; cp /usr/lib/grub/*-pc/stage2_eltorito /boot/grub/menu.lst iso/boot/grub
Configure /home/you/iso/boot/grub/menu.lst to boot your target partition. Remove the "savedefault" option from your target entry if it exists. Then run the following to create the grub.iso file,
Code:
cd ; mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grub.iso iso
Step 2: Create a virtual disk (.vmdk)
When creating such a disk, it's preferable to only specify your Windows partition. This is a safety precaution that will prevent a data corruption problem that results from booting into the currently running OS. As a preliminary step, you must add yourself to the disk and vboxusers groups,
Code:
sudo usermod -G disk,vboxusers -a `whoami`
Log out and log back in here... and edit the following command to point to your WinXP partition: (I specified my WinXP partition - /dev/sda2 - with "-partitions 2")
Code:
VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/WinHD.vmdk -rawdisk /dev/sda -partitions 2 -relative -register
Step 3: Create a new hardware profile in WinXP
  • Click Start > Control Panel > System
  • On the Hardware tab, select Hardware Profiles
  • Click Copy, name the new hardware profile Physical
  • Rename the current profile to Virtual
Step 4: Change Windows XP's IDE controller
  • On the Hardware tab, select Device Manager
  • Right-click the IDE Controller and click Update Driver
  • Click No,.. and Next
  • Click [Advanced] and Next
  • Click Don't search... and Next
  • Select Standard Dual channel PCI IDE controller
  • Click Next, Finish, then Close and Reboot into Linux
Step 5: Run VirtualBox
  • Realize that you may have to reactivate your copy of XP
  • Create a machine that uses the created .vmdk (in the drop-down menu of the HD selection section)
  • Have this machine boot the CD-ROM first and mount the grub.iso file
  • You may have to try between the two IDE controllers types (Settings/Advanced) to see which works for you
  • Enable the IO-ACPI option and run your VM!

Step 6: Bypass Windows Activation [Experimental]
  • Follow the directions in this post
  • Give your feedback here
    • I will remove or improve this section as a result

*** TroubleShooting ***
  • Disk read error: 1, 2

*** Warning! ***
About Guest Additions!

Note: This problem may not exist for later versions of VBox (post-1.6).
Installing Guest Additions may cause the Windows installation in an existing partition to be unbootable (natively) - you might only be able to boot it from VirtualBox from there on out. This is a result of VirtualBox changing a significant amount of hardware in your configuration in order to have a user friendly virtual machine. If you already have installed Guest additions, you can try to remove it from within VirtualBox, and rebooting natively to XP.


ToDo:
  1. Find fix for native booting problem DONE*
  2. Easy .vmdk creation that doesn't require installation of another large or closed source program. DONE*
  3. Creation of boot.iso for direct booting w/o system's grub DONE
  4. Port tutorial to Ubuntu community documentation and official VirtualBox page
  5. Find constant-activation fix NOPE (see update)
Sources & Helpful Links:
VBox-migr, squidoo-virt, mazimi-virt, mazimi-bypass, mesbalivernes-virt, Dutch Translation

Comments and suggestions welcome!
Attached Images
File Type: png 1 Profile Selection.png (499.2 KB, 612 views)
File Type: png 4 Hardware Profiles.png (477.3 KB, 723 views)
File Type: png 2 XP Boot.png (348.8 KB, 7868 views)
Attached Files
File Type: doc WindowsProductActivationTechnicalMarketBulletin.doc (154.0 KB, 283 views)

Last edited by Sand Lee; April 13th, 2009 at 02:07 AM.. Reason: Tutorial Revamp, Boot Fix, Step 6
Sand Lee is offline   Reply With Quote
Old April 27th, 2008   #2
kabanta
A Carafe of Ubuntu
 
Join Date: Jan 2005
Beans: 86
Re: Boot an existing XP (Physical HD) install with VirtualBox

This is a very helpful guide. Since it warns that the result will make existing XP install unable to boot natively, it would be nice if there was a bit more detail to prevent confusion.

It may help clarify to point to some information about "dedicated grub partitions" (e.g., here)

More important, for the VBoxManage command, can you provide more detail about what is your directory structure?

Is /dev/sda1 your windows partition?
Is /dev/sda2 your dedicated grub partition?

thanks.
kabanta is offline   Reply With Quote
Old April 28th, 2008   #3
gladstone
A Carafe of Ubuntu
 
Join Date: Sep 2007
Beans: 102
Xubuntu 8.04 Hardy Heron
Send a message via AIM to gladstone Send a message via Yahoo to gladstone
Re: Boot an existing XP (Physical HD) install with VirtualBox

So, by following this guide, I would be able to boot my existing Windows partition as a virtual machine in VirtualBox?

This sounds good, but I think I'm going to wait until it's possible to boot back into Windows natively. Whats the reason stopping this atm?

Also, what's the issue with GRUB when using this method? i.e. if you dont remove the timeout and it boots into Linux? I have my Linux and Windows installs on different partitions - would that still be an issue for me?

Also would there be a way to add an entry to boot straight into the Virtualised XP from grub?
__________________
gladstone is offline   Reply With Quote
Old April 28th, 2008   #4
spawn12345
First Cup of Ubuntu
 
Join Date: Apr 2008
Beans: 2
Re: Boot an existing XP (Physical HD) install with VirtualBox

I will try it this week.

But the guide isnt good for a linux noob :/
It would be nice if some things are explained more.

like whats this:
Quote:
sudo usermod -G disk -a USERNAME_HERE
sudo usermod -G vboxusers -a USERNAME_HERE
Quote:
VBoxManage internalcommands createrawvmdk -filename WindowsXP.vmdk -rawdisk /dev/sda -partitions 1,2
Quote:
Enable Passthrough in CD/DVD to watch DVDs (you'll need to install Win VLC as well)
Enable IO-ACPI and run it!
spawn12345 is offline   Reply With Quote
Old April 28th, 2008   #5
Sand Lee
Way Too Much Ubuntu
 
Sand Lee's Avatar
 
Join Date: Mar 2007
Location: Georgia, USA
Beans: 303
Ubuntu Studio 9.04 Jaunty Jackalope
Re: Boot an existing XP (Physical HD) install with VirtualBox

UPDATE: terminal command has been made simpler

@ kabanta:
I added your suggestions. Thanks for giving the link to that tutorial (It's the one I used).
/dev/sda1 = grub
/dev/sda2 = windows

@ gladstone:
As I said, Virtualbox changes a significant amount of hardware in XP. Chances are, XP will not function correctly if you boot it with your original hardware. Hopefully later versions of VBox will change this behavior.
Removing the timeout is a safety precaution. If you were not able to specify partitions, there is a chance that you may boot into your currently running install, thus corrupting your partition. Booting straight into the virtual machine would be cool, but I do not think this is possible.

Edit:
It seems significant changes are made after installing Guest Additions; so yes, you should be able to boot now after following this tutorial.

@ spawn12345:
With the current state of VirtualBox not allowing a user to boot into their partition natively, I do not encourage "linux noobs" to attempt this tutorial. I created the tutorial expecting that the reader have basic knowledge of Virtualbox's interface. The vbox command is explained in the VBox user manual. Any other commands are easily explained in the man pages.
If VirtualBox becomes more flexible and allows users to boot natively, I will then make this tutorial more beginner friendly.

Edit:
Now that I've found a solution to the native booting problem (not installing the guest additions) I will try to make this tutorial friendlier.
__________________
If you asked a help question, don't forget to mark your thread as [solved] through Thread Tools
I'm reading less Linux news, more Linux tutorials and giving back to the community.

Last edited by Sand Lee; June 14th, 2008 at 03:21 AM..
Sand Lee is offline   Reply With Quote
Old April 30th, 2008   #6
Sand Lee
Way Too Much Ubuntu
 
Sand Lee's Avatar
 
Join Date: Mar 2007
Location: Georgia, USA
Beans: 303
Ubuntu Studio 9.04 Jaunty Jackalope
Lightbulb Updates:

  • Major: Native boot issue "solved": Users should not install guest additions* as it will dedicate the partition to virtualization - 4/30/08
  • Major: Revamped the Tutorial (Now 5 steps!) to exclude WPA bypassing methods as I assume most people have already upgraded to SP3 - 07/08/08
  • Minor: Added Guest Additions "undo" section, thanks Mr. Picklesworth! - 07/15/08
  • Minor: Added note about version # and SATA drives. Hopefully a solution will be figured out. - 09/14/08
  • Major: Added VirtualBox Forum version to the tutorial, thanks starfry! - 09/28/08
  • Major: Suceeded in running Vista with Vbox 2.0.4_OSE. Reference. - 11/12/08
  • Major: Fixed MBR problem and ToDo #3 with grub.iso method. Creation of .vmdk's now possible with Opensource VBox - "finishes" ToDo #2 - 11/22/08
  • Minor: Added Experimental Step 6 - 11/29/08
Testing:
  • BugFix: Included the possible "disk read error" workarounds noted by ciucca and borikru. - 11/13/09

Deprecated:
  • Minor: Partition safety issue resolved with "mbr" package* - thanks lance2010! Minor tutorial cleanups. - 05/02/08
  • Major: Fixed issue of constantly having to activate windows; activation is now only needed once - 05/04/08
  • Major: With further testing, it seems the activation bypass method outlined in the tutorial doesn't work for SP3. - 05/09/08
  • Major: Troubleshooting section added. Alternate Step 1 added. - 05/12/08
  • Minor: Attached Microsoft WPA Documentation
  • Major: Digging this tutorial (it's been baking for quite a while) - it's now or never - 08/09/08
  • BugFix: Fixed VERR_FILE_NOT_FOUND error. Reference. - 11/13/08
Attached Files
File Type: txt diff3.txt (4.4 KB, 118 views)
__________________
If you asked a help question, don't forget to mark your thread as [solved] through Thread Tools
I'm reading less Linux news, more Linux tutorials and giving back to the community.

Last edited by Sand Lee; April 13th, 2009 at 02:12 AM.. Reason: Tutorial Revamp and Creation of Deprecated list for irrelevant items.
Sand Lee is offline   Reply With Quote
Old April 30th, 2008   #7
the8thstar
Extra Foam Sugar Free Ubuntu
 
the8thstar's Avatar
 
Join Date: Mar 2007
Location: Tourcoing, Nord, France
Beans: 831
Ubuntu 9.10 Karmic Koala
Re: Updates:

Quote:
Originally Posted by Sand Lee View Post
  • Native boot issue "solved": Users should not install guest additions as it will dedicate the partition to virtualization - 4/30/08
Warning:

This is why it's important to create a SECOND HARDWARE PROFILE, to prevent massive confusion for XP. I wonder if you are able to transfer files b/w Ubuntu and XP without the Guest additions. Also, seamless virtualization of XP is not available if you don't have Guest additions enabled on your machine AFAIK.
__________________
HP Pavilion dv2109nr
CPU Intel Core Solo T1350 1.86GHz | RAM 2Gb DDR2 533MHz Bus | GPU Intel 945GM 128Mb | Net Intel PRO/Wireless 3945ABG | HDD 80Gb SATA

Ubuntu 9.10 32-bit | Gnome 2.28.1 |

Last edited by the8thstar; May 1st, 2008 at 12:31 AM..
the8thstar is offline   Reply With Quote
Old April 30th, 2008   #8
natrixgli
A Carafe of Ubuntu
 
Join Date: Aug 2006
Beans: 113
Re: Boot an existing XP (Physical HD) install with VirtualBox

Has anyone tried anything like this with Vista?

Cheers,

-n8
natrixgli is offline   Reply With Quote
Old April 30th, 2008   #9
lance2010
First Cup of Ubuntu
 
Join Date: Apr 2008
Beans: 1
Re: Boot an existing XP (Physical HD) install with VirtualBox

Quote:
Remove your grub's timeout option by commenting out the line (if you aren't able to specify the aforementioned partitions)
Thanks for the tutorial. One important improvement that I gleaned from another post here that eliminates any potential catastrophic problem of booting into the host OS (and hence the need for disabling grub's timeout) is to use a generated MBR.
  1. Install the mbr package:
    Code:
    sudo apt-get install mbr
  2. Generate a dummy MBR:
    Code:
    install-mbr winxp.mbr --force
  3. Use the MBR in creating the .vmdk file. The command I use is the following; adjust accordingly for your particular configuration. Note that I have XP on the first partition.
    Code:
    VBoxManage internalcommands createrawvmdk -filename /home/me/.VirtualBox/WindowsXP.vmdk -rawdisk /dev/sda -partitions 1 -mbr winxp.mbr -relative -register
This should allow you to boot directly into your WinXP partition without going through grub. Works for me.
lance2010 is offline   Reply With Quote
Old May 1st, 2008   #10
softtower
A Carafe of Ubuntu
 
Join Date: Apr 2007
Beans: 115
Send a message via MSN to softtower Send a message via Yahoo to softtower
Re: Boot an existing XP (Physical HD) install with VirtualBox

Will this work with VirtualBox that comes with Ubuntu and installed via apt? I don't have "VBoxManage" but I have "vboxmanage" in my /usr/bin. That one doesn't have "internalcommand" option.

Then I found VBoxManage in /var/lib/virtualbox, but it won't start saying "cannot open shared object file".
softtower is offline   Reply With Quote

Bookmarks

Tags
existing partition, physical, virtualbox, virtualize, windows

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:34 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry