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

From ArchWiki
Jump to navigation Jump to search
m (Fixed typo)
(Starting VMs on Arch x86-64)
Line 314: Line 314:
=== Starting VMs on Arch x86-64 ===
=== Starting VMs on Arch x86-64 ===
Update: open-vm-tools compile on x86_64, see [http://bbs.archlinux.org/viewtopic.php?id=72026 the bbs]
Not easy, but its possible. Just follow the steps below.
Not easy, but its possible. Just follow the steps below.

Revision as of 20:44, 12 May 2009

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 Arch Linux 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 libdnet

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

DAEMONS=(.... ... .... 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 Arch Linux 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:


Your Arch Linux 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:

  • Arch Linux 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 Arch Linux host
  • Arch Linux (Duke) with kernel installed on VMWare Workstation 6.0.0 build-45731 running on a Windows XP host
  • Arch Linux (Don't Panic) with kernel installed on VMWare Workstation 6.0.1 build-55017 running on a Windows XP host


  • 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 Arch Linux (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


  • 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>
@@ -24,7 +24,7 @@
 * Destructor is gone since 2.6.23-pre1.
#define compat_kmem_cache_create(name, size, align, flags, ctor) \
kmem_cache_create(name, size, align, flags, ctor, NULL)


(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

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.

In case you receive the error message

The following VMware kernel modules have been found on your system that were 
not installed by the VMware Installer.  Please remove them then run this 
installer again.
Execution aborted.

either you can remove the modules, but in case that you don't succeed and still get this you will need to hack the install script in the following way:

1. edit vmware-install.pl with your favorite editor
2. around line 190 you will find sub non_vmware_modules_installed 
3. insert in the line after my @installed_modules; the text return @installed_modules;

This will make the script to entirely skip the check and allow you to continue the installation. If you get this error you will need to hack exactly the same way the configure script too. The name of the subroutine is the same.

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"


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.


  1. !/bin/bash

vmware-user &

into the file and save it.

Reboot and everything should work.

VMWare Workstation 6.5

When installing Arch Linux using VMWare workstation 6.5 the installation is much easier. Assuming it is a clean install of Arch. Make sure you have xorg, gnome, make and gcc installed:

pacman -S xorg gnome make gcc

When you are in X/Gnome you can set up VMWare tools Make the required folders as with previous versions:

mkdir -p /etc/vmware-tools/init.d
mkdir /etc/vmware-tools/rc{0,1,2,3,4,5,6}.d

From the VMWare workstation console select to install the VMWare tools. Copy and extract the VMWareTools-6.5.0-118166.tar.gz file. Run the vmware-install.pl file from the extracted vmware-tools-distrib folder When asked for the init directories enter: /etc/vmware-tools Leave all the other options on their defaults (just hit enter) At the end of the script it will fail. First delete the following file which will block vmware-tools from starting.

rm /etc/vmware-tools/not_configured

Next edit the vmware-tools file

vim /etc/vmware-tools/init.d/vmware-tools

Locate and replace "/sbin/insmod -s -f" in the vmware_load_module() function all four times with "/sbin/modprobe -s" Next locate and replace "/sbin/lsmod" in the isLoaded() function with "/bin/lsmod" Save the file. You should now be able to start vmware-tools successfully:

/etc/vmware-tools/init.d/vmware-tools start

Configure vmware-tools to start automatically

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.

The vmware-user program should have been automatically configured to start when Gnome does (check in System > Preferences > Session)

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:\ ...

Starting VMs on Arch x86-64

Update: open-vm-tools compile on x86_64, see the bbs

Not easy, but its possible. Just follow the steps below.

First of all, do an install with pacman.

# pacman -Sy lib32-glibc

Now, we will have to get some packages from AUR.

All these packages are maintained by me. So if you have problems with them, email me. The original author work is respected, and his name is in the PKGBUILD as contributor. Now unpack each package to a folder what you decide where (at me, /usr/src/arch/). In example, I will use my way of installing things on Arch.

$ cd /where/you/moved/them

Then do the extract:

$ tar -xvzf emul32-baselibs.tar.gz
$ tar -xzvf emul32-compat.tar.gz
$ tar -xvzf emul32-xlibs.tar.gz

Then compile and install them one-by-one. Use the following command. (Yes its only one long command. Do it from the "root" directory, where you have the packages.):

# cd emul32-baselibs && makepkg --asroot && pacman -U *.pkg.tar.gz && cd .. && cd emul32-compat && makepkg --asroot && pacman -U *.pkg.tar.gz && cd .. && cd emul32-xlibs && makepkg --asroot && pacman -U *pkg.tar.gz && cd ..

Okay, we have compiled and installed them with this long 'script'. Now edit the /etc/ld.so.conf as the text shows. Open the file with your favourite editor (I use VIM).

# vim /etc/ld.so.conf

And add the following lines:


Now execute the following command as root:

# ldconfig

Okay, we all done. Try now to start the VMs. It will work most likely. Have fun.

See Also