This setup allows me to run various programs on my local system when I'm not on campus. However, the tiny gotchas in setting up the environment have serious bite! The setup involves VMware Fusion on a Mac running an Ubuntu installation in a virtual machine and sharing folders between the host operating system (OS X) and the guest (Ubuntu). My Ubuntu installation is actually augmented as a Debathena station.
This post will only cover getting around the problems encountered when sharing folders between the Mac and the Ubuntu Virtual Machine running concurrently. More specifically, making sure that it can be seen from the guest and streamlining to mitigate against the risk of system updates breaking the shared folders functionality. Creating the whole environment from scratch might be the topic of another post. Anyway, I found a mechanism so that shared folders work, but it does require a manual operation whenever the virtual machine is launched.
The problem revolves around VMware Tools. VMware tools provides extra features that allow for a more seamless operation between the host and guest operating systems such that the line splitting the two is blurred. This includes copy/paste functionality, shared folders, and more. However, installing VMware tools is quite a process. There are a few ways to do it:
- using the open-vm-tools package provided by Ubuntu
- using packages.vmware.com from VMware itself
- manually via the VMware host you are running
Of these three, method 2 will allow you to utilize the standard package manager operations provided by the Ubuntu operating system to manage updates. And that... is priceless. When I first created this development environment, I went with option 3. Everything worked beautifully, although I had to use the 32-bit 10.04 Lucid version of Ubuntu instead of the 64-bit 10.10 version after hitting several road bumps. Then at some future date, I had to install a slew of updates... this is when vmware tools got broken and, more specifically, shared folders.
Go with option 2....
Installation via Option 2
The following sites provide pretty good instruction on how to get vmware tools installed:
Unfortunately, it will take some back and forth between the two guides to fully complete the installation as the former is missing some steps mentioned in the latter. Here is my abridged version (actual command line commands will be in bold italics):
- (optional) if vmware tools is already installed via option 3, it must be uninstalled:
- sudo vmware-uninstall-tools.pl
- create a directory to store some keys (doesn't matter where)
- navigate to that directory
- wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub
- wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub
- wget http://packages.vmware.com/tools/VMWARE-PACKAGING-GPG-KEY.pub
- sudo apt-key add *KEY.pub
- cd /etc/apt/sources.list.d
- sudo emacs -nw vmware-tools.list
- add the following line to that file followed by a newline:
- deb http://packages.vmware.com/tools/esx/4.1latest/ubuntu lucid main restricted
- ctrl+x ctrl+s (saves the file)
- ctrl+x ctrl+c (exits emacs)
- sudo apt-get update
- sudo apt-get install vmware-open-vm-tools-kmod-source
- sudo module-assistant prepare
- sudo module-assistant build vmware-open-vm-tools-kmod-source
- sudo module-assistant install vmware-open-vm-tools-kmod
- sudo apt-get install vmware-open-vm-tools
There is a chance that step 14 will generate an error in the vain of, "I don't know what file you are talking about...." If this happens, something likely went wrong in steps 9-12. Make sure there is a new line at the end of the file.
At some point during those steps, a reboot or two will likely be required.
After all these steps, it is wise to verify the installation. According to the VMware documentation, this can be done by running the following command:
- /etc/init.d/vmware-tools status
In this status, you want to verify that "vmware-guestd" is running (for ESX releases prior to 4.1) or "vmtoolsd" is running (for ESX releases 4.1 and later). The documentation also says to check that certain kernel modules are running using the /sbin/lsmod command. See page 29 under "Verify VMware Tools installation" in the documentation for more details.
Verifying Shared Folders
If you desire to share folders on your OS X side with the Ubuntu guest, a few extra steps will be required.
- On the VMware Fusion menu bar, select "Virtual Machine"
- Click on "Shared Folders"
- If a shared folder hasn't yet been created, select "Add a Shared Folder"
- When completed return to the "Virtual Machine > Shared Folders" menu option
- Select "Open Shared Folders Settings..." and verify your desired settings
Now that a shared folder is verified to exist on the VMware Fusion software, check that it can be seen within the Ubuntu guest (it likely won't):
- Open a terminal window
- ls /mnt/hgfs/
If your shared folder does not get listed, it means Ubuntu cannot see it. Return to the VMware Fusion menu bar and do the following:
- Select "Virtual Machine > Shared Folders > Turn Shared Folders Off"
- Select "Virtual Machine > Shared Folders > Turn Shared Folders On"
That's right, simply toggle shared folders off and on. Return to the terminal window on the Ubuntu guest and run the same command again:
- ls /mnt/hgfs/
This time, your shared folder should get listed. And off you go.
You should now be able to ensure vmware tools is always updated via Ubuntu's package manager. However, every time the Ubuntu guest is relaunched, the shared folders toggling trick will need to be executed to ensure the guest can see the shared folders.
Run along now, hope this helps!