Tutorial: Boot Ubuntu 9.10 Partition using Virtualbox inside Windows (deprecated)
This article is now deprecated as 10.04 has been released. Comments will be disabled. Check back for an updated version.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So Ubuntu 9.10 got released several weeks ago and people have been asking about how to get my old tutorial working for 9.10.
The problem is that Ubuntu 9.10 uses the new grub 2 boot loader which changes LOTS of things. In this tutorial I will be showing you how to get Ubuntu 9.10 (or any other linux OS with grub2) working under your Windows installation.
Before we begin, you should have a dual boot setup. I will NOT be showing you how to setup a dual boot, if you need help plenty of other guides out there.
Step 1: Creating a grub 2 boot iso
The grub iso file will allow you to specify which partition to boot into.
- Boot into Ubuntu
- (OPTIONAL) Configure your /boot/grub/grub.cfg This is so that you don’t accidentally boot into your Windows partition from inside Windows! Bad things will happen if you do!!!
$ gksudo gedit /boot/grub/grub.cfg
Comment out your Windows Menu, should be towards the bottom - Create the bootable iso
$ grub-mkrescue –overlay=/boot/grub GRUB2CD.iso - (DO THIS STEP ONLY IF YOU PERFORMED STEP 2)
$ gksudo gedit /boot/grub/grub.cfg
Uncomment out your Windows Menu, so you still can boot into windows after the reboot! - Move the iso into a location that is accessible by windows
Step 2: Creating the .vmdk file
This creates a file which tells Virtualbox what partition to actually load as the harddrive. Unfortunately, unlike VMWare Workstation, Virtualbox does not support a GUI interface for selecting RAW hard disks as the “virtual hard drive”.
- Boot into Windows
- cd into the directory you installed virtualbox
- Find out which drive contains Ubuntu (if you don’t know already)
Run the command: VBoxManage.exe internalcommands listpartitions -rawdisk \.PhysicalDrive1
(where 1 is the number of the hard drive ubuntu is installed on. E.g. Master should be 0, you’re second hard-drive should be 1 etc…The output should be something like:Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0x07 0 /32 /33 1023/254/63 902023 2048
5 0x83 1023/254/63 1023/254/63 49677 1847346543
6 0x82 1023/254/63 1023/254/63 2164 1949086188In this example, my Ubuntu partition is number 5 and the swap is number 6. So my Ubuntu partition lies in PhysicalDrive1 - We now create the VMDK file with the given information
Run the command: VBoxManage.exe internalcommands createrawvmdk -filename C:ubuntu.vmdk -rawdisk \.PhysicalDrive1 -register
Step 3: Setup Virtualbox
Now everything should be ready to setup Virtualbox. Create a new virtual machine. Select the .vmdk file we just created as the hard drive and mount the grub.iso file we created at Step 1.
Step 4: Running the VM
Due to the way grub 2 works, whenever you put into it you now have to load the appropriate grub config file.
Just type the above into terminal and grub should load and boot into your Ubuntu 9.10 installation.
If this has helped you in any way, please take the time to drop a comment (or a donation)! If you have any problems, just post a comment or send me an email through the “Contact me” page.
ISSUES:
- For some reasons Grub does not recognise the partition if you specify the EXACT partition entry of Ubuntu. You have to specify the entire drive for it to be recognised.
- It doesn’t seem to like nvidia drivers in this release so you might have to reset your x.org for it to work inside a VM. Just have to live with the lack of acceleration!
References:
Trackbacks & Pingbacks
- Tutorial: Boot existing Ubuntu Partition using Virtualbox inside Windows (deprecated) | ltyer.com
- VirtualBox … de Ubuntu a Windows y ¿viceversa? « Blog Emmanuel Mendoza
Comments are closed.
Good tutorial, although I prefer having my machines as Virtual Disks as opposed to partitions because then I can back up the entire machine state at a certain point in time by copying a single file.
Also I wish virtual box would add multi screen full screen support, that would make my day.
It works perfectly, thanks
Thanks for the feedback, did you encounter and problems along the way or did everything just work?
X wouldn’t start up for me because the NVIDIA kernel module failed to load, but if I simply renamed xorg.conf to xorg.conf.bak X would come up fine (albeit without any kind of acceleration).
Same issue here, those hardware-specific don’t seem to work through the virtualization of VBox.
I found a good /etc/X11/xorg.conf here:
http://forum.notebookreview.com/showthread.php?t=436427
I noticed the thread contributor mentions a certain block in the xorg.conf to utilize the Guest Additions 3d acceleration:
Section “Module”
Load “vmglext”
EndSection
…but still no Desktop Effects. 😦 Oh well, can’t have it all.
Hey Neil,
I too faced the same problem.
Did you get the ubuntu install to work both under VM and normal mode after the xorg.conf file change?
Regards
Thomas
Thanks for the great tutorial. I am having a problem though. After grub loads, I select ubuntu but then I get a grub error:
error: no such device: (followed by the drive UUID)
Is there something I need to change in my grub.cfg to make this work?
Thanks
Thanks for the tutorial. I am quiet a newbie with Linux.
I have not completed it now and I am doing the Grub menu edit to remove XP from the menu. I suggest changing this part a little (Steps 1.2 and 1.4). The reason is that the /boot/grub/grub.cfg is a read-only file and documented (in https://wiki.ubuntu.com/Grub2) as “not meant to be edited”. The way I modified /boot/grub/grub.cfg was to edit /etc/default/grub:
$ gksudo gedit /etc/default/grub
and add this line at the end:
GRUB_DISABLE_OS_PROBER=true
and then updated /boo/grub/grub.cfg the recommended way:
$ gksudo update-grub
After the iso creation this should be undone by commenting the previously added line in /etc/default/grub and applying the changes again with update-grub.
Cheers.
I tried this but it did not work 😦
Inside the VirtualBox virtual machine, it lets me pick Ubuntu from the grub menu, but then it just sits there with a cursor and does nothing. I assume it should start booting Ubuntu within a minute? It just sits there for a long long time and does nothing.
I know I specified the right drive. In fact, when I specify the wrong physical drive, it gives me an error (rather than just hang). I even tried specifying partitions or no partitions, but both hang.
Very nice post. I just came across your blog and wanted to tell you that it has been enjoyable reading your blog posts. Anyway I will be saving your feed and I look forward to your next post.
VirtualBox crashes during boot of virtual machine, and I can’t really tell why. Might it be something to do with the nvidia drivers on my Ubuntu partition? Any ideas?
Apparently I had to turn on hardware virtualization, since I have both 64 bit Windows and Linux for my core i7 machine.
Good tutorial! I am still having problem using the iso file created to prevent me from accidentally booting into Windows. When I type the command “configfile /grub.cfg” I get the menuitems listed in my grub.cfg. However, when I press enter for any of the items all I get is “error: file not found”…
I’m not sure why it can’t find my boot options. If I skip the iso it works well though. Any ideas?