in Linux

VMWare Workstation 10.0.4 install guest tool on RHEL7

Summary

Installed the Vmware tool in the RHEL7 guest system, during the installation, encountered compiling problem for vmhgfs application (for file share between host and guest system). Solved the problem by modify the vmhgfs source code and re-install.
As my Windows system is 32bit Windows7, cannot install VMware workstation 12, I think below issue will not happen in latest version 12.

install GCC and kernel-devel

If requires vmhgfs when install Vmware tool, it will requires gcc and kernel-devel to compile, otherwise it will return error.

[root@localhost Desktop]# yum install gcc
[root@localhost Desktop]# yum install "kernel-devel-uname-r == $(uname -r)"

require to remove open-vm-tools

Mount the VMware tool CD-ROM, as below screenshot shows,
Install VMware tool

When install, it will return error and ask you to remove open-vm-tools,

[root@localhost vmware-tools-distrib]# ./vmware-install.pl 
The installer found the following conflicting packages installed on the system and will now remove them:

open-vm-tools

error: Failed dependencies:
    libhgfs.so.0()(64bit) is needed by (installed) open-vm-tools-desktop-9.10.2-4.el7.x86_64
    libvmtools.so.0()(64bit) is needed by (installed) open-vm-tools-desktop-9.10.2-4.el7.x86_64
    open-vm-tools(x86-64) = 9.10.2-4.el7 is needed by (installed) open-vm-tools-desktop-9.10.2-4.el7.x86_64
Failed to remove the following packages:

open-vm-tools

Please manually remove them before installing VMware Tools.

Execution aborted.

Found VMware Tools CDROM mounted at /run/media/root/VMware Tools. Ejecting 
device /dev/sr0 ...

Now remove the open-vm-tools,

[root@localhost vmware-tools-distrib]# yum remove open-vm-tools

Error ‘struct dentry’ has no member named ‘d_alias’

Encountered error as below,

warning: (near initialization for ‘dentry’) [enabled by default] /tmp/modconfig-20TWVh/vmhgfs-only/inode.c:1973:34: error: ‘struct dentry’ has no member named ‘d_alias’

make[2]: *** [/tmp/modconfig-20TWVh/vmhgfs-only/inode.o] Errore 1

make[1]: *** [_module_/tmp/modconfig-20TWVh/vmhgfs-only] Errore 2

make[1]: uscita dalla directory "/usr/src/linux-headers-3.2.0-76-generic"

modify source code to solve the problem,

cd /usr/lib/vmware-tools/modules/source/
sudo tar xf vmhgfs.tar
cd vmhgfs-only
vim inode.c
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 66)
         dentry = list_entry(pos, struct dentry, d_alias);
#else
         dentry = list_entry(pos, struct dentry, d_u.d_alias);
#endif

save and exit,

sudo rm vmhgfs.tar
sudo tar cf vmhgfs.tar vmhgfs-only
sudo rm -r vmhgfs-only

Recompile, this error will be solved.

Error ‘struct dentry’ has no member named ‘d_count’

Encountered below error,

In file included from /tmp/modconfig-boiHAP/vmhgfs-only/inode.c:36:0:
/tmp/modconfig-boiHAP/vmhgfs-only/inode.c: In function ‘HgfsPermission’:
/tmp/modconfig-boiHAP/vmhgfs-only/./shared/compat_dcache.h:57:38: error: ‘struct dentry’ has no member named ‘d_count’
 #define compat_d_count(dentry) dentry->d_count
                                      ^
/tmp/modconfig-boiHAP/vmhgfs-only/inode.c:1904:23: note: in expansion of macro compat_d_count’
          int dcount = compat_d_count(dentry);
                       ^
make[2]: *** [/tmp/modconfig-boiHAP/vmhgfs-only/inode.o] Error 1
make[1]: *** [_module_/tmp/modconfig-boiHAP/vmhgfs-only] Error 2
make[1]: Leaving directory `/usr/src/kernels/3.10.0-327.el7.x86_64\'
make: *** [vmhgfs.ko] Error 2
make: Leaving directory `/tmp/modconfig-boiHAP/vmhgfs-only\'

Edit the source code,

[root@localhost vmware-tools-distrib]# s
bash: s: command not found...
[root@localhost vmware-tools-distrib]# ls
bin  doc  etc  FILES  INSTALL  installer  lib  vmware-install.pl
[root@localhost vmware-tools-distrib]# cd lib
[root@localhost lib]# ls
bin32  configurator  include  lib64    moduleScripts  plugins64  sbin64
bin64  icu           lib32    modules  plugins32      sbin32
[root@localhost lib]# cd module
modules/       moduleScripts/ 
[root@localhost lib]# cd module
modules/       moduleScripts/ 
[root@localhost lib]# cd modules
[root@localhost modules]# ls
binary  modules.xml  source
[root@localhost modules]# cd source/
[root@localhost source]# ls
legacy      vmblock.tar  vmhgfs.tar    vmsync.tar   vmxnet.tar
pvscsi.tar  vmci.tar     vmmemctl.tar  vmxnet3.tar  vsock.tar
[root@localhost source]# tar xf vmhgfs.tar
[root@localhost source]# ls
legacy      vmblock.tar  vmhgfs-only  vmmemctl.tar  vmxnet3.tar  vsock.tar
pvscsi.tar  vmci.tar     vmhgfs.tar   vmsync.tar    vmxnet.tar
[root@localhost source]# cd vmhgfs-only/
[root@localhost vmhgfs-only]# ls
backdoor.c       dir.c           hgfsTransport.h  request.h
backdoorGcc32.c  escBitvector.h  hgfsUtil.c       rpcout.c
backdoorGcc64.c  file.c          hgfsUtil.h       rpcout.h
backdoor.h       filesystem.c    inode.c          shared
backdoorInt.h    filesystem.h    inode.h          stubs.c
bdhandler.c      fsutil.c        link.c           super.c
COPYING          fsutil.h        Makefile         transport.c
cpName.c         hgfsBd.c        Makefile.kernel  transport.h
cpName.h         hgfsBd.h        message.c        vmci.c
cpNameInt.h      hgfsDevLinux.h  message.h        vmci_sockets.h
cpNameLinux.c    hgfsEscape.c    module.c         vmhgfs_version.h
cpNameLite.c     hgfsEscape.h    module.h
cpNameLite.h     hgfs.h          page.c
dentry.c         hgfsProto.h     request.c
[root@localhost vmhgfs-only]# cd shared/
[root@localhost shared]# ls
autoconf             compat_pci_mapping.h  vm_atomic.h
backdoor_def.h       compat_pgtable.h      vm_basic_asm.h
backdoor_types.h     compat_sched.h        vm_basic_asm_x86_64.h
circList.h           compat_scsi.h         vm_basic_asm_x86.h
community_source.h   compat_semaphore.h    vm_basic_defs.h
compat_autoconf.h    compat_skbuff.h       vm_basic_math.h
compat_cred.h        compat_slab.h         vm_basic_types.h
compat_dcache.h      compat_sock.h         vmci_call_defs.h
compat_ethtool.h     compat_spinlock.h     vmci_defs.h
compat_fs.h          compat_statfs.h       vmci_infrastructure.h
compat_highmem.h     compat_string.h       vmci_iocontrols.h
compat_interrupt.h   compat_timer.h        vmciKernelAPI1.h
compat_ioport.h      compat_uaccess.h      vmciKernelAPI2.h
compat_kernel.h      compat_version.h      vmciKernelAPI.h
compat_log2.h        compat_workqueue.h    vmci_kernel_if.h
compat_mm.h          dbllnklst.h           vm_device_version.h
compat_module.h      driver-config.h       vmware.h
compat_mutex.h       driverLog.c           vmware_pack_begin.h
compat_namei.h       driverLog.h           vmware_pack_end.h
compat_netdevice.h   guest_msg_def.h       vmware_pack_init.h
compat_page-flags.h  includeCheck.h        x86cpuid_asm.h
compat_page.h        kernelStubs.h         x86cpuid.h
compat_pagemap.h     kernelStubsLinux.c
compat_pci.h         vm_assert.h
[root@localhost shared]# vim compat_dcache.h 
[root@localhost shared]# 

modify vmhgfs-only/shared/compat_dcache.h, line 54, this is related to kernel version.

- #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)

After modify, repack the source code, this problem will be resolved.

[root@localhost shared]# cd ..
[root@localhost vmhgfs-only]# ls
backdoor.c       dir.c           hgfsTransport.h  request.h
backdoorGcc32.c  escBitvector.h  hgfsUtil.c       rpcout.c
backdoorGcc64.c  file.c          hgfsUtil.h       rpcout.h
backdoor.h       filesystem.c    inode.c          shared
backdoorInt.h    filesystem.h    inode.h          stubs.c
bdhandler.c      fsutil.c        link.c           super.c
COPYING          fsutil.h        Makefile         transport.c
cpName.c         hgfsBd.c        Makefile.kernel  transport.h
cpName.h         hgfsBd.h        message.c        vmci.c
cpNameInt.h      hgfsDevLinux.h  message.h        vmci_sockets.h
cpNameLinux.c    hgfsEscape.c    module.c         vmhgfs_version.h
cpNameLite.c     hgfsEscape.h    module.h
cpNameLite.h     hgfs.h          page.c
dentry.c         hgfsProto.h     request.c
[root@localhost vmhgfs-only]# cd ..
[root@localhost source]# ls
legacy      vmblock.tar  vmhgfs-only  vmmemctl.tar  vmxnet3.tar  vsock.tar
pvscsi.tar  vmci.tar     vmhgfs.tar   vmsync.tar    vmxnet.tar
[root@localhost source]#  rm vmhgfs.tar
rm: remove regular file ‘vmhgfs.tar’? t
[root@localhost source]#  rm vmhgfs.tar
rm: remove regular file ‘vmhgfs.tar’? y
[root@localhost source]# ls
legacy      vmblock.tar  vmhgfs-only   vmsync.tar   vmxnet.tar
pvscsi.tar  vmci.tar     vmmemctl.tar  vmxnet3.tar  vsock.tar
[root@localhost source]# ls
legacy      vmblock.tar  vmhgfs-only   vmsync.tar   vmxnet.tar
pvscsi.tar  vmci.tar     vmmemctl.tar  vmxnet3.tar  vsock.tar
[root@localhost source]# tar cf vmhgfs.tar vmhgfs-only
[root@localhost source]# ls
legacy      vmblock.tar  vmhgfs-only  vmmemctl.tar  vmxnet3.tar  vsock.tar
pvscsi.tar  vmci.tar     vmhgfs.tar   vmsync.tar    vmxnet.tar
[root@localhost source]# rm -rf vmhgfs-only
[root@localhost source]# ls
legacy      vmblock.tar  vmhgfs.tar    vmsync.tar   vmxnet.tar
pvscsi.tar  vmci.tar     vmmemctl.tar  vmxnet3.tar  vsock.tar
[root@localhost source]# cd .
[root@localhost source]# cd ..
[root@localhost modules]# ls
binary  modules.xml  source
[root@localhost modules]# cd ..
[root@localhost lib]# ls
bin32  configurator  include  lib64    moduleScripts  plugins64  sbin64
bin64  icu           lib32    modules  plugins32      sbin32
[root@localhost lib]# cd ..
[root@localhost vmware-tools-distrib]# ls
bin  doc  etc  FILES  INSTALL  installer  lib  vmware-install.pl
[root@localhost vmware-tools-distrib]# ./vmware-install.pl 

Refer to Link, use shell scripts to do the source code modify,

#!/bin/bash

mkdir /tmp/vmfusion
mkdir /tmp/vmfusion-archive
mount /dev/sr0 /tmp/vmfusion
tar xzfv /tmp/vmfusion/VMwareTools-*.tar.gz -C /tmp/vmfusion-archive
tar xfv /tmp/vmfusion-archive/vmware-tools-distrib/lib/modules/source/vmhgfs.tar -C /tmp/vmfusion-archive/vmware-tools-distrib/lib/modules/source/
sed -i -e \'/KERNEL_VERSION/{s/3, 11, 0/3, 10, 0/}\' /tmp/vmfusion-archive/vmware-tools-distrib/lib/modules/source/vmhgfs-only/shared/compat_dcache.h
rm -rf /tmp/vmfusion-archive/vmware-tools-distrib/lib/modules/source/vmhgfs.tar
tar cfv /tmp/vmfusion-archive/vmware-tools-distrib/lib/modules/source/vmhgfs.tar -C /tmp/vmfusion-archive/vmware-tools-distrib/lib/modules/source/ vmhgfs-only
rm -rf /tmp/vmfusion-archive/vmware-tools-distrib/lib/modules/source/vmhgfs-only/
/tmp/vmfusion-archive/vmware-tools-distrib/vmware-install.pl --default
umount /tmp/vmfusion
rm -rf  /tmp/vmfusion
rm -rf  /tmp/vmfusion-archive

successful result

The successful install procedure / log is as below,

[root@localhost vmware-tools-distrib]# ./vmware-install.pl 
A previous installation of VMware Tools has been detected.

The previous installation was made by the tar installer (version 4).

Keeping the tar4 installer database format.

You have a version of VMware Tools installed.  Continuing this install will 
first uninstall the currently installed version.  Do you wish to continue? 
(yes/no) [yes] 

Uninstalling the tar installation of VMware Tools.

Stopping services for VMware Tools

Stopping vmware-tools (via systemctl):                     [  OK  ]

Stopping Thinprint services in the virtual machine:
   Stopping Virtual Printing daemon:                                   done

File /usr/lib/vmware-tools/modules/source/vmhgfs.tar is backed up to 
/usr/lib/vmware-tools/modules/source/vmhgfs.tar.old.0.

The removal of VMware Tools 9.6.2 build-1688356 for Linux completed 
successfully.

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/)? 
[/etc/rc.d] 

What is the directory that contains the init scripts? 
[/etc/rc.d/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] 

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 (via systemctl):                     [  OK  ]


The module vmci has already been installed on this system by another installer 
or package and will not be modified by this installer.

The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.

The module vmxnet3 has already been installed on this system by another 
installer or package and will not be modified by this installer.

The module pvscsi has already been installed on this system by another 
installer or package and will not be modified by this installer.

The module vmmemctl has already been installed on this system by another 
installer or package and will not be modified by this installer.

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] 


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.10.0-327.el7.x86_64/build/include".
The path "/lib/modules/3.10.0-327.el7.x86_64/build/include" appears to be a 
valid path to the 3.10.0-327.el7.x86_64 kernel headers.
Would you like to change it? [no] 

Using 2.6.x kernel build system.
make: Entering directory `/tmp/modconfig-duktE3/vmhgfs-only\'
/bin/make -C /lib/modules/3.10.0-327.el7.x86_64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. 
  MODULEBUILDDIR= modules
make[1]: Entering directory `/usr/src/kernels/3.10.0-327.el7.x86_64\'
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/message.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/dir.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/request.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/filesystem.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/cpName.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/rpcout.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/hgfsUtil.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/stubs.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/hgfsEscape.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/link.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/bdhandler.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/transport.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/module.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/file.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/super.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/vmci.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/fsutil.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/cpNameLinux.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/hgfsBd.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/backdoorGcc64.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/page.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/backdoor.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/inode.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/dentry.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/cpNameLite.o
  CC [M]  /tmp/modconfig-duktE3/vmhgfs-only/kernelStubsLinux.o
  LD [M]  /tmp/modconfig-duktE3/vmhgfs-only/vmhgfs.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /tmp/modconfig-duktE3/vmhgfs-only/vmhgfs.mod.o
  LD [M]  /tmp/modconfig-duktE3/vmhgfs-only/vmhgfs.ko
make[1]: Leaving directory `/usr/src/kernels/3.10.0-327.el7.x86_64\'
/bin/make -C $PWD SRCROOT=$PWD/. 
  MODULEBUILDDIR= postbuild
make[1]: Entering directory `/tmp/modconfig-duktE3/vmhgfs-only\'
make[1]: `postbuild\' is up to date.
make[1]: Leaving directory `/tmp/modconfig-duktE3/vmhgfs-only\'
cp -f vmhgfs.ko ./../vmhgfs.o
make: Leaving directory `/tmp/modconfig-duktE3/vmhgfs-only\'

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] 

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] 

Thinprint provides driver-free printing. Do you wish to enable this feature? 
[yes] 


Disabling timer-based audio scheduling in pulseaudio.



Detected X server version 1.17.2



Distribution provided drivers for Xorg X server are used.

Skipping X configuration because X drivers are not included.

Creating a new initrd boot image for the kernel.
   Starting Virtual Printing daemon:                                   done
Starting vmware-tools (via systemctl):                     [  OK  ]
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

/sbin/restorecon:  Warning no default label for /tmp/vmware-block-restore0/tmp_file
[root@localhost vmware-tools-distrib]#

Restart the guest OS, use command df -hT to check the mounted file system, the windows shared .host:/ mounted to folder /mnt/hgfs, so the vmhgfs is working properly.

Filesystem            Type      Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs        30G  3.8G   27G  13% /
devtmpfs              devtmpfs  902M     0  902M   0% /dev
tmpfs                 tmpfs     917M   88K  917M   1% /dev/shm
tmpfs                 tmpfs     917M  9.0M  908M   1% /run
tmpfs                 tmpfs     917M     0  917M   0% /sys/fs/cgroup
/dev/mapper/rhel-home xfs        10G  277M  9.8G   3% /home
/dev/sda1             xfs       497M  159M  339M  32% /boot
.host:/               vmhgfs    466G  264G  202G  57% /mnt/hgfs
tmpfs                 tmpfs     184M   16K  184M   1% /run/user/0

Write a Comment

Comment