rasa / vmware-tools-patches

Patch and build VMware tools automatically
https://github.com/rasa/vmware-tools-patches/wiki
MIT License
1.19k stars 198 forks source link

Patches not applying properly. #35

Closed qgrosperrin closed 9 years ago

qgrosperrin commented 9 years ago
# uname -r
3.18.0-kali1-amd64

I am getting errors while trying to patch and compile VMware tools for my kernel (the shared folders feature specifically). The patches are not applying correctly so obviously it ends up not compiling properly..

Any help appreciated ! Thanks.

untar.sh: Patching ./VMwareTools-9.6.2-1688356.tar.gz
=== Patching ./VMwareTools-9.6.2-1688356.tar.gz ...

*** Applying vmblock/01-vmblock.3.10.patch ...
patching file linux/control.c
*** Applying vmblock/02-vmblock.3.11.patch ...
patching file linux/file.c
*** Applying vmblock/03-vmblock.3.12.patch ...
patching file linux/control.c
patching file linux/dentry.c
patching file linux/inode.c
patch unexpectedly ends in middle of line
Hunk #3 succeeded at 221 with fuzz 1.
*** Applying vmblock/04-vmblock-vfs_readlink-kernel-3.15-tools-9.6.2.patch ...
patching file linux/inode.c
Hunk #1 succeeded at 177 (offset -1 lines).
*** Applying vsock/01-vsock-sk_data_ready-kernel-3.15-tools-9.6.2.patch ...
patching file linux/notify.c
patching file linux/notifyQState.c
*** Applying vmhgfs/01-compat_dcache.h.patch ...
patching file shared/compat_dcache.h
*** Skipping vmhgfs/02-patch_inode.c.patch: did not apply cleanly
*** Applying vmhgfs/03-vmhgfs-3.15-vfs_readlink.patch ...
patching file link.c
*** Skipping vmhgfs/04-vmhgfs-d_alias-kernel-3.18.1-tools-9.9.0.patch: did not apply cleanly
*** Skipping vmhgfs/05-vmhgfs-d_count-kernel-3.11-tools-9.6.0.patch: did not apply cleanly
*** Skipping vmhgfs/06-vmhgfs-d_set_type-kernel-3.18.1-tools-9.6.1.patch: did not apply cleanly
*** Applying vmhgfs/07-vmhgfs-rename_deprecated-kernel-3.18.1-tools-9.6.1.patch ...
patching file shared/vm_assert.h
*** Applying vmhgfs/08-vmhgfs-smp_mb_before_clear_bit-3.18-tools-9.9.0.patch ...
patching file page.c
Hunk #1 succeeded at 1450 (offset -228 lines).
*** Skipping vmhgfs/09-vmhgfs-uid-gid-kernel-3.12-tools-9.6.1.patch: did not apply cleanly
*** Applying vmhgfs/10-vmhgfs-vfs_readlink-kernel-3.16-tools-9.6.2.patch ...
patching file file.c
patching file link.c
patching file shared/compat_fs.h
*** Applying vmhgfs/11-vmhgfs-wait_on_bit-kernel-3.17-tools-9.6.2.patch ...
patching file page.c
*** Skipping vmhgfs/12-vmware9.compat_mm.patch: did not apply cleanly
*** Skipping vmhgfs/13-vmhgfs-f_dentry-kernel-3.19-tools-9.9.2.patch: did not apply cleanly
*** Applying vmci/01-vmware9.k3.8rc4.patch ...
patching file linux/driver.c
Reversed (or previously applied) patch detected!  Assuming -R.
Hunk #1 succeeded at 128 with fuzz 1 (offset 4 lines).
Hunk #2 succeeded at 1747 (offset -3 lines).
Hunk #3 succeeded at 1975 (offset -3 lines).

Sample error logs stored in vmware-tools-distrib/lib/modules/source/vmhgfs-only

==> 01-compat_dcache.h.patch.patch.err <==
patching file shared/compat_dcache.h

==> 02-patch_inode.c.patch.patch.err <==
patching file inode.c
Hunk #1 FAILED at 1798.
Hunk #2 FAILED at 1818.
2 out of 2 hunks FAILED -- saving rejects to file inode.c.rej

==> 03-vmhgfs-3.15-vfs_readlink.patch.patch.err <==
patching file link.c

==> 04-vmhgfs-d_alias-kernel-3.18.1-tools-9.9.0.patch.patch.err <==
patching file inode.c
Hunk #1 FAILED at 1922.
Hunk #2 FAILED at 1975.
2 out of 2 hunks FAILED -- saving rejects to file inode.c.rej
patching file Makefile.kernel
Hunk #1 FAILED at 35.
1 out of 1 hunk FAILED -- saving rejects to file Makefile.kernel.rej
patching file shared/autoconf/d_alias.c

==> 05-vmhgfs-d_count-kernel-3.11-tools-9.6.0.patch.patch.err <==
patching file inode.c
Hunk #1 succeeded at 31 with fuzz 1.
Hunk #2 FAILED at 1893.
Hunk #3 FAILED at 1946.
2 out of 3 hunks FAILED -- saving rejects to file inode.c.rej

==> 06-vmhgfs-d_set_type-kernel-3.18.1-tools-9.6.1.patch.patch.err <==
patching file filesystem.c
patch: **** malformed patch at line 9:  

==> 07-vmhgfs-rename_deprecated-kernel-3.18.1-tools-9.6.1.patch.patch.err <==
patching file shared/vm_assert.h

==> 08-vmhgfs-smp_mb_before_clear_bit-3.18-tools-9.9.0.patch.patch.err <==
patching file page.c
Hunk #1 succeeded at 1450 (offset -228 lines).

==> 09-vmhgfs-uid-gid-kernel-3.12-tools-9.6.1.patch.patch.err <==
patching file file.c
patching file filesystem.c
Hunk #1 FAILED at 231.
1 out of 1 hunk FAILED -- saving rejects to file filesystem.c.rej
patching file fsutil.c
Hunk #2 FAILED at 678.
Hunk #3 succeeded at 2227 with fuzz 1 (offset 566 lines).
Hunk #4 succeeded at 2235 (offset 566 lines).
1 out of 4 hunks FAILED -- saving rejects to file fsutil.c.rej
patching file inode.c
Hunk #1 FAILED at 517.
Hunk #2 FAILED at 620.
Hunk #3 succeeded at 1226 (offset 7 lines).
2 out of 3 hunks FAILED -- saving rejects to file inode.c.rej
patching file shared/compat_cred.h

==> 10-vmhgfs-vfs_readlink-kernel-3.16-tools-9.6.2.patch.patch.err <==
patching file file.c
patching file link.c
patching file shared/compat_fs.h

==> 11-vmhgfs-wait_on_bit-kernel-3.17-tools-9.6.2.patch.patch.err <==
patching file page.c

==> 12-vmware9.compat_mm.patch.patch.err <==
patching file shared/compat_mm.h
Hunk #1 FAILED at 91.
Hunk #2 FAILED at 100.
2 out of 2 hunks FAILED -- saving rejects to file shared/compat_mm.h.rej

==> 13-vmhgfs-f_dentry-kernel-3.19-tools-9.9.2.patch.patch.err <==
patching file dir.c
patching file file.c
Hunk #2 succeeded at 363 (offset -22 lines).
Hunk #3 FAILED at 524.
Hunk #4 succeeded at 668 (offset 62 lines).
Hunk #5 succeeded at 683 (offset 62 lines).
Hunk #6 succeeded at 746 (offset 62 lines).
Hunk #7 FAILED at 773.
Hunk #8 FAILED at 884.
Hunk #9 FAILED at 972.
Hunk #10 FAILED at 1023.
Hunk #11 FAILED at 1072.
Hunk #12 succeeded at 1114 (offset -50 lines).
Hunk #13 succeeded at 1128 (offset -50 lines).
Hunk #14 succeeded at 1186 (offset -50 lines).
Hunk #15 FAILED at 1282.
Hunk #16 FAILED at 1330.
Hunk #17 succeeded at 1407 (offset -57 lines).
Hunk #18 FAILED at 1518.
9 out of 18 hunks FAILED -- saving rejects to file file.c.rej
patching file fsutil.c
Hunk #2 succeeded at 1940 (offset -98 lines).
patching file shared/compat_dentry.h
rasa commented 9 years ago

Not every patch will apply cleanly. In fact, most won't apply cleanly, as they are all to be applied to a specific version of VMware Tools. I'll update the README to make that clear.

The important thing is did VMware Tools compile cleanly.

qgrosperrin commented 9 years ago

The important thing is did VMware Tools compile cleanly.

It doesn't compile properly.. that was the point I was making, sorry this wasn't clear enough. Here is the compiling error I get:

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] 

Using 2.6.x kernel build system.
make: Entering directory `/tmp/modconfig-cirPN6/vmhgfs-only'
/usr/bin/make -C /lib/modules/3.18.0-kali1-amd64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
      MODULEBUILDDIR= modules
make[1]: Entering directory `/usr/src/linux-headers-3.18.0-kali1-amd64'
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/backdoorGcc64.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/backdoor.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/bdhandler.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/cpName.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/cpNameLinux.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/cpNameLite.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/dentry.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/dir.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/file.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/filesystem.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/fsutil.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/hgfsBd.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/hgfsEscape.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/hgfsUtil.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/inode.o
  CC [M]  /tmp/modconfig-cirPN6/vmhgfs-only/link.o
/tmp/modconfig-cirPN6/vmhgfs-only/inode.c: In function ‘HgfsPermission’:
/tmp/modconfig-cirPN6/vmhgfs-only/inode.c:1898:7: error: ‘struct dentry’ has no member named ‘d_alias’
/tmp/modconfig-cirPN6/vmhgfs-only/inode.c:1898:7: warning: initialization from incompatible pointer type [enabled by default]
/tmp/modconfig-cirPN6/vmhgfs-only/inode.c:1898:7: error: ‘struct dentry’ has no member named ‘d_alias’
/tmp/modconfig-cirPN6/vmhgfs-only/inode.c:1898:7: error: ‘struct dentry’ has no member named ‘d_alias’
/tmp/modconfig-cirPN6/vmhgfs-only/inode.c:1898:7: error: ‘struct dentry’ has no member named ‘d_alias’
/tmp/modconfig-cirPN6/vmhgfs-only/inode.c:1898:7: error: ‘struct dentry’ has no member named ‘d_alias’
/tmp/modconfig-cirPN6/vmhgfs-only/inode.c:1898:7: warning: initialization makes pointer from integer without a cast [enabled by default]
/tmp/modconfig-cirPN6/vmhgfs-only/inode.c:1898:7: error: ‘struct dentry’ has no member named ‘d_alias’
make[4]: *** [/tmp/modconfig-cirPN6/vmhgfs-only/inode.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [_module_/tmp/modconfig-cirPN6/vmhgfs-only] Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.18.0-kali1-amd64'
make: *** [vmhgfs.ko] Error 2
make: Leaving directory `/tmp/modconfig-cirPN6/vmhgfs-only'

As you can see because the error is related to vmhgfs-only, I just assumed this was caused by the patch not being applied cleanly (which I noticed when troubleshooting).

Could you then give me some directions as to what is needed here for the tools to compile properly ?

rasa commented 9 years ago

You're using VMware Tools 9.6.2 which is 5 versions old. The current version is VMwareTools-9.9.2-2496486.tar.gz (VMware Fusion 7.1.1 & Workstation 11.1.0).

Can you retry using that version, or is there a technical reason why you need to use 9.6.2?

If so, we will accept all patches if you can get it to work. I would start with vmhgfs/04-vmhgfs-d_alias-kernel-3.18.1-tools-9.9.0.patch and fix it to work with 9.6.2.

qgrosperrin commented 9 years ago

Yes, the reason I am still using VMware fusion 6.0.5 on OS X is because I couldn't find a legitimate reason to pay the fee for the 7.x.x upgrade. So VMwareTools-9.6.2-1688356.tar.gz is the correct version for the VMware version I have now.

I'm afraid I don't have the required knowledge to help create a patch for this kind of things, so this is why I came here hoping for assistance.

rasa commented 9 years ago

@qgrosperrin: ok, I've committed a patch that should work for you with 9.6.2, but I'm testing on kernel 3.13 and not the 3.18 that you have, so I'm not sure, but give it a shot and let us know.

qgrosperrin commented 9 years ago

Worked like a charm ! Many thanks

rasa commented 9 years ago

Glad it worked for you.