Difference between revisions of "VMware"

From ArchWiki
Jump to: navigation, search
m (Could not open /dev/vmmon: No such file or directory.)
(Adding DKMS support for workstation kernel modules.)
Line 97: Line 97:
 
then adding the name to the {{Ic|<Virtual machine name>.vmx}} file:
 
then adding the name to the {{Ic|<Virtual machine name>.vmx}} file:
 
{{hc|~/vmware/<Virtual machine name>/<Virtual machine name>.vmx|2=bios440.filename = "bios440.rom"}}
 
{{hc|~/vmware/<Virtual machine name>/<Virtual machine name>.vmx|2=bios440.filename = "bios440.rom"}}
 +
 +
===Use DKMS to manage kernel modules===
 +
The Dynamic Kernel Module Support can be used to manage Workstation kernel modules and void you to re-run vmware-modconfig each time your kernel changed. The solution proposed here creates a DKMS configuration that uses a custom Makefile to compile modules. The modules are compiled and installed by vmware-modconfig (to be sure to compile the right way), then DKMS get them and removed them from current kernel tree. Finally they are installed and followed by DKMS.
 +
To setup the DKMS environnement, use the following guide.
 +
 +
First creates a "source" directory that will contain the Makefile and the DKMS config file.
 +
# mkdir /usr/src/vmware-modules
 +
 +
Then creates the dkms.conf file in the directory. This file describes the name of the module, how to compile and where we want to setup the modules.
 +
 +
# cat << EOF > /usr/src/vmware-modules/dkms.conf
 +
PACKAGE_NAME="vmware-modules"
 +
PACKAGE_VERSION="9"
 +
 +
MAKE[0]="make all"
 +
CLEAN="make clean"
 +
 +
BUILT_MODULE_NAME[0]="vmmon"
 +
BUILT_MODULE_LOCATION[0]="modules"
 +
 +
BUILT_MODULE_NAME[1]="vmnet"
 +
BUILT_MODULE_LOCATION[1]="modules"
 +
 +
BUILT_MODULE_NAME[2]="vmblock"
 +
BUILT_MODULE_LOCATION[2]="modules"
 +
 +
BUILT_MODULE_NAME[3]="vmci"
 +
BUILT_MODULE_LOCATION[3]="modules"
 +
 +
BUILT_MODULE_NAME[4]="vsock"
 +
BUILT_MODULE_LOCATION[4]="modules"
 +
 +
DEST_MODULE_LOCATION[0]="/extra/vmware"
 +
DEST_MODULE_LOCATION[1]="/extra/vmware"
 +
DEST_MODULE_LOCATION[2]="/extra/vmware"
 +
DEST_MODULE_LOCATION[3]="/extra/vmware"
 +
DEST_MODULE_LOCATION[4]="/extra/vmware"
 +
 +
AUTOINSTALL="yes"
 +
EOF
 +
 +
Creates the Makefile:
 +
 +
# cat << EOF > /usr/src/vmware-modules-9/Makefile
 +
KERNEL := $(KERNELRELEASE)
 +
HEADERS := /usr/src/linux-$(KERNEL)/include
 +
GCC := $(shell vmware-modconfig --console --get-gcc)
 +
DEST := /lib/modules/$(KERNEL)/vmware
 +
 +
TARGETS := vmmon vmnet vmblock vmci vsock
 +
 +
LOCAL_MODULES := $(addsuffix .ko, $(TARGETS))
 +
 +
all: $(LOCAL_MODULES)
 +
        mkdir -p modules/
 +
        mv *.ko modules/
 +
        rm -rf $(DEST)
 +
        depmod
 +
 +
%.ko:
 +
        vmware-modconfig --console --build-mod -k $(KERNEL) $* $(GCC) $(HEADERS) vmware/
 +
        cp -f $(DEST)/$*.ko .
 +
 +
clean:
 +
        rm -rf modules/
 +
EOF
 +
 +
Now that configuration files are created we just have to tell DKMS we want to register this new module, build and install it. With the AUTOINSTALL parameter defined in the configuration file, DKMS will know that he has to recompile/reinstall automatically each time the kernel changed.
 +
 +
# dkms -m vmware-modules -v 9 -k `uname -r` add
 +
 +
Creating symlink /var/lib/dkms/vmware-modules/9/source ->
 +
                  /usr/src/vmware-modules-9
 +
 +
DKMS: add completed.
 +
# dkms -m vmware-modules -v 9 -k `uname -r` build
 +
 +
Building module:
 +
cleaning build area....
 +
make KERNELRELEASE=3.5.4-1-ARCH all........
 +
cleaning build area....
 +
 +
DKMS: build completed.
 +
# dkms -m vmware-modules -v 9 -k `uname -r` install
 +
 +
vmmon:
 +
Running module version sanity check.
 +
  - Original module
 +
    - No original module exists within this kernel
 +
  - Installation
 +
    - Installing to /usr/lib/modules/3.5.4-1-ARCH/extra/vmware/
 +
[...]
 +
depmod.....
 +
 +
DKMS: install completed.
 +
 +
At this point, if everything went fine, DKMS is ready and your modules will be automagically recompiled next time.
  
 
== Troubleshooting ==
 
== Troubleshooting ==

Revision as of 13:03, 19 September 2012

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

This article is about installing VMware in Arch Linux; you may also be interested in Installing Arch Linux in VMware.

Note: This article supports only the latest major VMware versions, meaning VMware Workstation 9 and VMware Player 5.

Installation

Note: VMware Workstation/Player will not be manageable with pacman as the files are not installed with it.

1. Download the latest VMware Workstation or VMware Player (you may also try the testing (Beta/RC) versions).

2. Start the installation (--console uses terminal instead of the GUI):

$ chmod +x VMware-<edition>-<version>.<release>.<architecture>.bundle
# ./VMware-<edition>-<version>.<release>.<architecture>.bundle --console

3. Read & accept the EULA to continue.

4. Set System service scripts directory to /etc/rc.d.

5. (Optional) If Eclipse is installed, enter the directory path to the Integrated Virtual Debugger.

6. You will now get an error about the "rc*.d style init script directories" not being set. This can, however, be safely ignored.

7. Create links for the daemons:

# ln -s /etc/init.d/vmware /etc/rc.d/
# ln -s /etc/init.d/vmware-workstation-server /etc/rc.d/

Configuration

Tip: There is also a package called vmware-patchAUR in the AUR with the intention of trying to automate this section (it also supports older VMware versions).

Module tool paths

Note: As of kmod 5-2 the locations of lsmod, modinfo, etc. have changed from /bin/ to /usr/bin/.

8. The module tool paths of certain Workstation scripts now need to be pointed to /usr/bin/ instead of /sbin/. These include the service script in /etc/init.d/ and some other ones in /usr/bin/:

# perl -p -i -e 's|/sbin/(?!modprobe)|/usr/bin/|g' /etc/init.d/vmware /usr/bin/vm-support /usr/bin/vmplayer /usr/bin/vmware /usr/bin/vmware-hostd /usr/bin/vmware-wssc-adminTool

with VMware Player you need to drop /usr/bin/vmware, /usr/bin/vmware-hostd and /usr/bin/vmware-wssc-adminTool, as they're not included:

# perl -p -i -e 's|/sbin/(?!modprobe)|/usr/bin/|g' /etc/init.d/vmware /usr/bin/vm-support /usr/bin/vmplayer 
Note: You will need to redo this upon every update.

As a long-term solution you could also just create symlinks with:

# for i in {ins,ls,rm}mod modinfo; do ln -s /usr/bin/$i /sbin/$i; done

VMware module patches and installation

VMware Workstation 9 and Player 5 both support kernels up to 3.5.

3.5 / 3.6rc kernels

A change in the format of the kernel exception table introduced back in April affecting the vmmon module is known to cause crashes in Fedora guests. The patch here creates a portable exception table (packaged together with the script in here) and will also install the modules afterwards by executing # vmware-modconfig --console --install-all (this will also reload the vmmon module):

$ cd /tmp
$ curl -O http://communities.vmware.com/servlet/JiveServlet/download/2103172-94260/vmware9_kernel35_patch.tar.bz2
$ tar --strip-components=1 -xvf vmware9_kernel35_patch.tar.bz2  # The "--strip-components=1" flag extracts the files only
# ./patch-modules_3.5.0.sh

Finishing up

9. (Optional) Add vmwared to the DAEMONS array in /etc/rc.conf so that the service is started automatically on boot.

10. Now, open your VMware Workstation (vmware in the console) or VMware Player (vmplayer in the console) to configure & use!

Warning: When upgrading the kernel you will have to rebuild the VMware modules with the following command:
# vmware-modconfig --console --install-all
Failure to do so may result in a system crash upon powering up virtual machines.

Tips & Tricks

Entering the Workstation License Key from terminal

# /usr/lib/vmware/bin/vmware-vmx-debug --new-sn XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

Where XXXXX-XXXXX-XXXXX-XXXXX-XXXXX is your license key.

Extracting the VMware BIOS

$ objcopy /usr/lib/vmware/bin/vmware-vmx -O binary -j bios440 --set-section-flags bios440=a bios440.rom.Z
$ perl -e 'use Compress::Zlib; my $v; read STDIN, $v, '$(stat -c%s "./bios440.rom.Z")'; $v = uncompress($v); print $v;' < bios440.rom.Z > bios440.rom

Using the modified BIOS

If and when you decide to modify the extracted BIOS you can make your virtual machine use it by moving it to ~/vmware/<Virtual machine name>:

$ mv bios440.rom ~/vmware/<Virtual machine name>/

then adding the name to the <Virtual machine name>.vmx file:

~/vmware/<Virtual machine name>/<Virtual machine name>.vmx
bios440.filename = "bios440.rom"

Use DKMS to manage kernel modules

The Dynamic Kernel Module Support can be used to manage Workstation kernel modules and void you to re-run vmware-modconfig each time your kernel changed. The solution proposed here creates a DKMS configuration that uses a custom Makefile to compile modules. The modules are compiled and installed by vmware-modconfig (to be sure to compile the right way), then DKMS get them and removed them from current kernel tree. Finally they are installed and followed by DKMS. To setup the DKMS environnement, use the following guide.

First creates a "source" directory that will contain the Makefile and the DKMS config file.

# mkdir /usr/src/vmware-modules

Then creates the dkms.conf file in the directory. This file describes the name of the module, how to compile and where we want to setup the modules.

# cat << EOF > /usr/src/vmware-modules/dkms.conf
PACKAGE_NAME="vmware-modules"
PACKAGE_VERSION="9"

MAKE[0]="make all"
CLEAN="make clean"

BUILT_MODULE_NAME[0]="vmmon"
BUILT_MODULE_LOCATION[0]="modules"

BUILT_MODULE_NAME[1]="vmnet"
BUILT_MODULE_LOCATION[1]="modules"

BUILT_MODULE_NAME[2]="vmblock"
BUILT_MODULE_LOCATION[2]="modules"

BUILT_MODULE_NAME[3]="vmci"
BUILT_MODULE_LOCATION[3]="modules"

BUILT_MODULE_NAME[4]="vsock"
BUILT_MODULE_LOCATION[4]="modules"

DEST_MODULE_LOCATION[0]="/extra/vmware"
DEST_MODULE_LOCATION[1]="/extra/vmware"
DEST_MODULE_LOCATION[2]="/extra/vmware"
DEST_MODULE_LOCATION[3]="/extra/vmware"
DEST_MODULE_LOCATION[4]="/extra/vmware"

AUTOINSTALL="yes"
EOF

Creates the Makefile:

# cat << EOF > /usr/src/vmware-modules-9/Makefile
KERNEL := $(KERNELRELEASE)
HEADERS := /usr/src/linux-$(KERNEL)/include
GCC := $(shell vmware-modconfig --console --get-gcc)
DEST := /lib/modules/$(KERNEL)/vmware

TARGETS := vmmon vmnet vmblock vmci vsock

LOCAL_MODULES := $(addsuffix .ko, $(TARGETS))

all: $(LOCAL_MODULES)
        mkdir -p modules/
        mv *.ko modules/
        rm -rf $(DEST)
        depmod

%.ko:
        vmware-modconfig --console --build-mod -k $(KERNEL) $* $(GCC) $(HEADERS) vmware/
        cp -f $(DEST)/$*.ko .

clean:
        rm -rf modules/
EOF

Now that configuration files are created we just have to tell DKMS we want to register this new module, build and install it. With the AUTOINSTALL parameter defined in the configuration file, DKMS will know that he has to recompile/reinstall automatically each time the kernel changed.

# dkms -m vmware-modules -v 9 -k `uname -r` add

Creating symlink /var/lib/dkms/vmware-modules/9/source ->
                 /usr/src/vmware-modules-9

DKMS: add completed.
# dkms -m vmware-modules -v 9 -k `uname -r` build

Building module:
cleaning build area....
make KERNELRELEASE=3.5.4-1-ARCH all........
cleaning build area.... 

DKMS: build completed.
# dkms -m vmware-modules -v 9 -k `uname -r` install

vmmon:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /usr/lib/modules/3.5.4-1-ARCH/extra/vmware/
[...]
depmod.....

DKMS: install completed.

At this point, if everything went fine, DKMS is ready and your modules will be automagically recompiled next time.

Troubleshooting

Could not open /dev/vmmon: No such file or directory.

The full error is:

Could not open /dev/vmmon: No such file or directory.
Please make sure that the kernel module `vmmon' is loaded.

This means that at least the vmmon VMware service is not running. All VMware services can be started with:

# rc.d start vmware

On systemd only systems (rc.d is owned by initscripts) you need to create a separate .service file:

/etc/systemd/system/vmware.service
[Unit]
Description=VMware daemon
[Service]
ExecStart=/etc/rc.d/vmware start
ExecStop=/etc/rc.d/vmware stop
PIDFile=/var/lock/subsys/vmware
TimeoutSec=0
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

then start the service with:

# systemctl start vmware.service

Kernel headers for version 3.x-xxxx were not found. If you installed them[...]

Install them with:

# pacman -S linux-headers
Note: Upgrading the kernel and the headers will require you to boot to the new kernel to match the version of the headers. This is a relatively common error.

USB devices not recognized

For some reason, some installations are missing the vmware-USBArbitrator script. To readd it manually see this forum post.

You may also manually extract the VMware bundle and copy the vmware-USBArbitrator script from <destination folder>/vmware-usbarbitrator/etc/init.d/ to /etc/rc.d/ (which seems to be its default installation folder instead of /etc/init.d/):

$ ./VMware-<edition>-<version>.<release>.<architecture>.bundle --console --extract /tmp/vmware-bundle
# cp /tmp/vmware-bundle/vmware-usbarbitrator/etc/init.d/vmware-USBArbitrator /etc/rc.d/

This could also mean that the vmware-usbarbitrator binary called in the script is segfaulting:

# vmware-usbarbitrator --info -f
VTHREAD initialize main thread 2 "usbArb" pid 6426
Segmentation fault

This is caused by an empty /etc/arch-release (owned by filesystem). It is used by the service to alter its behavior based on the distribution's release version.

To fix it, add a version string in the form of <year>.<month>(.<day>) (e.g. 2012.09.07).

process XXXX: Attempt to remove filter function[...]

The full error is, for example:

process 6094: Attempt to remove filter function 0xadcc96f0 user data 0xb795aba0, but no such filter has been added
  D-Bus not built with -rdynamic so unable to print a backtrace
Aborted

This means that the hal daemon is not running. Install halAUR from the AUR and start the daemon with:

# hald

The installer fails to start

If you just get back to the prompt when opening the .bundle, then you probably have a deprecated or broken version of the VMware installer and you should remove it (you may also refer to the uninstallation section of this article):

# rm -r /etc/vmware-installer

Incorrect login/password when trying to access VMware remotely

VMware Workstation 9 provides the possibility to remotely manage Shared VMs through the vmware-workstation-server service. However, this will fail with the error "incorrect username/password" due to incorrect PAM configuration of the vmware-authd service. To fix it, edit /etc/pam.d/vmware-authd like this:

/etc/pam.d/vmware-authd
#%PAM-1.0
auth     required       pam_unix.so
account  required       pam_unix.so
password required       pam_permit.so
session  required       pam_unix.so

and restart VMware services with:

# rc.d restart vmware vmware-workstation-server

Now you can connect to the server with the credentials provided during the installation.

Note: libxslt may be required for starting virtual machines.

Issues with ALSA output

The following instructions from Bankim Bhavsar's wiki show how to manually adjust the ALSA output device in a VMware .vmx file. This might help with quality issues or with enabling proper HD audio output:

  1. Suspend/Power off the VM.
  2. Run aplay -L
  3. If you are interested in playing 5.1 surround sound from the guest, look for surround51:CARD=vendor-name,DEV=num. If you are experiencing quality issues, look out for a line starting with front.
  4. Open the <Virtual machine name>.vmx config file of the VM in a text editor, located under ~/vmware/<Virtual machine name>/, and edit the sound.fileName field, e.g.: sound.fileName="surround51:CARD=Live,DEV=0". Ensure that it also reads sound.autodetect="FALSE".
  5. Resume/Power on the VM.

Uninstallation

To uninstall VMware you need the product name (either vmware-workstation or vmware-player). To list all the installed products:

# vmware-installer -l

and uninstall with:

# vmware-installer -u <vmware-product>

Manually included symlinks have to be removed manually in /etc/rc.d/ and /sbin/:

# rm /etc/rc.d/vmware /etc/rc.d/vmware-workstation-server /sbin/insmod /sbin/lsmod /sbin/modinfo /sbin/rmmod

Remember to also remove vmware from the /etc/rc.conf DAEMONS array.