VMware Guest

VMware is a software that allows running a virtual operating system as an application in another operating system. It provides a full set of virtual hardware that maps to the physical hardware of the host computer. As an example, VMware allows running Linux Ubuntu as an application in Gentoo Linux. This guide provides a method for creating a new VMware virtual machine running Gentoo.

VMWare Virtual Appliance
Installing Gentoo can be complicated, perhaps even intimidating, to someone who is new to Linux. To get familiar with what Gentoo has to offer, VMware (and other virtualization software) provides a safe and easy environment for experimenting, as you are free to try any new Operating System without interfering with your current setup.

VMware appliances are OS distributions that are already installed and ready to go. You just have to download them and start them with VMware player or workstation. You can search for appliances at http://www.vmware.com/appliances/.

There is one of Gentoo available for free at http://bagside.com/bagvapp/

Gentoo 2008.0 (Barebones) VMWare Appliance. This is a relatively bare bones install of gentoo.
 * Kernel: 2.6.24-gentoo-r8
 * Desktop WM: Xfce 4.4.2
 * Filesystem: ext3
 * Release date: July 6th 2008
 * Virtual Disk: 12GB
 * Used Space: 5.7GB
 * Networking: NAT

Note: This appliance was created on an 64 bit AMD machine.

Another Gentoo appliance is now available as a torrent on thepiratebay.org http://thepiratebay.org/torrent/4817588/VMware_Gentoo_Server_Appliance_2008.0_kernel_2.6.27-r8 Another Gentoo minimal install VM, with growable LVM2 is available at http://www.gentoo-vm.net (Updated: April 14 2009)
 * OS:	Linux Gentoo 2008.0 (Updated March 31 2009)
 * Kernel:        2.6.27-gentoo-r8
 * Profile:       Default
 * Window Manager:	Xfce4
 * Compiled on:	Intel Core 2 duo
 * Based on:	VMware workstation 6.5.1 build-126130 installed on Linux Gentoo
 * Timezone:	Canada/Eastern
 * Character set:	en, en_US
 * vmware tools:	7.8.4-126130

Alternate Guides
For advanced users, if you plan to play with the same Gentoo installation inside a vmware and in native mode, you can have a look at http://communities.vmware.com/thread/44675. That way, you would be able to choose booting Linux or Windows, and then start the other one within VMware. To do that, you will need to access your disk partitions in raw mode. Really, this is still only for advanced users.

Reading this How to
This Howto documents installation of Gentoo 2008.0 from the LiveCD on VMware Workstation 6.5.1. By the way, you do not need a license of VMware workstation to do this. VMware workstation come with basic functionnality without a licence and creating a new OS is one of them. It is assumed that you already have VMware Worstation up and running. If not, have a look at VMware Workstation.

Getting the Live CD image
First, you need to get the Live CD ISO image of gentoo. You can get the latest version from [Get Gentoo!] page.

Preparing Virtual Machine
Now what you have to do is to create a new virtual machine. VMware makes this an easy process. You only have to follow the steps in New Virtual Machine Wizard (Home tab|Create a New Virtual Machine). Here is a summary of the options used to create the virtual machine for this guide. For any options not shown here, their default values were used.


 * Virtual machine configuration: Custom
 * Hardware compatibility (Workstation 6.5 to get the USB hotplug support)
 * Install OS from ISO (Select you gentoo live disk ISO image file)
 * Guest operating system: Linux; Version: Other Linux 2.6.x kernel
 * Virtual machine name: Gentoo Linux; Location: (your choice)
 * Number of processors: Select what you want.
 * Memory: Your choice for performance (current Gentoo minimum is 64 megabytes for minimal CD, 128 megabytes for live) I set 512 MB just to be safe
 * Network connection:
 * Use NAT networking if you do not need your virtual machine to act as a server on your network.
 * Use Bridged networking if you'd like your virtual machine to have a distinct IP address on your network. You will need to enable DHCP on your network (though not necessarily at your host).
 * I/O adapter types / SCSI Adapters: LSI Logic
 * Disk: Create a new virtual disk
 * Virtual Disk Type: SCSI
 * Disk capacity / Disk size (GB):
 * Your choice (current Gentoo minimum is 1.5 gigabytes plus 256 megabytes swap space). I set it to 40 GB, and I don't allocate the disk space.
 * Check to Allocate all disk space now if you want all the disk space to be pre-allocated. This can enhance performance.
 * Check Split virtual disks if you plan to move you virtual machine around.
 * Give the file a name. I suggest removing white spaces, it will make your life easier later.

Installing Gentoo Linux
Now you need to power on your virtual machine. If you have a VMware workstation licence, it will have started automatically. If you don't, browse to your .vmx file and start it with VMware player. If you are using the player, you may get a message saying that you cannot take ownership of the virtual machine. Go in the virtual machine folder and delete the .lck subfolder. Then restart the virtual machine.

Now, you just follow the instructions in the Gentoo Handbook the same way you would install Gentoo normally. Here we outlined the parts, to which you need to pay special attention. Please note that, since VMWare uses SCSI-emulation for the hard drive, the name of your hard drive will be /dev/sr0 rather than /dev/hda. Since there is no partition on the virtual disk yet, your virtual machine should automatically boot from the CD-ROM drive. Once the boot screen shows up prompting for kernel and boot options, press enter for default boot.

If you are running in bridged mode with and you need to set a static IP on the host computer you will need to run

at the command line in order to get networking functionality.

The build environment
CFLAGS=”-O2 -march=prescott -pipe” The previous CFLAGS broke my compiler, and had it refuse to create executables. New -march fixes this. However, I don't know if this has anything to do with using ESXi(5) or just outdated CFLAGS. Anyway, the following fixed it for me. CFLAGS="-march=core2 -O2 -pipe"
 * 1) VMware emulates an Intel Core 2 Duo# This page seems a bit outdated when it comes to these CFLAGS, check next comment.

I would presume using very generic cflags would help a little bit more, although not tested personally

Kernel options
If you want to be very sure about exactly what drivers you need the best way is to use some built-in utilities. While in the Gentoo setup chroot press Alt-F2 to switch to VC2 and type lspci. That command will tell you the particular devices VMWare is using. Type lsmod to be very sure because it will tell you what modules the liveCD used to boot up. The kernel settings lower were found with this method.

You can also refer to this Gentoo guest kernel configuration file for VMware Fusion as a good starting point. It has been tested as a desktop on Fusion 2.0.5 using 64-bit Gentoo Linux. Most of the unnecessary options have been removed to keep the kernel lean.

You need loadable modules to load VMware modules

BEWARE: A few of the suggestions made here make no sense, at least with VMware WS 7. Suggestion: Do "lspci" in a separate virtual terminal to make it easy to switch back and forth. For a few of the listed categories it will be easy to find corresponding drivers for the listed hardware in "menuconfig." You should carefully consider at least enabling the drivers corresponding to the output of "lspci" in addition to the suggestions below.

We have to disable IPV6, VMware does not support it yet.

VMware virtual machine emulates a Creative Labs Sound Blaster® AudioPCI device. If you like to have sound in your virtual Gentoo Linux, you will need to add support for it. See the following section.

These other things might be useful for udev. Note: If your kernel has problems mounting udev, you may need to emerge sys-apps/portage, sys-fs/baselayout, and sys-fs/udev to their most current stable versions.

Installing ALSA Sound
We first install alsa-utils

Recent versions of udev (>=udev-103) provide some degree of kernel-level autoconfiguration of your sound card. If possible, try to rely on just letting your kernel automatically setup your sound card for you. Otherwise, use alsaconf to configure your card, as shown below.

After that, you need to update the modules to activate the changes

Add the ALSA init script to default runlevel

The last thing is to add your users to the audio group

As much as I hate to write that, but I did not find the proper services to restart... Reboot for all changes to take effect.

Installing VMware Tools
Installing VMware tools is needed to take advantage of many VMware features like drag and drop, mounting the host file system and also loading appropriate drivers for the virtual hardware. There are two set of VMware tools available. VMware native tools and the open source tools.

Installing VMware Native tools
First, we mount the iso image of the tools. Within vmware player of workstation, connect the CDROM to the iso file. It is located at.

Now we have to mount the image file

Then untar the image file

Here you need to create the /etc/rc{0..6}.d directories because the installation script wants to create symlinks to.

You also need to create symlinks to some kernel headers

Now we run the install script

Respond to the configuration questions on the screen. Press Enter to accept the default value. Once you answer the last question, the installation will start. It will take quite some time... have a cup of tea.

Once the installation is finished, we have to add vmware-tools to the default runlevel

--UncleVan 19:42, 22 February 2011 (GMT) Seems to be pointless, since /etc/init.d/vmware-tools (native) doesnt comply with Gentoo Initscripts standards. It simply misses start, stop etc functions, thus probably /sbin/rc fails to launch it within "default". You have to start it manually - s.b., or alternatively you can try the scripts in /etc/init.d/rc{0-6}.d (but I already removed them...). --UncleVan 19:42, 22 February 2011 (GMT)

Now you can start vmware-tools manually by the following command or you can reboot

If you use a desktop environment like Gnome, KDE or XFCE, then you should add an autostart entry for vmware-user, which is part of the open-vm-tools package but separate from vmware-tools service that you added with rc-update. The vmware-user service will allow GUI features such as drag-and-drop (DnD), file and text copy/paste, dynamic display resizing, and Unity (source).

In KDE create a new application link (as root) to vmware-user on /usr/share/autostart. Then you add

In Xfce4, start the autostart editor

Installing VMware open source tools
app-emulation/open-vm-tools might be masked, just add it to your /etc/portage/package.keywords file :

Since new versions require the package open-vm-tools-kmod you may add it too.

Configuring VMware network module
Change the module specification for the network interface. Edit the alias file adding the following line

As of now [20100321], aliases are located in /etc/modprobe.d/aliases.conf...

Now update the module files

Mount shared folder
After VMWare Tools installed, your vm can mount host's shared folder.


 * 1) Add a shared folder in vm settings.
 * 2) Load kernel module for hgfs:
 * 3) Add following line into
 * 4) Mount the shared folder (make sure you already mkdir /mnt/hgfs):

Cloning Your Virtual Machine
When you make a copy of your virtual machine, either through the interface or simply by copying the files, VMWare will detect this change and ask you if you'd like to assign a new Unique ID to the new copy. If you choose 'not' to keep the existing ID, but create a new one, VMWare will assign new unique IDs to hardware such as the virtual network card's MAC address. If you have software that relies on these IDs, you must be careful to update them as well.

In particular, udev is confused by changing the MAC address on the card, and won't be able to find the network interface (eth0) even though the driver loads properly. See the udev documentation on how to update the files, or to modify the udev scripts to handle this case.

Taken from here: http://yoopergeek.blogspot.com/2007/07/vmware-loosing-eth0-after-youve-copied.html.

The actual MAC address as provided VMWare can be found using.

In Gentoo do one of the following: (Do #1, it's the easiest.) Instead of rebooting, you can reload udev using.


 * 1) Delete /etc/udev/rules.d/70-persistent-net.rules and reboot. Your eth0 should be back. 2007/09/13 Update: This almost-always works for me. But, for some reason, sometimes it seems to confuse udev even more; after rebooting, I'll have an eth2 or eth3. When this happens, I end up following #2, making sure the udev config file has 'eth0' listed, and not eth1, eth2, or eth3.
 * 2) Edit /etc/udev/rules.d/70-persistent-net.rules (or whatever it's named) to match your new MAC address and reboot. Your eth0 should be back.

You may also want to generate new ssh host keys. To do so, delete the existing keys and restart SSH. Code: regenerate SSH keys

If your VM uses DHCP, you will want to get a new DUID and lease. If you are using net-misc/dhcpcd, you can do this by deleting existing DUID and lease and restart dhcpcd. Code: get a new DUID and DHCP lease

Using VMXNET3 NIC and ParaVirtual SCSI Controller on ESXi
ESXi 4+ has some nice hardware options that should give the VM Guest some performance benefits, such as VMXNET3 and ParaVirtual SCSI Controller (pvscsi).

The drivers for these hardware options are now included in the Kernel, making it much easier to use and no need to use additional SCSI Device Controllers for the root and boot partitions.

(Kernel >= 2.6.33)
As stated above, the drives are now included in the kernel >= 2.6.33. At the time of writing this version was masked, so check what the current kernel verions is, if it is masked you will need to add this to /etc/portage/packages.keywords:

Or if you prefer:

Then emerge the new version, I decided to update world, but you could just do gentoo-sources.

Once you have the latest version of the kernel you need to select it:

Note, your list might differ from the above, you need to select the new kernel that you wish to use.

You will then need to select the drivers.

Copy the bzimage to the boot partition and mod grub.conf.

I removed all of the old modules that were referenced, the VMXNET3 and I had e1000 and PCNET32.

Also removed the reference from the /etc/modprobe.d/aliases.conf.

Remember, if you are upgrading from the older version and you have excluded the module for the other SCSI control you will need to Edit the VM to use the ParaVirtual SCSI controller.

You should be able to reboot and everything work.

Kernel <= 2.6.32)
Assuming you have followed the steps above to install the VMWare tools it's really easy to make use of these new types of hardware. You should see that the drivers are installed and loaded if you look at the VMs console via the vSphere Client.

VMXNET3 NIC
To use the VMXNET3 NIC, simply add/replace a new NIC select "VMXNET3" as the type, and then modify the alias in /etc/modprobe.d/aliases.conf to use vmxnet3.

Remember, the MAC will have changed so you will need to alter/delete the udev "70-persistent-net.rules" files once the machine has started, and then reboot.

For more details on the available NICs and the capabilities of their different types see: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1001805

ParaVirtual SCSI Controller (pvscsi)
My personal experiences of using the pvscsi controller have shown a significant read / write performance gain, at least twice as fast as the other SCSI Controllers.

Officially, only Red Hat Enterprise Linux and maybe CentOS supports this Controller, so don't expect any help from VMWare or the community using it with Gentoo, and be sure to test your setup thoroughly once you have it installed.

There doesn't appear to be any support for the pvscsi in the kernel, this means that the "boot" and "root" partitions need to be on one of the other SCSI controller types. As RHEL appears to be able boot from a device on one of the pvscsi controllers, it might be possible to compile a kernel with pvscsi support built-it. Feel free to have a go. To Add the additional SCSI Controller, first you must add another SCSI disk. Be sure, when you are adding the disk, to select a device node for a SCSI control that doesn't exist. It will automatically add a Controller. AFAIK, there's no other way to add an additional SCSI Controller.

For example, if you only 1 other SCSI Controller when you add the new hard disk, this existing controller will relate to SCSI(0:*). So change the Device Node for the new hard disk to any of the nodes : SCSI(1:*).

Once you have added the hard disk, you will see a new SCSI Controller has also appeared in the list of hardware. Now you can select the Controller and Change it's type to ParaVirtual.

That's it. Once you have started the machine you can use fdisk to add partition(s), format them and you're good togo.

Interface eth0 does not exist
If you have copied / downloaded / moved a gentoo vmware, and you no longer have eth0 it will most likely have moved to eth1 if you do a ifconfig -a. This is because of udev and your mac address changing.

Please see here: http://yoopergeek.blogspot.com/2007/07/vmware-loosing-eth0-after-youve-copied.html

Option 1: Remove '70-persistent-net.rules'

Option 2: Update '70-persistent-net.rules' with the correct mac address (or delete and reboot).

Newer versions of VMWare default to use vmxnet for the default virtual device, but this interface type is not supported by the installation CD. If you are seeing that eth0 does not exist, simply change your vmx file's ethernet config line to

ethernet0.virtualDev = "e1000"

Restart the VM image and the installer should autodetect eth0