Monthly Archives: August 2015

Run your dual-booted Ubuntu install under Windows with VMWare

First off, this isn’t what you might call a “supported” configuration so as ever YMMV and don’t blame me if it goes horrifically wrong and you end up with two/three systems that won’t boot (your VM, your native install and optionally, the VM host :P). Having said that it worked fine for me, but it might be wise to make a disk image somewhere else and have a livecd ready if it goes wrong and you need to do recovery. Also you can possibly do this with VirtualBox or VMWare Player, but I haven’t tried it. I started with Ubuntu 15.04 installed on my second hard disk in an extended partition along with an NTFS data partition, and Windows 10 on the other disk which is the primary (but is an SSD, so it’s small) along with VMWare Workstation 12.

In short we’re going to create the VM, then add an extra boot disk and install GRUB into this from the Ubuntu DVD.

First off, create a new VM, choose a Custom machine and go through all the usual steps of names and locations and cores and RAM. When you get to “Select a Disk Type”, choose SATA (if you choose SCSI it will whinge on first boot that performance will be poor). Then select “Use a physical disk”, set Device to the correct disk (PhysicalDrive1 in my case) and choose Use individual partitions, then tick the relevant partitions for your Linux system (ie the root filesystem and the swap partition).

Finished dual boot VM

Click Next a few more times and then Finish (don’t hit Customize Hardware, or it doesn’t bother adding the disk). Then edit the machine to add a hard disk. This one can be SCSI since it’ll be an actual virtual disk, you want to create a new one and set the size for something like 200MB (it’s going to have the boot partition, so not much space needed!). Finally mount the Ubuntu 15.04 live disk in the CD drive, as you’ll need to boot this first.

Now boot the machine. At this point you might be told “Insufficient permission to access file”; when I had this working in Workstation 9 it would just throw up a UAC prompt but apparently 12 doesn’t, so restart VMWare Workstation as administrator to get that low-level disk access we need. Once you’ve got to the live desktop, open a terminal (Ctrl-Alt-T in Ubuntu). We’re going to format our new virtual disk, then chroot to it and install GRUB. To partition and format the new disk, run the following, but first heed this warning: for me the virtual disk was /dev/sda, but I suggest checking with ls /dev/sd* to make sure you don’t overwrite your dual-boot disk, as that would be a mess!

parted /dev/sda mklabel msdos
parted /dev/sda mkpart primary ext2 0% 100%
mkfs.ext2 /dev/sda1

It goes without saying these have to be run as root. Next up comes courtesy of AskUbuntu user Nathan Kidd, on this question which explains how to chroot to an empty disk; it looks like this:

mkdir /mnt/chrootdir
mount /dev/sda1 /mnt/chrootdir
for dir in proc dev sys etc bin sbin var usr lib lib64 tmp; do
    mkdir /mnt/chrootdir/$dir && mount --bind /$dir /mnt/chrootdir/$dir
chroot /mnt/chrootdir

Finally we need to install GRUB and then run an update to generate the menus, and we’re done!


That’s it! Exit the chroot, shutdown the VM (it hangs, I had to hard-reset) and remove the ISO, and the next time it gets booted it’ll be running the real Ubuntu install on your hard disk. Remember to install the open-vm-tools and open-vm-tools-desktop packages or VMWare Tools to make auto-resize and stuff work. Also I wouldn’t suspend the VM and then boot the real copy…that pretty effectively kills both the VM and the underlying install in my experience.

Installing Ubuntu wireless drivers on fresh install

So here’s the problem I found myself faced with today; when I ran Ubuntu 15.04 live on my laptop I could pop open the Additional Drivers tool, enable the driver for my wireless card and get on the Internet, lovely. Then I made the (I think very sensible) assumption that the same would work after I’d installed Ubuntu, until to my surprise, it just sits there thinking about it.

Wireless Driver Working

It turns out once you’ve installed Ubuntu expects an Internet connection and doesn’t use the CD (or USB stick in my case), not ideal when it’s the network driver and you don’t have wired in your house. In principle you should be able to go to Ubuntu Software under Software & Updates and just select the CDROM option, then tell it to install the driver.

CDROM option enabled

No dice, it still just sits there. However this AskUbuntu question (found using my phone!) points to the commands to do it from a terminal, which usually gives a bit more helpful info. First run ubuntu-drivers devices which gives the name of the package to install, then attempt to install the package by the usual means:

root@buccaneer-linux:/home/sam# ubuntu-drivers  devices
== /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0 ==
modalias : pci:v000014E4d00004358sv0000105Bsd0000E040bc02sc80i00
model    : BCM43227 802.11b/g/n
vendor   : Broadcom Corporation
driver   : bcmwl-kernel-source - distro non-free

== ==
driver   : intel-microcode - distro non-free

root@buccaneer-linux:/home/sam# apt-get install bcmwl-kernel-source
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
The following NEW packages will be installed
  bcmwl-kernel-source dkms
0 to upgrade, 2 to newly install, 0 to remove and 217 not to upgrade.
Need to get 0 B/1,574 kB of archives.
After this operation, 8,390 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Media Change: Please insert the disc labelled
 'Ubuntu 15.04 _Vivid Vervet_ - Release amd64 (20150422)'
in the drive ‘/media/cdrom/’ and press enter

At this point I put my USB stick back in and symlinked it (ln -s /media/sam/UUI /media/cdrom if you don’t know) and pressed Enter, which presented me with exactly the same message again. Apparently doing that just makes Ubuntu helpfully unmount the USB stick!

Adding new software source

The solution is to add the USB stick as a separate software source, although identifying the correct syntax took some trial and error. Under the Other Software tab, hit Add, then enter a line something like below, hit Add Source, do apt-get update (there will be a lot of “failed to fetch” errors!) and then try the install.

deb file:///media/sam/UUI vivid main restricted

However (and this is where I had trouble and had to run the update quite a few times), the three words after the path depend on the distribution. So, on your USB stick in the folder you specify (UUI in my case) should be a dists folder and in that folder should be another folder for the distribution – vivid in my case. The final two refer to the components available and should match the subfolders of vivid

Folder structure of Ubuntu install package archive

After you’ve run the update the install should finally succeed with apt-get install bcmwl-kernel-source in my case, and then all that’s left is to remove your new software source.


Add a new software source like deb file:///media/usbstickmountpoint vivid main restricted, run ubuntu-drivers devices then apt-get install the relevant package under “driver”

Hope that helps someone!