I installed Ubuntu on a new latop (UX305LA – nice laptop, will do a review at some point maybe), and wanted to be able to run the Ubuntu partition both standalone as well as from Windows with VirtualBox.
Didn’t find anything that exactly addressed my situation (basically, virtualizing an Ubuntu EFI partition), and after some fiddling ended up getting stuff mostly working. So, to remember what I did, and in the hopes that I can save a few minutes time for someone else…
This basically follows the steps in this article, with some tweaks.
From your Ubuntu partition:
cd ~/Desktop mkdir -p iso/boot/grub cp /usr/lib/grub/x86_64-efi/* iso/boot/grub cp /boot/grub/grub.cfg iso/boot/grub
iso/boot/grub/grub.cfg and delete the menuentry for “Windows.”
sudo apt-get install xorriso grub-mkrescue -o boot.iso iso/
Copy off the boot.iso somewhere; you’ll use it on the Windows side.
Also keep track of what partitions you’re using on the Ubuntu side; in my particular case it was /dev/sda5 for the main drive and /dev/sda6 for the swap.
Open a command window as an administrator (i.e., right click / Open As Administrator).
wmic diskdrive list brief /format:list to figure out the
physical Windows drive. It will almost always be
unless you’ve got an unusual setup.
Change into the VirtualBox directory
cd \Program Files\Oracle\VirtualBox
Run VBoxManage to create the VMDK.
VBoxManage internalcommands createrawvmdk -filename "C:\Users\yourname\Ubuntu.vmdk" -rawdisk \\.\PhysicalDrive0 -partitions 5,6
-partitions 5,6 will of course be dependent on your setup.
And… run it! I’m getting a few warnings that flash by,
and a prompt at boot that says
/boot/efi was not mounted. Press
S to continue on that.
And… it all works, at that point. I increased graphics memory to 128MB in VirtualBox and turned on 3D acceleration, but Unity is still a dog in the VM, like always; I usually switch to LXDE or Awesome when in a VM.
At this point you can install the Guest Additions in the VM, at the cost of some spurious notifications when you boot the Ubuntu partition directly.
Comments are moderated whenever I remember that I have a blog.
There are no comments on this article.