Difference between revisions of "VMware/Installing Arch as a guest"

From ArchWiki
Jump to: navigation, search
m (The Procedure)
Line 23: Line 23:
 
  Pacman -Sy icu
 
  Pacman -Sy icu
 
  Pacman -Sy libdnet
 
  Pacman -Sy libdnet
 +
 +
ICU version:
 +
open-vm-tools-2008.05.15-1 require icu-3.8.1-2. It do not support icu-4.0.1. If pacman upgrade icu for you, you have to downgrade it manually. You may find the pkg.tar.gz from following location
 +
http://server.elsistech.com/archlinux/extra/os/i686/icu-3.8.1-2-i686.pkg.tar.gz
 +
http://ftp.iasi.roedu.net/mirrors/archlinux.org/extra/os/i686/icu-3.8.1-2-i686.pkg.tar.gz
 +
  
 
Or to start it automatically at boot, add the deamon to your /etc/rc.conf deamon array:
 
Or to start it automatically at boot, add the deamon to your /etc/rc.conf deamon array:

Revision as of 12:55, 10 August 2008

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end Installing Arch Linux inside a VM (e.g. in VMWare running on Windows XP or using VMWare fusion on MacOS) works without trouble; however, VMWare-tools for Linux guests will not install onto an archlinux on VM 'out of the box.

Remark: you may not need VMWare-tools at all, depending what you want to do. You need them for higher X screen resolutions, shared folders with the host OS, and some other things.

The Procedure

NOTE: Now you can install the open-vm-tools package, which is already in the Community Repository. So just type:

pacman -Sy open-vm-tools

Start VMware tools with:

/etc/rc.d/open-vm-tools start

If you get an error message, then a few dependencies may be missing

Pacman -Sy icu
Pacman -Sy libdnet

ICU version: open-vm-tools-2008.05.15-1 require icu-3.8.1-2. It do not support icu-4.0.1. If pacman upgrade icu for you, you have to downgrade it manually. You may find the pkg.tar.gz from following location http://server.elsistech.com/archlinux/extra/os/i686/icu-3.8.1-2-i686.pkg.tar.gz http://ftp.iasi.roedu.net/mirrors/archlinux.org/extra/os/i686/icu-3.8.1-2-i686.pkg.tar.gz


Or to start it automatically at boot, add the deamon to your /etc/rc.conf deamon array:

DEAMONS=(.... ... .... open-vm-tools ...)

Once the open-vm-tools are running everything appears to work as expected except that it is not possible to do a clean shut down of the VM. Even if the "shut down guest" option rather than a "power off" is used, the VM does not handle the signal correctly and fails to shut down (or works on the second attempt).

This presents a problem when using the vmrun.exe stop command, however, restoring a few missing files in the /etc/vmware-tools directory fixes it. The easiest way to get the scripts (using Workstation) is to mount the VMware Tools using the "Install VMware Tools..." option under the VM menu. Clicking this menu item will present the VMware Tools ISO to the CD-ROM and allow you to mount it.

From within your Archlinux guest OS type:

mount /media/cd
cp /media/cd/VMwareTools-XX.tar.gz ~/tmp
cd ~/tmp
tar -xzvf VMwareTools-XX.tar.gz
cp ~/tmp/vmware-tools-distrib/etc/*default /etc/vmware-tools

The above commands add the following scripts to /etc/vmware-tools:

poweroff-vm-default
poweron-vm-default
resume-vm-default
suspend-vm-default

Your Archlinux VM should now shutdown properly.

Note: there's no open-vm-tools package in x86_64

all the below work just don't need anymore:)

Most of this expects that you are root.

Versions of things used at time of writing:

  • ArchLinux with kernel 2.6.17-3 & 2.6.18-2 / Xorg 7.1 installed on VMWare Workstation 5.5.2 build-29772 running on a Archlinux host
  • ArchLinux (Duke) with kernel 2.6.21.1-8 installed on VMWare Workstation 6.0.0 build-45731 running on a Windows XP host
  • ArchLinux (Don't Panic) with kernel 2.6.22.6-2 installed on VMWare Workstation 6.0.1 build-55017 running on a Windows XP host

WARNING

  • VMWare Workstation 6.0.0 build-45731 guest additions do not work with kernel 2.6.22!
  • To get around this problem and ensure your installation is mostly up-to-date (except kernel) install ArchLinux (Duke 2007.05) within VMWare and then perform the following system upgrade (to get to Don't Panic 2007.08):
pacman -Su --ignore kernel-headers --ignore kernel26 --ignore glibc --ignore binutils --ignore gcc

UPDATE FOR KERNELS >= 2.6.22

  • VMWare Workstation 6.0.1 build-55017 does play nicely with kernel versions 2.6.22 and above.
  • Simply follow the same procedures as described in this document except one simple patch/change is necessary for the guest tools to compile. After extracting the tools to /opt/vmware-tools do the following:
cd /opt/vmware-tools/lib/vmware-tools/modules/source
tar -xvf vmhgfs.tar
cd vmhgfs-only
<edit compat_slab.h> and apply the simple one line patch shown below
cd ..
mv vmhgfs.tar vmhgfs.tar.orig
tar -cvf vmhgfs.tar vmhgfs-only
<continue as described by this document>
compat_slab.h
@@ -24,7 +24,7 @@
/*
 * Destructor is gone since 2.6.23-pre1.
 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)
#define compat_kmem_cache_create(name, size, align, flags, ctor) \
kmem_cache_create(name, size, align, flags, ctor, NULL)
#else

Preparations

(Some important parts of this procedure were adapted from/inspired by a page called VMWare on Slackware Linux; more technical information that this author does not pretend to understand is there.)

(directory paths have been chosen similar to those used in the vmware-workstation AUR package)

This guide assumes the user is installing from the .tar.gz package (not the .rpm). see http://www.vmware.com/support/ws55/doc/ws_newguest_tools_linux.html for details

Problem #1: The VMWare-tools install script (vmware-install.pl) assumes that since the guest OS is Linux, the OS will be using sysV style init scripts. Since Arch uses BSD style init, VMWare needs to be given a directory containing the expected rc0.d to rc6.d and init.d. Running the following as root should give VMWare enough of a sysV interface to be satisfied:

mkdir -p /etc/vmware-tools/init.d
cd /etc/vmware-tools
mkdir rc0.d
mkdir rc1.d
mkdir rc2.d
mkdir rc3.d
mkdir rc4.d
mkdir rc5.d 
mkdir rc6.d

For the Bash power user: mkdir rc{0,1,2,3,4,5,6}.d

Create a link from /etc/rc.d/network to /etc/vmware-tools/init.d

ln -s /etc/rc.d/network /etc/vmware-tools/init.d/network

Problem #2:

The vmware-tools installer checks for an entry in the kernel header's version.h file, that does not exist there. We'll paste it into the file with the following command:

echo "#define UTS_RELEASE \"`uname -r`\"" >> /usr/src/linux-`uname -r`/include/linux/version.h

Check if it is done right (2.6.19-ARCH replaced with your kernel version):

cat /usr/src/linux-`uname -r`/include/linux/version.h

#define LINUX_VERSION_CODE 132627
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#define UTS_RELEASE "2.6.19-ARCH"

Start the Installer

Expose the VMWare Tools iso by selecting VM -> Install VMWare Tool... from the VMWare Workstation menu.

Mount the VMWare Tools iso, copy the tar.gz, and extract:

mount /mnt/cdrom
cp /mnt/cdrom/VMwareTools-6.0.0-45731.tar.gz ~
umount /mnt/cdrom
cd ~
tar -zxvf VMwareTools-6.0.0-45731.tar.gz

Go to the place you extracted the installer and start the installer:

cd ~/vmware-tools-distrib
./vmware-install.pl

Specify the following answers:

"In which directory do you want to install the binary files?": /opt/vmware-tools/bin
"What is the directory that contains the init directories ... ?": /etc/vmware-tools
For the rest accept default locations and say yes when a directory creation is needed.
When the installer asks you to run vmware-config-tools.pl answer 'no' 

The installer part is done.

Run the Config Script

Run /opt/vmware-tools/bin/vmware-config-tools.pl

The script asks 'What is the location of the directory of C header files that match your running kernel? [/usr/src/linux/include]'. Answer with:

/usr/src/linux-`uname -r`/include

It will compile some things, detect Xorg, and ask for an X screen resolution (choose one). For the X configuration to work properly you must have already installed Xorg on your system. See Xorg for more details. At the very least you should run:

pacman -S xorg-server xorg-xkb-utils xorg-xauth xorg-server-utils xorg-xinit
pacman -S xf86-video-vesa xf86-input-mouse xf86-input-keyboard
pacman -S hwd
hwd -x
mv /etc/X11/xorg.conf.hwd /etc/X11/xorg.conf

Final steps

pacman -S xf86-video-vmware xf86-input-vmmouse

Edit /etc/X11/xorg.conf and look for:

Section     "InputDevice"
Identifier  "Mouse1"

Change the two following lines to this:

Driver      "vmmouse"
Option      "Device"   "/dev/psaux"

If this does not work (e.g. with VMWare Fusion) try:

Section "InputDevice"

       Identifier  "Mouse1"
       Driver      "mouse"

EndSection

On MacOS you should now (after restarting X) be able to use the two-finger scrolling and double click.


In rc.conf look for the MODULES= line and disable the pcnet32 module and enable the vmware modules so it looks like this:

MODULES=(!pcnet32 vmblock vmxnet vmmemctl vmhgfs)

In order for the system date and time to be in sync the vmware-guestd application must be running. This can be started during boot by make the following symlink:

cd /etc/rc.d 
ln -s /etc/vmware-tools/init.d/vmware-tools vmware-tools

Then in rc.conf look for the DAEMONS= line and add 'vmware-tools' to it.

Additionally, in order for copy/paste to work between X and the host you must run the 'vmware-user' application. Add the following line to you .xinitrc or .xsession (wherever you start apps during X initialization):

/opt/vmware-tools/bin/vmware-user &

Note that some versions of VMWare (e.g. the tools shipped with Fusion) are located in /usr/lib/vmware-tools/bin32/.

If you use KDE, vmware-user has to be started from the Autostart folder. Create a file called vmware-user in your ~/.kde/Autostart directory.

Write

  1. !/bin/bash

vmware-user &

into the file and save it.

Reboot and everything should work.

Using Shared Folders with the Host

Create a new Shared Folder by selecting VM -> Settings... from the VMware Workstation menu. Select the Options tab and then Shared Folder. Check the Always enabled option and create a new share. For Windows XP you can create a share with the Name C and the Host Path C:\.

Then add the following line to you /etc/fstab file (changing uid/gid as needed):

.host:/ /mnt/hgfs vmhgfs defaults,user,ttl=5,uid=root,gid=root,fmask=0133,dmask=0022 0 0

Make the mount directory and mount the Shared Folders:

mkdir /mnt/hgfs
mount /mnt/hgfs

All of your shared folders will now be visible by name under /mnt/hgfs

/mnt/hgfs/<Shared Folder Name>

For the Windows XP C share example:

ls /mnt/hgfs/C
... all your Windows files under C:\ ...

See Also

Installing VMware and Installing vmware player -- the opposite of this ;)

To get vmxnet working with the current (as of mid DEC06) stuff, review this: vmware tools 5.5.3, linux 2.6.19, vmxnet compile fix