start installed Windows Vista from Linux using VirtualBox

As a majority of users, I bought a laptop with vista already on it. First things firts, I installed linux (debian) without even booting into windows and follow its installation process.

Then I thought I could use windows (for such situation where god-damned hardware makers to not create drivers for linux (ex: lexmark and its x4650 wifi printer!)) and start it from virtualbox (version 2.0.4 for me) without having to leave linux!

Here is how I did:

  1. Install virtualbox package: “sudo apt-get install virtualbox-ose
  2. Login into windows to finish the installation process (if windows is already set up, then skip this step)
    note: I installed windows with a full reboot on windows (and not from within virtualbox) simply because I could not make the installation process work within virtualbox
  3. Login back into linux and locate your windows partition:  “sudo fdisk -l”
    Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1        1306    10490413+  27  Unknown
    /dev/sda2   *        1307       20110   151041024    7  HPFS/NTFS
    /dev/sda3           20111       24328    33881085   83  Linux
    /dev/sda4           24329       38913   117154012+   5  Extended
    /dev/sda5           24329       24450      979933+  82  Linux swap / Solaris
    /dev/sda6           24451       38913   116174016   83  Linux

    In  my case, windows partition is ‘dev/sda2’ (the one with NTFS filesystem format)

  4. We need to create a fake .vmdk file (file format used by virtualbox to emulate hard-disk) and make it point to our real disk. Run:
    sudo vboxmanage internalcommands createrawvmdk -filename ~/.VirtualBox/vista_physical_partition-sda.vmdk -rawdisk /dev/sda

    note: as for now, we make the vmdk file points to entire disk (and not only to windows partition)
    note2: if your disk with vista is other than /dev/sda (ex: /dev/sdb) => use your own value[UPDATE]: with newer versions of virtualbox, above command ends up in an error. As suggested in displayed error message, you need to use the -convertSettings flag => instead of running above command line, run this one:

    sudo vboxmanage -convertSettings internalcommands createrawvmdk -filename ~/.VirtualBox/vista_physical_partition-sda.vmdk -rawdisk /dev/sda
  5. change ownership of generated .vmdk file to your own user (so that you won’t need to run virtualbox as root to use this partition): sudo chown <your_user_name> ~/.VirtualBox/vista_physical_partition-sda.vmdk
  6. Now start virtualbox: “sudo virtualbox” and create your virtual machine:
    1. click on New / Next / enter your virtualmachine name (ex: vista) & choose windows vista as OS type & click on Next
    2. For windows vista, you must allocate at least 512MB of ram (1.5Gb recommended), click on Next
    3. For hard-disk, click on “existing” / “add” and go to ~/.VirtualBox/vista_physical_partition-sda.vmdk / click on “select” / “next” / “Finish”
    4. Now we must further configure this virtualmachine, click on “Machine” / “Settings”
    5. Under “general” section, allocate at least 50Mb of ram for video (in “basic” tab), then click on “advanced” tab and ensure “Enable IO APIC” is checked and click on OK (you can look for more options such as enabling sound in corresponding sections)
  7. AT THIS POINT, I MUST GIVE AN IMPORTANT WARNING: our vmdk file points to entire disk, ie. when we will start our virtual machine, it will be like booting the entire computer => if you have dual boot, you will load grub: DO NOT RUN LINUX within itself! This could screw up your entire linux installation!!!!
    You would start the linux you’re currently running virtualbox on, therefore messing all your linux installation. => MAKE SURE TO LOAD WINDOWS ONLY
  8. At this point, I tried to start the virtual machine and load vista and… it failed! This delicious blue-screen I had not seen since I started using linux… I found a solution that worked for me, on virtualbox website, it consists of modifying some windows registry entries so that windows won’t check HDD structure upon start-up and won’t fail if it changed.
    1. go to
    2. download  MergeIDE utility (in Hard Disk Support section) & save it in a usb key on into windows partition
    3. restart your computer, loading windows, log into it, unzip MergeIDE and execute “MergeIDE.reg” to modify your registry
    4. restart into linux
  9. start virtualbox, start your virtual machine and load Vista.
    If you’re lucky enough, Vista should start by now
  10. Log in into Vista using virtualbox.
  11. Bad news is that there’s lot of chance your ethernet controller won’t be recognized, we will install it.
    1. Leave your virtualbox open and go back to linux (‘right ctrl’ is the default hotkey to tell virtualbox you want to go back to linux, it frees your mouse and keyboard so that they are active in linux and no longer in windows)
    2. download corresponding ethernet driver: (if link is dead, go to and look for NDIS5 driver)
    3. unzip it: “unzip -d vbox_driver
    4. create an iso of unziped content: “mkisofs -o vbox_driver.iso -R -J vbox_driver
    5. then mount this file as a cdrom in virtualbox:
      1. go into virtualbox
      2. on top menu (leave fullscreen mode (right ctrl + f) to see it), click on Devices/Mount CD-DVDROM
      3. browse to your newly created vbox_driver.iso file
      4. then in your running vista, if mounted file does not open itself, go to your cdrom icon and open it
      5. Next click on Control Panel / Hardware and Sound / Device Manager. Right click on Ethernet Controller / Update Driver Software => browse my computer… => navigate to the CDROM drive, and click ok.
    6. That should do it for the ethernet controller
  12. Now you may have new driver problem that pops out (such as activating usb ports!).
    We will install the controller for VirtualBox VMM Device: download innotek drivers from and install it.
  13. That’s it.


Note: I ran a lot of commands as root, unfortunately creating .vmdk file without root access failed on an “insufficient right to read /dev/sda” error and the running virtualbox without root failed with same message too.
I’m pretty sure I screwed up at some point and that you should be able to run it without root rights.

Note2: I’m looking for a way to skip grub when starting virtual machine as it’s too dangerous as it is now. Unfortunately I did not find a solution that worked for me. If you did, please let us know!


23 Comments: Trackback URL | Comments RSS

  1. matt Says:

    thank you. posting my success to my blog soon, giving you props.
  2. emp Says:

    Very nice! Used this guide a number of times but couldnt get Virtualbox to boot windows Vista 64. Now Im back with a 32bit version but now I get. "E: Couldn't find package virtualbox-ose". Why?
  3. remy Says:

    virtualbox-ose package is part of "universe" => you may need to do the following:
    1. update your /etc/apt/sources.list file, ensure the following line is present: deb jaunty universe
      (replace ubuntu version with your running version if need be - as well as server url, set to http://es. since I'm currently in spain)
    2. udpate apt: "sudo apt-get update"
    now "apt-cache search ^virtualbox" should return some results (=> just install the package). Note also that in "virtualbox-ose", "ose" part stands for "Open Source Edition" => a closed source edition exists, and you might be interested in this one. Main difference is that '-ose' version does not support usb while closed source support it => if you want to access your usb ports in virtualized vista you will need it. Package name is simply "virtualbox", you can download .deb package directly from or through apt (easier to get updates). In this case,
    1. add the following repository to /etc/apt/sources.list: deb jaunty non-free
    2. run "sudo apt-get update"
    3. run "sudo apt-get install virtualbox"
    and start having fun!
  4. joaca_rj Says:

    How about creating a windows boot disk image and keeping it as mounted media in virtualbox, so it could just skip grub and start the windows partition... (and maybe changing default OS in grub just for safety...), unfortunately, I can't test it out, cuz I don't have a Windows partition.....
  5. Yuri Calazans Says:

    Excellent tutorial! Thanks a lot! Im posting this message from my Vista, logged throw the VirtualBox :)
  6. deepak Says:

    when i tried it the following error pops yp .any help? Could not open the hard disk '/home/dpkn/.VirtualBox/vista_physical_partition-sda.vmdk'. VD: error opening image file '/home/dpkn/.VirtualBox/vista_physical_partition-sda.vmdk' (VERR_ACCESS_DENIED). Result Code: NS_ERROR_FAILURE (0x80004005) Component: HardDisk2 Interface: IHardDisk2 {ed6e2525-c2fd-42a4-917a-7a9045ac9e15} Callee: IVirtualBox {339abca2-f47a-4302-87f5-7bc324e6bbde}
  7. remy Says:

    "VERR_ACCESS_DENIED" => try executing your shell commands as root
  8. sumit Says:

    i m using fedora 11 and after using [root@sumit-laptop log]# VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/vista_physical_partition-sda.vmdk -rawdisk /dev/sda VirtualBox Command Line Management Interface Version 3.0.6 (C) 2005-2009 Sun Microsystems, Inc. All rights reserved. Error while creating the raw disk VMDK: VERR_ALREADY_EXISTS The raw disk vmdk file was not created plz help
  9. bhupendra Says:

    I am planning to work on something similar. I need to boot xp from fedora. One thing which you could have tried, whch I plan to - have default windows, load linux with grub not on mbr. use gag boot loader to go to linux and configure virtualbox.
  10. walter Says:

    for joaca_rj: yes, booting directly into a windows partition works great, that's what i do. i installed linux on /dev/sda and vista on /dev/sdb...neither os "knows" about the other w/ their boot-menus. i control booting via the bios boot menu and disable the vista partition. so from vb i boot directly to /dev/sdb. works great.
  11. walter Says:

    for anyone getting “VERR_ACCESS_DENIED” is caused by the original suggestion to create your vmdk using "sudo vboxmanage..." and then trying to access that vmdk using a "normal" non-root ID. also, it's generally a bad thing to require sudo to use vbox. so if you just create the vmdk using those commands but leave "sudo" off and just use your normal ID to create it, you should be fine.
  12. Timmy Says:

    On my machine I struggled with MergeIDE.reg. I did not need the batch file to copy the drivers (atapi.sys etc) as they were already present. May be everyone else knew this already - to "execute" MergeIDE.reg I needed to rightclick on it in Vista and select Merge. The command in the *.bat file did not work for me.
  13. guglez Says:

    to run virtualbox without sudo you must add your current user to group "disk"
  14. fusiondog Says:

    The last and most important step for me to get this working was to be sure to put the virtual disk on the IDE controller rather than the SATA controller. I'm still getting issues with Genuine status. Windows7 now thinks its counterfeit.
  15. Jonathan Says:

    Thanks, this is working great for me (Ubuntu 11.04 +Win7). After accidentally booting into Ubuntu from inside virtualbox and having wreaking all kinds of havoc on my filesystem, I set up GRUB to default to Windows when inside virtualbox, and default to GRUB on the native machine: (note that this has reboot and shutdown reversed, doesn't make any difference here though) 1. Set default to Windows: in /etc/default/grub: GRUB_DEFAULT=saved sudo set-grub-default 5 (Windows is #6 in my GRUB menu = 5) 2. Make scripts to set GRUB default to Ubuntu at shutdown and restart: (Ubuntu is #1 in my GRUB menu = 0) sudo gedit /etc/rc0.d/K99grub #! /bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin grub-reboot 0 exit 0 sudo gedit /etc/rc0.d/K99grub #! /bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin grub-reboot 0 exit 0 sudo chmod +x /etc/rc0.d/K99grub sudo chmod +x /etc/rc6.d/K99grub 3. Done.
  16. Jonathan Says:

    sorry in step 1. that should say: sudo grub-set-default 5 and in step 2. the restart rc is 6, so one of the grub reboot files should be /etc/rc6.d/K99grub
  17. adario Says:

    Nice tutorial. Could you pleas advice me on how I can do this with other open source tools such as KVM or/and Xen?
  18. adario Says:

    Nice tutorial. I need to do this using Qemu with a dual boot machine with Win7 and Open Suse, both 64 bits, any idea how to do this?
  19. edison23 Says:

    Bloody hell, it works! xDDD (Lubuntu 11.10, virtualbox 4.1.2, windows 7 PRO) well, thanks for the tutorial, came in handy, though i guess it's pretty dangerous for the windows instalation xD i will translate the tutorial on my blog, if you dont mind :)
  20. Al Says:

    Awesome article, remy! Also, great tip about grub from jonathan. For grub2 though, here's a copy/paste to replace jonathan's Step 1: === Find out what you boot options are called: sudo update-grub One of the entries should be 'Windows 7'. Edit /etc/default/grub to set this as boot default: sudo gedit /etc/default/grub change: GRUB_DEFAULT=0 to: (for example) GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda2)" Save file, then (again) run: sudo update-grub
  21. Al Says:

    As I was setting up a new computer, I found out I made mistakes in my last comment. Below is copy/paste, WITH CORRECTIONS (my last comment can be entirely deleted/ignored) === Awesome article, remy! Also, great tip about grub from jonathan. For grub2 though, here’s a copy/paste to replace jonathan’s Step 1: === Find out what you boot options are called: sudo update-grub One of the entries should be ‘Windows 7′. Edit /etc/default/grub to set this as boot default: sudo gedit /etc/default/grub change: GRUB_DEFAULT=0 to: GRUB_DEFAULT=saved then run grub-set-default (this is what Windows 7 looks like for my computer, so you: sudo grub-set-default "[Windows7_entry]" for my computer, "[Windows7_entry]" was "Windows 7 (loader) (on /dev/sda2)" Save file, then (again) run: sudo update-grub
  22. Frank M. Eriksson Says:

    Thank you for your excellent article! I got most stuff sorted out, but I got permission denied even if I chmod:ded all files to 777 an chown:ed them to my username. Works by running virtualbox via sudo (not happy about that). I tried creating the image as myself, and as root. still didn't work out well.. I kinda get this feeling that there is something important about permissions under Ubuntu that I've missed out to learn about. Just needed this for a one-off thing to boot from an SDCARD (to see that I've not stored any files there that I might miss someday after a reformat).
  23. steve Says:

    O yes HowTo would solve the problem ? VirtualBox has huge issue and device driver install in guest os ! Missing/error install device driver and guest os in that way is not usable at all ! Can not solve driver problem error install and vbox does not provide device drivers for emulated hardware only vbox relevant ones so sata controller problems and audio problems ! And no svine in charge do nothing to fix damn problem ! Vbox is useless also guest os if one can not it make fully functional ! I give up ! Will install tested os on spare computer for test purposes will go much faster as resolving ''driver'' problems within vbox that aren't user problems bu developers problems ! Virtualization tech my ass ! Ill tray SmartOS and KVM if then so also driver problems i give up and keep my old computer for testing purposes !!! Developers keep forget that we are users not their problem solver !!! If something didn't work first time is there great chance not to work second time and further ! To much negative experience and i'm not here to do job for others !!!

Post a Comment

Your email is never published nor shared. You're allow to say what you want...