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

From ArchWiki
Jump to: navigation, search
(Starting VMs on Arch x86-64)
(Updated and refactored the page since the maintainer of the open-vm-* took my patches. Now, pretty much everything works, on x86_64 as well.)
Line 7: Line 7:
 
{{i18n_entry|Español|Cómo instalar Arch Linux en VMWare (Español)}}
 
{{i18n_entry|Español|Cómo instalar Arch Linux en VMWare (Español)}}
 
{{i18n_links_end}}
 
{{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.
+
== Installing Arch ==
 +
Installing Arch Linux inside a VM (e.g. in VMWare running on Windows XP or using VMWare fusion on MacOS) works without trouble.
  
== The Procedure ==
+
Removing the pata and sata hooks from /etc/mkinitcpio.conf does not cause problems. VMWare emulates an scsi drive (an ancestor of sata).
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:
+
== VM Tools ==
 +
The VM Tools improve networking capability, cut and paste between the host and the guest under X, or access of the directories on host from the guest (called shared folders by vm ware)
  
 +
Install the open-vm-tools package from community
 +
pacman -Sy open-vm-tools
 +
and start VMware tools with:
 
  /etc/rc.d/open-vm-tools start
 
  /etc/rc.d/open-vm-tools start
  
If you get an error message, then a few dependencies may be missing
+
To start them automatically at boot, add the deamon to your /etc/rc.conf deamon array
 
+
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 ...)
 
  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).
+
== Installing X ==
  
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.
+
Beyond installing Xorg (see main article [[Xorg]]), the packages needed in order to be able to use X properly can be installed with
 +
# pacman -S xf86-input-vmmouse xf86-video-vmware
 +
and the fallback X drivers
 +
# pacman -S  xf86-input-mouse xf86-video-vesa
 +
then configure X
 +
# pacman -S hwd
 +
# hwd -x
 +
# cp /etc/X11/xorg.conf.vmware /etc/X11/xorg.conf
 +
and edit /etc/X11/xorg.conf to set the mouse driver to vmmouse.
  
From within your Arch Linux guest OS type:
+
Start X (see main article).
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:
+
A client software needs to run in order for cut and paste to work, start vmware-user (it should not run as root) on login by either adding the line
  poweroff-vm-default
+
vmware-user&
  poweron-vm-default
+
to .xinitrc or .xsession for startx or by adding the following file $HOME/.config/autostart/vmware-user.desktop
  resume-vm-default
+
  [Desktop Entry]
  suspend-vm-default
+
  Type=Application
 +
  Name=VMWare User Agent
 +
Exec=vmware-user
 +
  Icon=system-run
 +
Comment=Enable Unity, DnD, etc.
 +
for e.g. gdm.
  
Your Arch Linux VM should now shutdown properly.
+
== Enable Unity ==
+
Note: there's no open-vm-tools package  in x86_64
+
  
all the below work just don't need anymore:)
+
Unity is not install by default because the package uriparser is not maintained, although it is in aur. However, it works very well. To enable support for unity, you need to use the Arch Building System (see main article [[ABS]]).
  
Most of this expects that you are root.
+
Retrieve and compile uriparser
   
+
  # abs
Versions of things used at time of writing:
+
$ mkdir -p ~/arch.abs/
* 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
+
$ cd ~/arch.abd
* Arch Linux (Duke) with kernel 2.6.21.1-8 installed on VMWare Workstation 6.0.0 build-45731 running on a Windows XP host
+
$ mkdir -p aur/uriparser
* Arch Linux (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
+
$ cd aur/uriparser
 +
$ wget aur.archlinux.org/packages/uriparser/uriparser/PKGBUILD
 +
$ makepkg -s
 +
$ sudo pacman -U --asdeps uriparser-*.pkg.tar.gz
  
'''WARNING'''
+
Then modify the two packages modules/open-vm-tools-modules and system/open-vm-tools available from community and remove --disable-unity from the configure line. Then recompile them, starting with the modules, install with
* VMWare Workstation 6.0.0 build-45731 guest additions '''do not''' work with kernel 2.6.22!
+
$ makepkg -s
* 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):
+
$ sudo pacman -U --asdeps open-vm-modules-*.pkg.tar.gz
 +
and finally the tools, install with
 +
$ makepkg -s
 +
$ sudo pacman -U open-vm-tools-*.pkg.tar.gz
 +
no --asdeps here.
  
pacman -Su --ignore kernel-headers --ignore kernel26 --ignore glibc --ignore binutils --ignore gcc
+
Reboot, Unity should be enabled once vmware-user is running.
  
'''UPDATE FOR KERNELS >= 2.6.22'''
+
== Shared Folders with the Host ==
* 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
+
[http://www.cs.ucr.edu/~jbyrne/vmware.htm 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.
+
 
+
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.
+
vmxnet
+
vmmemctl
+
vmblock
+
vmhgfs
+
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"
+
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
+
 
+
#!/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:\'''.
 
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:\'''.
Line 313: Line 96:
  
  
=== Starting VMs on Arch x86-64 ===
+
== Troubleshooting ==
 
+
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.
+
 
+
First of all, do an install with pacman.
+
# pacman -Sy lib32-glibc
+
 
+
Now, we will have to get some packages from AUR.
+
*http://aur.archlinux.org/packages.php?ID=19168
+
*http://aur.archlinux.org/packages.php?ID=19169
+
*http://aur.archlinux.org/packages.php?ID=19170
+
 
+
All these packages are maintained by me. <!-- By who?! --> 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:
+
/emul/linux/x86/lib
+
/emul/linux/x86/usr/lib
+
/emul/linux/x86/usr/qt/3/lib
+
  
Now execute the following command as root:
+
=== Networking ===
# ldconfig
+
  
Okay, we all done. Try now to start the VMs. It will work most likely. Have fun.
+
If there is a problem with networking, it is possible that the module pcnet32 steals the network interface from vmware, disabling it works,
 +
MODULES=(!pcnet32 ...)
  
 
==See Also==
 
==See Also==
 
* [[Installing VMware]]
 
* [[Installing VMware]]
 +
* [http://www.cs.ucr.edu/~jbyrne/vmware.htm VMWare on Slackware Linux]
 
* [[Installing vmware player]] -- the opposite of this ;)
 
* [[Installing vmware player]] -- the opposite of this ;)
 
* To get vmxnet working with the current (as of mid DEC06) stuff, review this: [http://www.vmware.com/community/thread.jspa?messageID=518943 vmware tools 5.5.3, linux 2.6.19, vmxnet compile fix]
 
* To get vmxnet working with the current (as of mid DEC06) stuff, review this: [http://www.vmware.com/community/thread.jspa?messageID=518943 vmware tools 5.5.3, linux 2.6.19, vmxnet compile fix]

Revision as of 07:24, 15 May 2009

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

Installing Arch

Installing Arch Linux inside a VM (e.g. in VMWare running on Windows XP or using VMWare fusion on MacOS) works without trouble.

Removing the pata and sata hooks from /etc/mkinitcpio.conf does not cause problems. VMWare emulates an scsi drive (an ancestor of sata).

VM Tools

The VM Tools improve networking capability, cut and paste between the host and the guest under X, or access of the directories on host from the guest (called shared folders by vm ware)

Install the open-vm-tools package from community

pacman -Sy open-vm-tools

and start VMware tools with:

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

To start them automatically at boot, add the deamon to your /etc/rc.conf deamon array

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

Installing X

Beyond installing Xorg (see main article Xorg), the packages needed in order to be able to use X properly can be installed with

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

and the fallback X drivers

# pacman -S  xf86-input-mouse xf86-video-vesa

then configure X

# pacman -S hwd
# hwd -x
# cp /etc/X11/xorg.conf.vmware /etc/X11/xorg.conf

and edit /etc/X11/xorg.conf to set the mouse driver to vmmouse.

Start X (see main article).

A client software needs to run in order for cut and paste to work, start vmware-user (it should not run as root) on login by either adding the line

vmware-user&

to .xinitrc or .xsession for startx or by adding the following file $HOME/.config/autostart/vmware-user.desktop

[Desktop Entry]
Type=Application
Name=VMWare User Agent
Exec=vmware-user
Icon=system-run
Comment=Enable Unity, DnD, etc.

for e.g. gdm.

Enable Unity

Unity is not install by default because the package uriparser is not maintained, although it is in aur. However, it works very well. To enable support for unity, you need to use the Arch Building System (see main article ABS).

Retrieve and compile uriparser

# abs
$ mkdir -p ~/arch.abs/
$ cd ~/arch.abd
$ mkdir -p aur/uriparser
$ cd aur/uriparser
$ wget aur.archlinux.org/packages/uriparser/uriparser/PKGBUILD
$ makepkg -s
$ sudo pacman -U --asdeps uriparser-*.pkg.tar.gz

Then modify the two packages modules/open-vm-tools-modules and system/open-vm-tools available from community and remove --disable-unity from the configure line. Then recompile them, starting with the modules, install with

$ makepkg -s
$ sudo pacman -U --asdeps open-vm-modules-*.pkg.tar.gz

and finally the tools, install with

$ makepkg -s
$ sudo pacman -U open-vm-tools-*.pkg.tar.gz

no --asdeps here.

Reboot, Unity should be enabled once vmware-user is running.

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


Troubleshooting

Networking

If there is a problem with networking, it is possible that the module pcnet32 steals the network interface from vmware, disabling it works,

MODULES=(!pcnet32 ...)

See Also