Difference between revisions of "VMware (简体中文)"

From ArchWiki
Jump to navigation Jump to search
(rm temporary i18n template)
Line 15: Line 15:
  
 
== 安装 ==
 
== 安装 ==
===VMware Workstation/Player===
 
  
 
{{注意| VMware Workstation/Player '''不会''' 被 pacman 管理,因为这些文件不是用它安装的。}}
 
{{注意| VMware Workstation/Player '''不会''' 被 pacman 管理,因为这些文件不是用它安装的。}}
  
想要在 Linux 中安装 Workstation 或者 Player 使用一个 bundle:
+
'''1.''' Download the latest  [http://www.vmware.com/products/workstation/overview.html VMware Workstation] or [http://www.vmware.com/products/player/overview.html VMware Player] (you may also try the [http://communities.vmware.com/community/vmtn/beta testing (Beta/RC) versions]).
 
 
'''1.''' Download [http://downloads.vmware.com/d/info/desktop_downloads/vmware_workstation/8_0 VMware Workstation] (you may also try the [http://communities.vmware.com/community/beta/ws testing (Beta/RC) versions]).
 
  
 
'''2.''' Start the installation ({{Ic|--console}} uses terminal instead of the GUI):
 
'''2.''' Start the installation ({{Ic|--console}} uses terminal instead of the GUI):
  # chmod +x VMware-<edition>-<version>.<release>.<architecture>.bundle
+
  $ chmod +x VMware-<edition>-<version>.<release>.<architecture>.bundle
 
  # ./VMware-<edition>-<version>.<release>.<architecture>.bundle --console
 
  # ./VMware-<edition>-<version>.<release>.<architecture>.bundle --console
  
'''3.''' Read & accept the EULA to continue.
+
'''3.''' 阅读并接受最终用户许可协议。
 +
 
 +
'''4.''' Set {{Ic|System service scripts directory}} to {{ic|/etc/init.d}}.
 +
 
 +
'''5.''' (Optional) If Eclipse is installed, enter the directory path to the Integrated Virtual Debugger.
  
'''4.''' Set {{Ic|System service scripts}} to:
+
'''6.''' You will now get an error about the {{ic|"rc*.d style init script directories"}} not being set. This can, however, be safely ignored.
/etc/rc.d
 
  
'''5.''' (Optional) Enter the directory path to the Integrated Virtual Debugger for Eclipse, if it is installed.
+
==配置==
  
'''6.''' You will now get an error about the "rc*.d style init script" not being set. This can, however, be safely ignored.
+
{{Tip|There is also a package called {{AUR|vmware-patch}} in the [[Arch User Repository|AUR]] with the intention of trying to automate this section (it also supports older VMware versions).}}
  
'''7.''' Create links for the daemons:
+
{{Note|Ensure you have installed the correct headers required for building the modules ({{pkg|linux}} from {{ic|[core]}} uses {{pkg|linux-headers}}).}}
# ln -s /etc/init.d/vmware /etc/rc.d/vmware
 
# ln -s /etc/init.d/vmware-workstation-server /etc/rc.d/vmware-workstation-server
 
  
===VMware Server===
+
=== Module tool paths ===
 +
'''7.''' The {{ic|module tool paths}} of certain Workstation scripts now need to be pointed to {{ic|/usr/bin/}} instead of {{ic|/sbin/}}. These include the service script in {{ic|/etc/init.d/}} and some other ones in {{ic|/usr/bin/}}.
  
{{注意|VMware 在2011-06-30结束了对 VMware Server 的支持。}}
+
==== 1) A short-term solution ====
 +
A short-term solution consists of editing the files directly. You will need to redo this upon every update.
  
'''1.''' Install {{AUR|vmware-server}} from the [[Arch User Repository|AUR]].
+
* For Workstation:
 +
# 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
  
'''2.''' Install {{AUR|vmware-server-console}} or {{AUR|bin32-vmware-server-console}}, if on a 64-bit Arch.
+
* For Player:
 +
# perl -p -i -e 's|/sbin/(?!modprobe)|/usr/bin/|g' /etc/init.d/vmware /usr/bin/vm-support /usr/bin/vmplayer
  
'''3.''' Download the image from the [https://www.vmware.com/products/server/overview.html VMware website].
+
==== 2) A long-term solution ====
 +
You could also just create symlinks with:
 +
# ln -s /usr/bin/insmod /usr/bin/lsmod /usr/bin/modinfo /usr/bin/rmmod /sbin/
  
'''4.''' Copy the image to the build directory.
+
=== VMware 模块补丁及安装 ===
 +
VMware Workstation 9 and Player 5 both support kernels up to 3.9.
 +
{{Note|This section is currently useful only for VMware Workstation and Player lower than 9.0.2 and 5.0.2, respectively.}}
 +
{{Note|Due to different VMware versions, you may need to set the {{ic|vmreqver}} or {{ic|plreqver}} variable for VMware Workstation or Player respectively in the {{ic|patch-modules_3.X.0.sh}} script.}}
  
'''5.''' Finish building.
+
The following patches will also install the modules afterwards by executing {{ic|# vmware-modconfig --console --install-all}}.
  
==配置==
+
==== 3.7 kernels and up ====
 +
With the arrival of 3.7 the directory structure of the uapi sources (and thus the headers) has [http://lkml.org/lkml/2012/10/14/281 changed]. The missing kernel header {{ic|version.h}} can be [http://rglinuxtech.com/?p=562 symlinked] with:
 +
# ln -s /usr/src/linux-'''$(uname -r)'''/include/generated/uapi/linux/version.h /usr/src/linux-'''$(uname -r)'''/include/linux/
 +
You can replace "'''{{ic|$(uname -r)}}'''" with any kernel not currently running.
 +
{{Note|You will need to redo this upon every kernel update.}}
  
===VMware 补丁===
+
==== 3.8 / 3.9 kernels ====
{{注意|VMware Workstation 8 和 VMware Player 4 只需要对 3.1 内核或以上版本打补丁。}}
+
In addition to the header symlink outlined above 3.8/3.9 kernels also need [http://communities.vmware.com/thread/432897 this] (packaged together with the script in [https://github.com/willysr/SlackHacks/tree/master/vmware/vmware-3.8 here]):
{{小贴士|在 AUR 中有一个包 {{AUR|vmware-patch}} 可以自动化打补丁的过程。}}
 
  
====3.2/3.3 内核====
 
The patch for 3.2 kernels is available [http://weltall.heliohost.org/wordpress/2011/11/09/vmware-workstation-8-x-player-4-x-virtualbox-fix-for-linux-3-2/ here]:
 
 
  $ cd /tmp
 
  $ cd /tmp
  $ curl -O http://weltall.heliohost.org/wordpress/wp-content/uploads/2011/11/vmware8linux32fix.tar.gz
+
  $ curl -O https://raw.github.com/willysr/SlackHacks/master/vmware/vmware-3.8/vmware9.0.1_kernel3.8.zip
  $ tar -xvzf vmware8linux32fix.tar.gz
+
  $ bsdtar -xvf vmware9.0.1_kernel3.8.zip
  # ./patch-modules_3.1.0.sh
+
  # ./patch-modules_3.8.0.sh
 +
 
 +
==== 3.5 / 3.6 / 3.7 kernels ====
 +
A change in the format of the kernel exception table introduced back in [http://repo.or.cz/w/linux-2.6.git/commit/706276543b699d80f546e45f8b12574e7b18d952 April] affecting the {{ic|vmmon}} module is known to cause crashes in [http://communities.vmware.com/thread/400616 Fedora guests]. The patch [http://communities.vmware.com/message/2092356#2092356 here] creates a portable exception table (packaged together with the script [http://communities.vmware.com/message/2103172#2103172 in here], which will also reload the {{ic|vmmon}} module):
  
====3.1 内核====
 
With VMware Workstation 8 or VMware Player 4 you can use [http://weltall.heliohost.org/wordpress/2011/09/29/vmware-workstationplayer-fix-for-linux-3-1/ this] script:
 
 
  $ cd /tmp
 
  $ cd /tmp
  $ curl -O http://weltall.heliohost.org/wordpress/wp-content/uploads/2011/09/vmware8linux31fix.tar.gz
+
  $ curl -O http://communities.vmware.com/servlet/JiveServlet/download/2103172-94260/vmware9_kernel35_patch.tar.bz2
  $ tar -xvzf vmware8linux31fix.tar.gz
+
  $ tar -xvf --strip-components=1 vmware9_kernel35_patch.tar.bz2  # The "--strip-components=1" flag extracts the files only
  # ./patch-modules_3.1.0.sh
+
  # ./patch-modules_3.5.0.sh
 +
 
 +
=== Systemd service ===
 +
'''8.''' (Optional) Instead of using {{ic|<nowiki># /etc/init.d/vmware {start|stop|status|restart}</nowiki>}} directly to manage the services you may also create a {{ic|.service}} file (or [http://communities.vmware.com/docs/DOC-20855 files]):
  
With older VMware versions you need to use [http://weltall.heliohost.org/wordpress/2011/08/10/vmware-workstation-7-1-4-fix-for-linux-3-1/ this] one instead:
+
{{hc|/etc/systemd/system/vmware.service|
$ cd /tmp
+
2=[Unit]
$ curl -O http://weltall.heliohost.org/wordpress/wp-content/uploads/2011/08/fullvmwarelinux310patch.tar.gz
+
Description=VMware daemon
$ tar -xvzf fullvmwarelinux310patch.tar.gz
+
 
# ./patch-modules_2.6.39.sh
+
[Service]
 +
ExecStart=/etc/init.d/vmware start
 +
ExecStop=/etc/init.d/vmware stop
 +
PIDFile=/var/lock/subsys/vmware
 +
TimeoutSec=0
 +
RemainAfterExit=yes
  
===VMware 模块===
+
[Install]
 +
WantedBy=multi-user.target
 +
}}
  
'''8.''' At this point you would want to install the modules. First you need to either change the {{Ic|lsmod binary path}} in {{ic|/etc/rc.d/vmware}} from {{ic|/sbin/lsmod}} to {{ic|/bin/lsmod}}:
+
To start the {{ic|.service}} on boot:
 +
# systemctl enable vmware
  
# sed -i "s|/sbin/lsmod|/bin/lsmod|g" /etc/rc.d/vmware
+
== Launching the application ==
  
or create a symlink with:
+
'''9.''' Now, open your VMware Workstation ({{Ic|vmware}} in the console) or VMware Player ({{Ic|vmplayer}} in the console) to configure & use!
# ln -s /bin/lsmod /sbin/lsmod
 
  
'''9.''' Now you can install the modules. You can do this by either launching VMware and letting it install the modules with the GUI or executing:
+
{{Tip|To (re)build the modules, use:
 
  # vmware-modconfig --console --install-all
 
  # vmware-modconfig --console --install-all
 +
}}
  
'''10.''' (Optional) Add {{Ic|vmware}} to the DAEMONS array in {{ic|/etc/[[rc.conf]]}} so that the service is started automatically on boot.
+
== Tips & Tricks ==
  
'''11.''' Now, open your VMware Workstation ({{Ic|vmware}} in the console) or VMware Player ({{Ic|vmplayer}} in the console) to configure & use!
+
=== Entering the Workstation License Key from terminal ===
 +
# /usr/lib/vmware/bin/vmware-vmx-debug --new-sn XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
  
{{警告|当升级内核时你'''需要'''使用下面命令重新编译 VMware 模块:
+
Where {{ic|XXXXX-XXXXX-XXXXX-XXXXX-XXXXX}} is your license key.
# vmware-modconfig --console --install-all
 
不这样做导致启动虚拟机是系统崩溃。}}
 
  
==提示与技巧==
+
=== 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
  
===提取 VMware BIOS===
+
==== Using the modified BIOS ====
To extract the VMware BIOS, which can be manipulated and later used with your virtual machines:
+
If and when you decide to modify the extracted BIOS you can make your virtual machine use it by moving it to {{ic|~/vmware/<Virtual machine name>}}:
objcopy /usr/lib/vmware/bin/vmware-vmx -O binary -j bios440 --set-section-flags bios440=a bios440.rom.Z
+
  $ mv bios440.rom ~/vmware/<Virtual machine name>/
  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
 
  
====使用修改的 BIOS====
 
If and when you decide to modify the extractd BIOS you can make your virtual machine use it by moving it to {{ic|~/vmware/<Virtual machine name>}}:
 
mv bios440.rom ~/vmware/<Virtual machine name>/
 
 
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"}}
  
== 疑难解答 ==
+
=== Copy-On-Write (CoW) ===
 +
CoW comes with some advantages, but can negatively affect performance with large files that have small random writes (e.g. database files and virtual machine images):
 +
 
 +
$ chattr +C ~/vmware/<Virtual machine name>/<Virtual machine name>.vmx
 +
 
 +
{{Note|1=From the [http://www.linuxhowtos.org/manpages/1/chattr.htm?print=-51 chattr man page]: ''"For btrfs, the {{ic|C}} flag should be set only on new or empty files. If set on a file which already has data blocks, it is undefined when the blocks assigned to the file will be fully stable. If set on a directory, only new files will be affected."''}}
 +
 
 +
=== Using DKMS to manage the modules ===
 +
The Dynamic Kernel Module Support (DKMS) can be used to manage Workstation modules and to void from re-running {{ic|vmware-modconfig}} each time the kernel changes. The following example uses a custom {{ic|Makefile}} to compile and install the modules through {{ic|vmware-modconfig}}. Afterwards they are removed from the current kernel tree.
 +
 
 +
==== Preparation ====
 +
First install {{pkg|dkms}} from the [[Community repository]]:
 +
# pacman -S dkms
 +
 
 +
then create a source directory for the {{ic|Makefile}} and the {{ic|dkms.conf}}:
 +
# mkdir /usr/src/vmware-modules-9/
 +
 
 +
==== Build configuration ====
 +
Fetch the files from Git or use the ones below.
 +
 
 +
===== 1) Using Git =====
 +
$ cd /tmp
 +
$ git clone git://github.com/djod4556/dkms-workstation.git
 +
# cp /tmp/dkms-workstation.git/Makefile /tmp/dkms-workstation.git/dkms.conf /usr/src/vmware-modules-9/
 +
 
 +
===== 2) Manual setup =====
 +
The {{ic|dkms.conf}} describes the module names and the compilation/installation procedure. {{ic|1=AUTOINSTALL="yes"}} tells the modules to be recompiled/installed automatically each time:
 +
 
 +
{{hc|/usr/src/vmware-modules-9/dkms.conf|
 +
2=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"
 +
}}
 +
 
 +
and now the {{ic|Makefile}}:
 +
 
 +
{{hc|/usr/src/vmware-modules-9/Makefile|
 +
2=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
 +
 
 +
/usr/src/linux-$(KERNEL)/include/linux/version.h:
 +
        ln -s /usr/src/linux-$(KERNEL)/include/generated/uapi/linux/version.h /usr/src/linux-$(KERNEL)/include/linux/
 +
 
 +
%.ko: /usr/src/linux-$(KERNEL)/include/linux/version.h
 +
        vmware-modconfig --console --build-mod -k $(KERNEL) $* $(GCC) $(HEADERS) vmware/
 +
        cp -f $(DEST)/$*.ko .
 +
 
 +
clean:
 +
        rm -rf modules/
 +
}}
 +
 
 +
==== Installation ====
 +
The modules can then be registered:
 +
 
 +
# dkms -m vmware-modules -v 9 -k $(uname -r) add
 +
 
 +
built:
 +
 
 +
# dkms -m vmware-modules -v 9 -k $(uname -r) build
 +
 
 +
and installed:
 +
 
 +
# dkms -m vmware-modules -v 9 -k $(uname -r) install
 +
 
 +
If everything went well, the modules will now be recompiled automatically the next time the kernel changes.
 +
 
 +
== Troubleshooting ==
  
 
=== Could not open /dev/vmmon: No such file or directory. ===
 
=== Could not open /dev/vmmon: No such file or directory. ===
Line 119: Line 239:
 
  Could not open /dev/vmmon: No such file or directory.
 
  Could not open /dev/vmmon: No such file or directory.
 
  Please make sure that the kernel module `vmmon' is loaded.
 
  Please make sure that the kernel module `vmmon' is loaded.
This means that at least the {{Ic|vmmon}} VMware service is not running. All VMware services can be started with:
+
 
  # rc.d start vmware
+
This means that at least the {{Ic|vmmon}} VMware service is not running. If using the {{ic|.service}} file from step 8. all VMware services can be started with:
 +
  # systemctl start vmware
 +
 
 +
otherwise use:
 +
# /etc/init.d/vmware start
  
 
=== Kernel headers for version 3.x-xxxx were not found. If you installed them[...] ===
 
=== Kernel headers for version 3.x-xxxx were not found. If you installed them[...] ===
Line 126: Line 250:
 
  # pacman -S linux-headers
 
  # 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.}}
If printing from the guest OS is not working there may be a permission problem with the ThinPrint [[CUPS]] filter ('''thnucups'''), which is used by VMware. First make sure your {{ic|/var/log/cups/error_log}} says something like:
+
 
  E [22/Nov/2010:14:10:11 -0800] Unable to execute /usr/lib/cups/filter/thnucups: insecure file permissions (0104755)
+
=== USB devices not recognized ===
 +
{{Tip|Also handled by {{AUR|vmware-patch}}.}}
 +
 
 +
==== 1) The {{ic|vmware-USBArbitrator}} script is missing ====
 +
For some reason, some installations are missing the {{ic|vmware-USBArbitrator}} script. To readd it manually see [https://bbs.archlinux.org/viewtopic.php?pid=1003117#p1003117 this forum post].
 +
 
 +
You may also manually extract the VMware bundle and copy the {{ic|vmware-USBArbitrator}} script from {{ic|<destination folder>/vmware-usbarbitrator/etc/init.d/}} to {{ic|/etc/init.d/}}:
 +
  $ ./VMware-<edition>-<version>.<release>.<architecture>.bundle --extract /tmp/vmware-bundle
 +
# cp /tmp/vmware-bundle/vmware-usbarbitrator/etc/init.d/vmware-USBArbitrator /etc/init.d/
 +
 
 +
==== 2) The {{ic|vmware-usbarbitrator}} binary is segfaulting ====
 +
This could also mean that the {{ic|vmware-usbarbitrator}} binary called in the script is [https://bbs.archlinux.org/viewtopic.php?pid=1156789 segfaulting]:
 +
{{hc|# vmware-usbarbitrator|
 +
Pipe unexpectedly closed.
 +
}}
 +
{{hc|# vmware-usbarbitrator --info -f|
 +
VTHREAD initialize main thread 2 "usbArb" pid 6426
 +
Segmentation fault
 +
}}
 +
 
 +
This is caused by an empty {{ic|/etc/arch-release}} (owned by {{pkg|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 {{ic|<year>.<month>(.<day>)}} (e.g. {{ic|[https://www.archlinux.org/download/ 2013.04.01]}}).
  
In which case you may try:
+
=== process XXXX: Attempt to remove filter function [...] ===
  # chmod u-sw /usr/lib/cups/filter/thnucups
+
The full error is, for example:
  # rc.d restart cupsd
+
  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 {{AUR|hal}} from the [[AUR]] and start the daemon with:
 +
  # hald
  
 
=== The installer fails to start ===
 
=== The installer fails to start ===
If you just get back to the prompt when opening the {{ic|.bundle}}, then you probably have an old version of the VMware installer and you should remove it (you may also refer to the [[#Uninstallation|uninstallation]] section of this article):
+
If you just get back to the prompt when opening the {{ic|.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|uninstallation]] section of this article):
 
  # rm -r /etc/vmware-installer
 
  # rm -r /etc/vmware-installer
  
=== USB devices not recognized by VMware workstation 8 ===
+
=== Incorrect login/password when trying to access VMware remotely ===
For some reason, some installations are missing vmware-USBArbitrator script. Adding the script back manually can solve the problem. See [https://bbs.archlinux.org/viewtopic.php?id=127145 this forum post] for more information
+
VMware Workstation 9 provides the possibility to remotely manage Shared VMs through the {{ic|vmware-workstation-server}} service. However, this will fail with the error {{ic|"incorrect username/password"}} due to incorrect PAM configuration of the {{ic|vmware-authd}} service. To fix it, edit {{ic|/etc/pam.d/vmware-authd}} like this:
  
==卸载==
+
{{hc|/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:
 +
# systemctl restart vmware
  
 +
Now you can connect to the server with the credentials provided during the installation.
 +
 +
{{Note|{{Pkg|libxslt}} may be required for starting virtual machines.}}
 +
 +
=== Issues with ALSA output ===
 +
The following instructions from [http://bankimbhavsar.blogspot.co.nz/2011/09/hd-audio-in-vmware-fusion-4-and-vmware.html Bankim Bhavsar's wiki] show how to manually adjust the [[ALSA]] output device in a VMware {{ic|.vmx}} file. This might help with quality issues or with enabling proper HD audio output:
 +
 +
# Suspend/Power off the VM.
 +
# Run {{ic|aplay -L}}
 +
# If you are interested in playing 5.1 surround sound from the guest, look for {{ic|1=surround51:CARD=vendor-name,DEV=num}}. If you are experiencing quality issues, look out for a line starting with front.
 +
# Open the {{ic|<Virtual machine name>.vmx}} config file of the VM in a text editor, located under {{ic|~/vmware/<Virtual machine name>/}}, and edit the {{ic|sound.fileName}} field, e.g.: {{ic|1=sound.fileName="surround51:CARD=Live,DEV=0"}}. Ensure that it also reads {{ic|1=sound.autodetect="FALSE"}}.
 +
# Resume/Power on the VM.
 +
 +
== Uninstallation ==
 +
 +
To uninstall VMware you need the product name (either {{ic|vmware-workstation}} or {{ic|vmware-player}}). To list all the installed products:
 
  # vmware-installer -l
 
  # vmware-installer -l
  
然后用下面的命令卸载:
+
and uninstall with:
 +
# vmware-installer -u <vmware-product>
  
  # vmware-installer -u <vmware-product>
+
Manually included symlinks have to be removed manually in {{ic|/sbin/}}:
 +
  # rm /sbin/insmod /sbin/lsmod /sbin/modinfo /sbin/rmmod
  
{{ic|/etc/rc.d}} 中手动加入的符号链接 需要手动删除:
+
Remember to also remove the {{ic|.service}} file:
 +
# systemctl disable vmware
 +
# rm /etc/systemd/system/vmware.service
  
# unlink /etc/rc.d/vmware
+
You may also want to have a look at the kernel directories in {{ic|/usr}} for any leftovers. The now unnecessary [[#3.7 kernels and up]] patching step leaves header directories in {{ic|/usr/src/}} (full path: {{ic|/usr/src/linux-''[kernel name]''/include/linux/version.h}}).
# unlink /etc/rc.d/vmware-workstation-server
 
  
记得在{{ic|/etc/rc.conf}} {{Ic|DAEMONS}} 列表中同时删除 {{Ic|vmware}}.
+
The module directories are located in {{ic|/usr/lib/modules/''[kernel name]''/misc/}}.

Revision as of 13:04, 23 May 2013

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

Tango-preferences-desktop-locale.png本页面需要更新翻译,内容可能已经与英文脱节。要贡献翻译,请访问简体中文翻译组Tango-preferences-desktop-locale.png

附注: please use the first argument of the template to provide more detailed indications.

本文关于在 Arch 中安装 VMware,你也许想寻找的是 在 VMware 中安装 Arch Linux.

安装

注意: VMware Workstation/Player 不会 被 pacman 管理,因为这些文件不是用它安装的。

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. 阅读并接受最终用户许可协议。

4. Set System service scripts directory to /etc/init.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.

配置

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).
Note: Ensure you have installed the correct headers required for building the modules (linux from [core] uses linux-headers).

Module tool paths

7. 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/.

1) A short-term solution

A short-term solution consists of editing the files directly. You will need to redo this upon every update.

  • For Workstation:
# 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
  • For Player:
# perl -p -i -e 's|/sbin/(?!modprobe)|/usr/bin/|g' /etc/init.d/vmware /usr/bin/vm-support /usr/bin/vmplayer

2) A long-term solution

You could also just create symlinks with:

# ln -s /usr/bin/insmod /usr/bin/lsmod /usr/bin/modinfo /usr/bin/rmmod /sbin/

VMware 模块补丁及安装

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

Note: This section is currently useful only for VMware Workstation and Player lower than 9.0.2 and 5.0.2, respectively.
Note: Due to different VMware versions, you may need to set the vmreqver or plreqver variable for VMware Workstation or Player respectively in the patch-modules_3.X.0.sh script.

The following patches will also install the modules afterwards by executing # vmware-modconfig --console --install-all.

3.7 kernels and up

With the arrival of 3.7 the directory structure of the uapi sources (and thus the headers) has changed. The missing kernel header version.h can be symlinked with:

# ln -s /usr/src/linux-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-$(uname -r)/include/linux/

You can replace "$(uname -r)" with any kernel not currently running.

Note: You will need to redo this upon every kernel update.

3.8 / 3.9 kernels

In addition to the header symlink outlined above 3.8/3.9 kernels also need this (packaged together with the script in here):

$ cd /tmp
$ curl -O https://raw.github.com/willysr/SlackHacks/master/vmware/vmware-3.8/vmware9.0.1_kernel3.8.zip
$ bsdtar -xvf vmware9.0.1_kernel3.8.zip
# ./patch-modules_3.8.0.sh

3.5 / 3.6 / 3.7 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, which 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 -xvf --strip-components=1 vmware9_kernel35_patch.tar.bz2  # The "--strip-components=1" flag extracts the files only
# ./patch-modules_3.5.0.sh

Systemd service

8. (Optional) Instead of using # /etc/init.d/vmware {start|stop|status|restart} directly to manage the services you may also create a .service file (or files):

/etc/systemd/system/vmware.service
[Unit]
Description=VMware daemon

[Service]
ExecStart=/etc/init.d/vmware start
ExecStop=/etc/init.d/vmware stop
PIDFile=/var/lock/subsys/vmware
TimeoutSec=0
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

To start the .service on boot:

# systemctl enable vmware

Launching the application

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

Tip: To (re)build the modules, use:
# vmware-modconfig --console --install-all

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"

Copy-On-Write (CoW)

CoW comes with some advantages, but can negatively affect performance with large files that have small random writes (e.g. database files and virtual machine images):

$ chattr +C ~/vmware/<Virtual machine name>/<Virtual machine name>.vmx
Note: From the chattr man page: "For btrfs, the C flag should be set only on new or empty files. If set on a file which already has data blocks, it is undefined when the blocks assigned to the file will be fully stable. If set on a directory, only new files will be affected."

Using DKMS to manage the modules

The Dynamic Kernel Module Support (DKMS) can be used to manage Workstation modules and to void from re-running vmware-modconfig each time the kernel changes. The following example uses a custom Makefile to compile and install the modules through vmware-modconfig. Afterwards they are removed from the current kernel tree.

Preparation

First install dkms from the Community repository:

# pacman -S dkms

then create a source directory for the Makefile and the dkms.conf:

# mkdir /usr/src/vmware-modules-9/

Build configuration

Fetch the files from Git or use the ones below.

1) Using Git
$ cd /tmp
$ git clone git://github.com/djod4556/dkms-workstation.git
# cp /tmp/dkms-workstation.git/Makefile /tmp/dkms-workstation.git/dkms.conf /usr/src/vmware-modules-9/
2) Manual setup

The dkms.conf describes the module names and the compilation/installation procedure. AUTOINSTALL="yes" tells the modules to be recompiled/installed automatically each time:

/usr/src/vmware-modules-9/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"

and now the Makefile:

/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

/usr/src/linux-$(KERNEL)/include/linux/version.h:
        ln -s /usr/src/linux-$(KERNEL)/include/generated/uapi/linux/version.h /usr/src/linux-$(KERNEL)/include/linux/

%.ko: /usr/src/linux-$(KERNEL)/include/linux/version.h
        vmware-modconfig --console --build-mod -k $(KERNEL) $* $(GCC) $(HEADERS) vmware/
        cp -f $(DEST)/$*.ko .

clean:
        rm -rf modules/

Installation

The modules can then be registered:

# dkms -m vmware-modules -v 9 -k $(uname -r) add

built:

# dkms -m vmware-modules -v 9 -k $(uname -r) build

and installed:

# dkms -m vmware-modules -v 9 -k $(uname -r) install

If everything went well, the modules will now be recompiled automatically the next time the kernel changes.

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. If using the .service file from step 8. all VMware services can be started with:

# systemctl start vmware

otherwise use:

# /etc/init.d/vmware start

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

Tip: Also handled by vmware-patchAUR.

1) The vmware-USBArbitrator script is missing

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/init.d/:

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

2) The vmware-usbarbitrator binary is segfaulting

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

# vmware-usbarbitrator
Pipe unexpectedly closed.	
# 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. 2013.04.01).

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:

# systemctl restart vmware

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 /sbin/:

# rm /sbin/insmod /sbin/lsmod /sbin/modinfo /sbin/rmmod

Remember to also remove the .service file:

# systemctl disable vmware
# rm /etc/systemd/system/vmware.service

You may also want to have a look at the kernel directories in /usr for any leftovers. The now unnecessary #3.7 kernels and up patching step leaves header directories in /usr/src/ (full path: /usr/src/linux-[kernel name]/include/linux/version.h).

The module directories are located in /usr/lib/modules/[kernel name]/misc/.