Gentoo Wiki Archives

HOWTO_Install_Gentoo_on_VMware

Contents

Introduction

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) provide a safe and easy environment for experimenting, as you are free to try any new Operating System without interfering with your current setup.

Using Preinstalled Images

If you are interested in just seeing what Gentoo has to offer, using a pre-installed image provides the quickest way of testing out Gentoo without having to attempt to install it.

LivePC Version

You can completely avoid the work of downloading, installing, and initially configuring Gentoo using a new technology, the LivePC Engine, available from moka5. Once you install the LivePC engine, you can download a number of LivePCs based off of Gentoo linux. You can get a basic installation of Gentoo with X-Windows and the VMWare Tools. More complete installations are available also, and you can post your own LivePC.

VMWare Virtual Appliance

Gentoo 2006.1 (Barebones) VMWare Appliance. This is a relatively bare bones install of gentoo. Xorg and WM not included.

or search.vmware.com for Gentoo Pre-installed VMWare Virtual Machines: search.vmware.com

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 to HOWTO Configure a dual boot windows linux to be able to open each os in vmware.

Scope

These instructions range from VMware GSX Server 3.1.0 to VMware 5.5.1. For VMware Workstation 6 the vmware-tools works fine. You just need to create the /etc/rc{0..6}.d directories because the installation script wants to create symlinks to /etc/init.d/vmware-tools.

Code: create rcX.d directories
# mkdir /etc/rc{0..6}.d

When the installation is finished, you can remove them and add the real links.

Code: create startup symlinks
# rm -rf /etc/rc{0..6}.d
# rc-update add vmware-tools default


Reading this How to

For each step where the approach is dependent on the version of VMWare, the latest VMWare version is stated at the beginning.

Some sections may have a minimal version stated (eg. 4.5.1) but they will still be valid for higher versions.

Use the instructions pertaining to the closest version at or below your current version.

If no distinction is made then the procedure is valid for all versions.

Preparing Virtual Machine

The first thing to do is, of course, to create a new virtual machine. VMware makes this an easy process. You only have to follow the steps in New Virtual Machine Wizard (File|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.

Installing Gentoo Linux

Basically 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/sda rather than /dev/hda.

Booting LiveCD Image

Assuming that you have already picked and downloaded a LiveCD image to use, you can now connect CD-ROM device to the LiveCD image file. To do so, you can do the following:

  1. Open up Virtual Machine Settings: VM --> Settings...
  2. Select CD-ROM 1 (IDE 1:0) from the device list.
  3. Check the Connect at power on check box.
  4. Select Use ISO image.
  5. Browse and choose the LiveCD image file you downloaded.
  6. Press OK to finalize the changes.

Now start the virtual machine. 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.

Note: If you are running in bridged mode with a static IP on the host computer you will need to run "dhcpcd eth0" at the command line in order to get networking functionality.

Flags in /etc/make.conf

This post (https://anothersysadmin.wordpress.com/2007/11/15/howto-install-a-basic-gentoo-server/), recommends

# CFLAGS="-O2 -march=i686 -pipe"
# CHOST="i686-pc-linux-gnu"
# CXXFLAGS="${CFLAGS}"

This sets up a server (i.e. w/o X Windows). I think the -snmp then snmp is a typo:

# USE="-X -qt -gtk -gnome -kde bash-completion -snmp sockets threads latin1 -berkdb -ipv6 snmp perl"
# PORTDIR_OVERLAY="/usr/local/portage"


2.6.x Kernel Configuration

To start configuration:

# cd /usr/src/linux
# make menuconfig

Finding your devices

If you want to be very sure about exactly what drives 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.

Kernel Options

These are specific options needed currently for most VMWare versions. However, the safest way is to verify all of them with the previous "Finding your Devices" step.

VMWare Tools

VMware Tools uses Kernel Loadable Module support to load and unload its driver(s).

Linux Kernel Configuration: kernel loadable module support
Loadable module support  --->
  [*] Enable loadable module support
  [*]   Module unloading
  [*]   Automatic kernel module loading

Intel PCI/ISA Bridge

Linux Kernel Configuration: Intel PCI/ISA Bridge
Bus options (PCI etc.) --->
  [*] PCI Support
  [*] ISA Support

SCSI Controller

LSI Logic
Linux Kernel Configuration: LSI Logic SCSI adapter
Device Drivers  --->
  Fusion MPT device support  --->
     <*> Fusion MPT (base + ScsiHost) drivers
     OR
     <*> Fusion MPT ScsiHost drivers for SPI [kernel 2.6.13]
Device Drivers  --->
  SCSI device support  --->
     <*> SCSI device support
     <*> SCSI disk support
         SCSI low-level drivers  --->
            <*> SYM53C8XX Version 2 SCSI support
Note: For VMware Server 1.03 (possibly other VMware Workstation products prior to version 6) and kernel versions 2.6.21 and 2.6.22, there's a patch for mptbase.c as described in the Gentoo forums.
BusLogic

By default, VMware virtual machines provide a BusLogic SCSI controller and a SCSI hard drive. Your new kernel should have these device drivers for them:

Linux Kernel Configuration: BusLogic SCSI
Device Drivers  --->
  SCSI device support  --->
     <*> SCSI device support
     <*>   SCSI disk support
           SCSI low-level drivers  --->
              <*> BusLogic SCSI support

CDROM

Linux Kernel Configuration: Intel PIIXn chipset and ISO9660 File System
Device Drivers  --->
  ATA/ATAPI/MFM/RLL support  --->
     <*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
     <*>   Include IDE/ATAPI CDROM support
     [*]   PCI IDE chipset support
     [*]   Generic PCI bus-master DMA support
     <*>     Intel PIIXn chipsets support
File systems  --->
  CD-ROM/DVD Filesystems  --->
    <*> ISO 9660 CDROM file system support
    [*]   Microsoft Joliet CDROM extensions

Network

You will need to enable the following to get basic packet and TCP/IP support.

Linux Kernel Configuration: Network
Networking   --->
  [*] Networking support
      Networking options  --->
        <*> Packet socket
        <*> Unix domain sockets
        [*] TCP/IP networking
Intel EtherPro Gigabit

VMWare Workstation 5.5 and 6.5 seem to use the e1000 Intel EtherPro Gigabit driver.

Linux Kernel Configuration: Network
Device Drivers  --->
  Network Device support  --->
     [*] Network device support
           Ethernet (1000Mbit)  --->
              [*] Intel(R) PRO/1000 Gigabit Ethernet support


This can also be loaded using the e1000 kernel module included in the default Gentoo 2008.0 livecd install.

AMD PCnet-PCI II

Other VMWare Workstations versions, such as Version 6 and VMWare Server use AMD PCnet-PCI II ethernet adaptor.

Linux Kernel Configuration: Network
Device Drivers  --->
  Network Device support  --->
     [*] Network device support
           Ethernet (10 or 100Mbit)  --->
              [*] Ethernet (10 or 100Mbit)
              [*] EISA, VLB, PCI and on board controllers
              <*>   AMD PCnet32 PCI support


This can also be loaded using the pcnet32 kernel module included in the default Gentoo 2008.0 livecd install.

Audio

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.

Linux Kernel Configuration: Sound
Device Drivers  --->
  Sound  --->
     <*> Sound card support
         Advanced Linux Sound Architecture  --->
            <*> Advanced Linux Sound Architecture
            <*> OSS Mixer API
            <*> OSS PCM (digital audio) API
                PCI devices  --->
                   <*> (Creative) Ensoniq AudioPCI 1371/1373

Please refer to Gentoo Linux ALSA Guide for more details on configuring ALSA sound support.

udev Support

These other things might be useful for udev.

Linux Kernel Configuration: Miscellaneous Things
File Systems  --->
  Pseudo filesystems  --->
    <*> /proc file system support
    < >   /proc/kcore support
    <*>   Sysctl support (/proc/sys)
    <*> sysfs file system support
    <*> Virtual memory file system support (former shm fs)
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.

Genkernel

The latest vmware VM appears to use a different scsi driver which can lead to problems. I used genkernel method (genkernel --menuconfig all) and set all the above options. I found that /dev/sda3 could not be mounted as root device, i.e. the kernel did not boot successfully.

I found instructions in mounting /dev/sda3 as root device problems.

In older versions of genkernel, it was necessary to add mptbase and mptscsih to MODULES_SCSI in the x86 architecture's modules_load file (/usr/share/genkernel/x86/modules_load) but that file now has the correct entries.

The kernel config of the Gentoo 2006.1 minimal boot disk (and presumably earlier versions) has all the necessary options set to start drivers for CD-ROM and network, so you can zcat /proc/config.gz >/usr/share/genkernel/x86/kernel-config-2.6 as the Gentoo handbook says, however apparently it's still necessary to compile MPT support into the kernel when you boot from a virtual SCSI disk in VMWare.

Code: rerun genkernel as
genkernel --no-clean --no-mrproper --menuconfig --install all
Linux Kernel Configuration: Compile Fusion MPT support into the kernel
Device Drivers  --->
  Fusion MPT device support  --->
     <*> Fusion MPT ScsiHost drivers for SPI

Installing VMware Tools

If you want to install VMware Tools, please see the "HOWTO Install VMware Tools in Gentoo" article.

Note: Installing VMWare Tools is a pain and results may vary a lot between VMWare products versions, I do recommend to use open-vm-tools instead as it is much easier.

For that, just do :
emerge -av app-emulation/open-vm-tools
rc-update add vmware-tools default

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

echo "app-emulation/open-vm-tools ~x86" >> /etc/portage/package.keywords

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: https://yoopergeek.blogspot.com/2007/07/vmware-loosing-eth0-after-youve-copied.html

  In Gentoo do one of the following: (Do #1, it's the easiest.)
  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
# rm /etc/ssh/ssh_host_key* /etc/ssh/ssh_host_dsa_key* /etc/ssh/ssh_host_rsa_key*
# /etc/init.d/sshd restart

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
# rm /var/lib/dhcpcd/dhcpcd-eth0.info /var/lib/dhcpcd/dhcpcd.duid
# /etc/init.d/net.eth0 restart

Troubleshooting

Kernel timing issues in 2.6.x

Timing code in Linux kernel 2.6.x were revised so much that it causes problem when running inside VMware virtual machine. I have searched the Web, tried many suggestions, and read the kernel source code. Yet so far I can't find a satisfactory solution. If any body has been running kernel 2.6.x without timing problem, please help provide a solution here.

I think this has to do with the kernel itself. I just noticed suck errors with 2.6.11 vivid sources. I do not recall this error in the 2.6.9 or 2.6.10 builds.

I was running a 2.6 kernel before in VMware (and have been since 2.6.0 came out) but I've only resently noticed timing problems after following the NPTL and Reiser4 HOWTOs (using the 2.6.10-mm1 kernel) Alas, I don't have a solution, but I will be trying an older 2.6 to see if I still get the timing issues.

Try this: /usr/src/linux/include/asm-i386/param.h:

   #define HZ 1000

Change the value of HZ from 1000 to 100:

   #define HZ 100

VMware has a KB entry on Linux guest timing problems. It mentions the above "#define HZ 1000" timer interrupt rate fix—which is only for slow guest clocks—as well as some fixes for Linux guest clocks that run too fast.

VMware has also this entry

Another problem that you can encounter is when the hosts hardware has a power saving mode that changes the physical cpu's clock speed. The fix for this problem can be found here: Host Power Management Causes Problems with Guest Timekeeping


2006-12-10: also can try the "vmw" program.

Timing issues fix on ESX server

Originally I fixed this with a ntp client. Kind of a kludge but it worked. Eventually I got annoyed enough to locate a KB entry that deals with this. Here is how to fix this: From the main page select the "Options" tab. Then select "Advanced Settings" from the right column.

The real timer hardware is set by default to deliver a maximum of 1000 clock interrupts per second per CPU. Here you'll want to lower this to alow it to keep up with the resolution of the 2.6 clock cycle. Set Misc.TimerHardPeriod to 333.

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: https://yoopergeek.blogspot.com/2007/07/vmware-loosing-eth0-after-youve-copied.html

The relevant file is /etc/udev/rules.d/70-persistent-net.rules, update it with the correct mac address (or delete and reboot).