Arch Linux下VMware-Tools安装笔记

时间:2022-11-20 10:00:31
一直兴起用VMware装了一个ArchLinux,为了方便使用想顺便装一下vmware-tools。原以为是./run一下的事,结果折腾了2个多小时把自己给折腾醉了。

以下内容基于安装在VMware的Arch Linux,Arch Linux版本: archlinux-2014.07.03-dual

首先在装载CD-ROM的时候就遇到了第一个问题,vmware-tools的iso文件是装进去了,可是在哪儿呀。

虽说ArchLinux装上Xfce4是有File System的,可是可以发现并没有和Ubutun等其它的Linux系统一样把CD-ROM也挂在File System里。

查找资料之后,知道这里需要自己挂载CD-ROM。由于在安装的时候就是手动挂载各个分区,这个问题就这样解决了。
shell code:
sudo mkdir /mnt/cdrom
sudo mount /dev/cdrom /mnt/cdrom
cd /mnt/cdrom



运行完mount代码之后会提示
mount:/dev/sr0 is write-protected, mounting read-only
似乎只是提示挂载的内容是read-only,不影响使用。

这样就可以直达vmware-tools的iso中,然后将vmware-tools的tar压缩文件复制到任一目录下解压缩,并运行其中的vmware-install.pl就可以开始安装了。
shell code:
复制到目录VMware下:
mkdir ~/VMware
sudo cp VMwareTools-9.6.2-1688356.tar.gz ~/VMware/

cd到VMware解压缩文件:
cd ~/VMware/
tar xvf VMwareTools-9.6.2-1688356.tar.gz


cd到目录中运行安装:
cd vmware-tools-distrib/
sudo ./vmware-install.pl


安装过程中一路点回车就行了,马上就会遇到第二个问题。

What is the directory that contains the init directories (rc0.d/ to rc6.d/)
意即要把初始化目录 rc0.d~rc6.d放在哪个目录下,那我们就创建一个文件夹来保存。这里我保存在/etc/vmware-tools

然后继续一路回车,之后我遇到的第三个问题是没有ifconfig,如果之前有装过net-tools就不会遇到这个问题。运行
sudo pacman -Sy net-tools

可以解决

继续回车,遇到的第四个问题,也是最大的问题。提示输出the kernel headers所在的目录
enter the path to the kernel headers

查找资料有说在/usr/src/$(uname -r)的,也有说在/lib/modules/$(uname -r)

于是我cd到各个目录下查个究竟。可能由于版本不一样吧,我的/usr/src/下面什么都没有,但在/lib/modules/下面虽然有想要的文件却没有需要的headers文件。

又折腾了半天,发现原来是需要安装linux-headers文件。于是运行
sudo pacman -S linux-headers


完成后再次cd到/lib/modules/$(uname -r)/build/include/下面发现多了许多源文件

/lib/modules/3.16.1-1-ARCH/build/include/
这是我使用的路径。

然后一路回车就可以一直到完成了。要完成后面的内容需要有gcc和make.

安装完重启后鼠标可以任意在虚拟机和物理机中转换了,只是不太灵活。也可以实在文件共享和剪切板共享。

至此,VMware-tools算是安装完成。让我比较在意的是鼠标的切换实在是跳得让人发指,以及在编译的过程中出现了许多错误。不过由于一开始就没想到会在一个vmware-tools上折腾这么多时间,并且不是非解决不可的问题,也就先不深究了,也许这是Arch Linux无法避免的问题。以后有机会再深究。

以下是安装日志。
[wu@wu-arch vmware-tools-distrib]$ sudo ./vmware-install.pl 
Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools.

In which directory do you want to install the binary files? 
[/usr/bin] 

What is the directory that contains the init directories (rc0.d/ to 
rc6.d/)? 

The path "" is not an existing directory.

What is the directory that contains the init directories (rc0.d/ to 
rc6.d/)? vmware-tools

The path "vmware-tools" is not an existing directory.

What is the directory that contains the init directories (rc0.d/ to 
rc6.d/)? /etc/vmware-tools

What is the directory that contains the init scripts? 
[/etc/vmware-tools/init.d] 

In which directory do you want to install the daemon files? 
[/usr/sbin] 

In which directory do you want to install the library files? 
[/usr/lib/vmware-tools] 

The path "/usr/lib/vmware-tools" does not exist currently. This program is 
going to create it, including needed parent directories. Is this what you want?
[yes] 

In which directory do you want to install the documentation files? 
[/usr/share/doc/vmware-tools] 

The path "/usr/share/doc/vmware-tools" does not exist currently. This program 
is going to create it, including needed parent directories. Is this what you 
want? [yes] 

The installation of VMware Tools 9.6.2 build-1688356 for Linux completed 
successfully. You can decide to remove this software from your system at any 
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by 
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want 
this program to invoke the command for you now? [yes] 

Initializing...


Making sure services for VMware Tools are stopped.

Stopping Thinprint services in the virtual machine:
   Stopping Virtual Printing daemon:                                   done
Stopping VMware Tools services in the virtual machine:
   Guest operating system daemon:                                      done
   Unmounting HGFS shares:                                             done
   Guest filesystem driver:                                            done


sh: : command not found
sh: : command not found

Before you can compile modules, you need to have the following installed... 

make
gcc
kernel headers of the running kernel


Searching for GCC...
Detected GCC binary at "/bin/gcc".
The path "/bin/gcc" appears to be a valid path to the gcc binary.
Would you like to change it? [no] 

Searching for a valid kernel header path...
Detected the kernel headers at "/lib/modules/3.16.1-1-ARCH/build/include".
The path "/lib/modules/3.16.1-1-ARCH/build/include" appears to be a valid path 
to the 3.16.1-1-ARCH kernel headers.
Would you like to change it? [no] 

make: Entering directory '/tmp/modconfig-BgaWo9/vmci-only'
Using 2.6.x kernel build system.
/bin/make -C /lib/modules/3.16.1-1-ARCH/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= modules
make[1]: Entering directory '/usr/lib/modules/3.16.1-1-ARCH/build'
  CC [M]  /tmp/modconfig-BgaWo9/vmci-only/linux/driver.o
  CC [M]  /tmp/modconfig-BgaWo9/vmci-only/linux/vmciKernelIf.o
In file included from /tmp/modconfig-BgaWo9/vmci-only/linux/vmciKernelIf.c:57:0:
/tmp/modconfig-BgaWo9/vmci-only/./shared/vm_assert.h:259:0: warning: "DEPRECATED" redefined
    #define DEPRECATED(_fix) do {} while (0)
 ^
In file included from /tmp/modconfig-BgaWo9/vmci-only/./shared/vmware.h:39:0,
                 from /tmp/modconfig-BgaWo9/vmci-only/linux/driver.c:62:
/tmp/modconfig-BgaWo9/vmci-only/./shared/vm_assert.h:259:0: warning: "DEPRECATED" redefined
    #define DEPRECATED(_fix) do {} while (0)
 ^
In file included from include/linux/kernel.h:13:0,
                 from ./arch/x86/include/asm/percpu.h:44,
                 from ./arch/x86/include/asm/current.h:5,
                 from ./arch/x86/include/asm/processor.h:15,
                 from ./arch/x86/include/asm/atomic.h:6,
                 from /tmp/modconfig-BgaWo9/vmci-only/linux/driver.c:24:
include/linux/printk.h:103:0: note: this is the location of the previous definition
 #define DEPRECATED "[Deprecated]: "
 ^
In file included from include/linux/kernel.h:13:0,
                 from ./arch/x86/include/asm/percpu.h:44,
                 from ./arch/x86/include/asm/preempt.h:5,
                 from include/linux/preempt.h:18,
                 from include/linux/spinlock.h:50,
                 from include/linux/mmzone.h:7,
                 from include/linux/gfp.h:5,
                 from include/linux/mm.h:9,
                 from /tmp/modconfig-BgaWo9/vmci-only/linux/vmciKernelIf.c:38:
include/linux/printk.h:103:0: note: this is the location of the previous definition
 #define DEPRECATED "[Deprecated]: "
 ^
/tmp/modconfig-BgaWo9/vmci-only/linux/driver.c: In function ‘LinuxDriver_Ioctl’:
/tmp/modconfig-BgaWo9/vmci-only/linux/driver.c:740:12: error: incompatible types when assigning to type ‘VMCIHostUser’ from type ‘kuid_t’
       user = current_uid();
            ^
scripts/Makefile.build:257: recipe for target '/tmp/modconfig-BgaWo9/vmci-only/linux/driver.o' failed
make[2]: *** [/tmp/modconfig-BgaWo9/vmci-only/linux/driver.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Makefile:1333: recipe for target '_module_/tmp/modconfig-BgaWo9/vmci-only' failed
make[1]: *** [_module_/tmp/modconfig-BgaWo9/vmci-only] Error 2
make[1]: Leaving directory '/usr/lib/modules/3.16.1-1-ARCH/build'
Makefile:130: recipe for target 'vmci.ko' failed
make: *** [vmci.ko] Error 2
make: Leaving directory '/tmp/modconfig-BgaWo9/vmci-only'

The communication service is used in addition to the standard communication 
between the guest and the host.  The rest of the software provided by VMware 
Tools is designed to work independently of this feature.
If you wish to have the VMCI feature, you can install the driver by running 
vmware-config-tools.pl again after making sure that gcc, binutils, make and the
kernel sources for your running kernel are installed on your machine. These 
packages are available on your distribution's installation CD.
[ Press Enter key to continue ] 

make: Entering directory '/tmp/modconfig-z47GAB/vmci-only'
Using 2.6.x kernel build system.
/bin/make -C /lib/modules/3.16.1-1-ARCH/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= modules
make[1]: Entering directory '/usr/lib/modules/3.16.1-1-ARCH/build'
  CC [M]  /tmp/modconfig-z47GAB/vmci-only/linux/driver.o
  CC [M]  /tmp/modconfig-z47GAB/vmci-only/linux/vmciKernelIf.o
In file included from /tmp/modconfig-z47GAB/vmci-only/linux/vmciKernelIf.c:57:0:
/tmp/modconfig-z47GAB/vmci-only/./shared/vm_assert.h:259:0: warning: "DEPRECATED" redefined
    #define DEPRECATED(_fix) do {} while (0)
 ^
In file included from include/linux/kernel.h:13:0,
                 from ./arch/x86/include/asm/percpu.h:44,
                 from ./arch/x86/include/asm/preempt.h:5,
                 from include/linux/preempt.h:18,
                 from include/linux/spinlock.h:50,
                 from include/linux/mmzone.h:7,
                 from include/linux/gfp.h:5,
                 from include/linux/mm.h:9,
                 from /tmp/modconfig-z47GAB/vmci-only/linux/vmciKernelIf.c:38:
include/linux/printk.h:103:0: note: this is the location of the previous definition
 #define DEPRECATED "[Deprecated]: "
 ^
In file included from /tmp/modconfig-z47GAB/vmci-only/./shared/vmware.h:39:0,
                 from /tmp/modconfig-z47GAB/vmci-only/linux/driver.c:62:
/tmp/modconfig-z47GAB/vmci-only/./shared/vm_assert.h:259:0: warning: "DEPRECATED" redefined
    #define DEPRECATED(_fix) do {} while (0)
 ^
In file included from include/linux/kernel.h:13:0,
                 from ./arch/x86/include/asm/percpu.h:44,
                 from ./arch/x86/include/asm/current.h:5,
                 from ./arch/x86/include/asm/processor.h:15,
                 from ./arch/x86/include/asm/atomic.h:6,
                 from /tmp/modconfig-z47GAB/vmci-only/linux/driver.c:24:
include/linux/printk.h:103:0: note: this is the location of the previous definition
 #define DEPRECATED "[Deprecated]: "
 ^
/tmp/modconfig-z47GAB/vmci-only/linux/driver.c: In function ‘LinuxDriver_Ioctl’:
/tmp/modconfig-z47GAB/vmci-only/linux/driver.c:740:12: error: incompatible types when assigning to type ‘VMCIHostUser’ from type ‘kuid_t’
       user = current_uid();
            ^
scripts/Makefile.build:257: recipe for target '/tmp/modconfig-z47GAB/vmci-only/linux/driver.o' failed
make[2]: *** [/tmp/modconfig-z47GAB/vmci-only/linux/driver.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Makefile:1333: recipe for target '_module_/tmp/modconfig-z47GAB/vmci-only' failed
make[1]: *** [_module_/tmp/modconfig-z47GAB/vmci-only] Error 2
make[1]: Leaving directory '/usr/lib/modules/3.16.1-1-ARCH/build'
Makefile:130: recipe for target 'vmci.ko' failed
make: *** [vmci.ko] Error 2
make: Leaving directory '/tmp/modconfig-z47GAB/vmci-only'

The VM communication interface socket family is used in conjunction with the VM
communication interface to provide a new communication path among guests and 
host.  The rest of this software provided by VMware Tools is designed to work 
independently of this feature.  If you wish to have the VSOCK feature  you can 
install the driver by running vmware-config-tools.pl again after making sure 
that gcc, binutils, make and the kernel sources for your running kernel are 
installed on your machine. These packages are available on your distribution's 
installation CD.
[ Press the Enter key to continue.] 

The module vmxnet3 from this package is not supported for kernels >= 3.10. 
Please enable this module in your kernel. You may also have to enable 
HYPERVISOR_GUEST.

The module pvscsi from this package is not supported for kernels >= 3.10. 
Please enable this module in your kernel. You may also have to enable 
HYPERVISOR_GUEST.

The module vmmemctl from this package is not supported for kernels >= 3.10. 
Please enable this module in your kernel. You may also have to enable 
HYPERVISOR_GUEST.

The VMware Host-Guest Filesystem allows for shared folders between the host OS 
and the guest OS in a Fusion or Workstation virtual environment.  Do you wish 
to enable this feature? [yes] 

The vmxnet driver is no longer supported on kernels 3.3 and greater. Please 
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)

The vmblock enables dragging or copying files between host and guest in a 
Fusion or Workstation virtual environment.  Do you wish to enable this feature?
[yes] 

NOTICE:  It appears your system does not have the required fuse packages 
installed.  The VMware blocking filesystem requires the fuse packages and its 
libraries to function properly.  Please install the fuse or fuse-utils package 
using your systems package management utility and re-run this script in order 
to enable the VMware blocking filesystem. 

VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can be

enabled/disabled by re-running vmware-config-tools.pl.

Would you like to enable VMware automatic kernel modules?
[no] 


Disabling timer-based audio scheduling in pulseaudio.



Detected X server version 1.16.0



Distribution provided drivers for Xorg X server are used.

Skipping X configuration because X drivers are not included.


Warning: This script could not find mkinitrd or update-initramfs and cannot 
remake the initrd file!

   Starting Virtual Printing daemon:                                   done
   Checking acpi hot plug                                              done
Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:                                   done
   Guest operating system daemon:                                      done
The configuration of VMware Tools 9.6.2 build-1688356 for Linux for this 
running kernel completed successfully.

You must restart your X session before any mouse or graphics changes take 
effect.

You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the
command line.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and 
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.

Enjoy,

--the VMware team

Found VMware Tools CDROM mounted at /mnt/cdrom. Ejecting device /dev/sr0 ...