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

Ubuntu 14.04.02 vmhgfs compile failure (VMwareTools-9.9.2-2496486) #29

Closed eborshch closed 9 years ago

eborshch commented 9 years ago

Hello!

I cannot compile the latest VMwareTools-9.9.2-2496486 (neither patched not original) on Ubuntu 14.04.02 with latest Linux kernel (3.13.0-46). It raises the following error:

 from /tmp/modconfig-qqjwHn/vmhgfs-only/inode.c:29:
/tmp/modconfig-qqjwHn/vmhgfs-only/inode.c: In function ‘HgfsPermission’:
include/linux/kernel.h:793:27: error: ‘struct dentry’ has no member named ‘d_alias’
  const typeof( ((type *)0)->member ) *__mptr = (ptr); \

The complete output can be found here https://gist.github.com/eborshch/cd6f430bf6771e33e5cf. I've noticed that there is a recent fix (https://github.com/rasa/vmware-tools-patches/pull/27) for the similar issue, though it does not solve this particular issue as it has been already merged into the master when I've tried it.

Any hints?

Thank you in advance!

Best, Eugene

p.s. it looks like this issue has been already reported to VMWare https://communities.vmware.com/message/2477575

rasa commented 9 years ago

I'm looking into this now, and will let you know what I discover.

vschoener commented 9 years ago

Same issue for me on Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2 x86_64 GNU/Linux

I try to use your patch install but the problem still persist.

(I already commented for another issue)

vschoener commented 9 years ago

Ok so I succeed with hgfs installation.

I uncompressed the "vmware-tools-distrib/lib/modules/source/vmhgfs.tar" with "tar cvf" command then I used this command in my vim editor : ":%s/d_alias/d_u.d_alias/g" to replace any d_alias with his own new structure. The file to edit is 'inode.c' And finally just compress back the folder with : "tar cvf vmhgfs.tar vmhgfs-only" command

I restart the installer from the vmware-tools-distrib folder and now I can access to my shared folder.

Don't worry if just after the compilation the HGFS service display as failed, it's (normally) because you didn't add any share to your vmware settings. Add it and it will show up in your /mnt/hgfs/ folder

The VMwareTools version is : VMwareTools-9.9.2-2496486.tar.gz

Hope It could help some of you :)

anodynos commented 9 years ago

I have the same here problem Kubuntu 14.04 (3.13.0-46-generic) & VMWare Workstation 11.1 & VMwareTools-9.9.2-2496486.tar.gz With the previous kernel 3.13.0-45 & VMwareTools-9.9.0 hgfs was working just fine (having applied the patch back in December).

eborshch commented 9 years ago

@vschoener thanks a bunch! It works!

vschoener commented 9 years ago

@eborshch You're welcome, I forgot to mention the file to edit "inode.c" But you found out :)

anodynos commented 9 years ago

@vschoener

I used this command in my vim editor : ":%s/d_alias/d_u.d_alias/g" to replace any d_alias with his own new structure. The file to edit is 'inode.c'

Can you please elaborate with his own new structure ? What string did you replace d_alias with ?

vschoener commented 9 years ago

I replaced d_alias to d_u.d_alias because this variable has been moved the "dentry" structure.

LukeMauldin commented 9 years ago

Following @vschoener instructions worked for me on Ubuntu 14.10.

anodynos commented 9 years ago

Thanks @vschoener - it worked great! FYI I did it on Kubuntu 14.10 x64 with kernel 3.16.0-31-generic.

BTW I cant believe that such a small change escapes VMWare's attention and break the whole product.

henrylee18 commented 9 years ago

@vschoener thanks for the tip and it works!

bentoner commented 9 years ago

Thank you. This fixes shared folders for me on Ubuntu 14.04 with VMwareTools-9.9.0-2304977 on Workstation 11.0.0.

vschoener commented 9 years ago

Thanks you all, I'm glad this fix is helping everyone :)

tuongngoc commented 9 years ago

Thanks! It works fine for me too.

I run this

!/bin/sh -x

cd /usr/lib/vmware-tools/modules/source tar xf vmhgfs.tar grep -q d_u.d_alias vmhgfs-only/inode.c && echo "already patched" && exit 0 sed -i -e s/d_alias/d_u.d_alias/ vmhgfs-only/inode.c cp -p vmhgfs.tar vmhgfs.tar.orig tar cf vmhgfs.tar vmhgfs-only vmware-config-tools.pl -d -m

NOTE: this makes the tools incompatible with older kernel versions, i.e. 3.13.0-45.

rasa commented 9 years ago

@eborshch: How did you get kernel 3.13.0, as 3.16.0 is the default, per https://wiki.ubuntu.com/TrustyTahr/ReleaseNotes#Linux_kernel_3.16 .

Also, I've installed both http://releases.ubuntu.com/trusty/ubuntu-14.04.2-server-amd64.iso and http://cdimage.ubuntu.com/ubuntu-server/trusty/daily/current/trusty-server-amd64.iso using VMwareTools-9.9.2-2496486.tar.gz, and always get kernel 3.16.0 and did not encounter any issues.

ashb commented 9 years ago

This fix still didn't work for me on Ubuntu 12.02 with linux-generic-lts-trusty (kernel 3.13.0-46) and I had to just hack the patch by adding a custom patch like this:

cat > patches/vmhgfs/99-vmhgfs-inode-hack-hack-bodge.patch   <<EOF
--- vmhgfs-only/inode.c.oirg    2015-03-06 14:56:04.344130628 +0000
+++ vmhgfs-only/inode.c 2015-03-06 14:56:14.583830707 +0000
@@ -1922,11 +1922,7 @@
                            p,
 #endif
                            &inode->i_dentry,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 1) && !defined(__GENKSYMS__) && !defined(D_ALIAS_IS_A_MEMBER_OF_UNION_D_U)
-                           d_alias) {
-#else
                            d_u.d_alias) {
-#endif
          int dcount = hgfs_d_count(dentry);
          if (dcount) {
             LOG(4, ("Found %s %d \n", dentry->d_name.name, dcount));
@@ -1979,11 +1975,7 @@
       /* Find a dentry with valid d_count. Refer bug 587879. */
       list_for_each(pos, &inode->i_dentry) {
          int dcount;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 1) && !defined(__GENKSYMS__) && !defined(D_ALIAS_IS_A_MEMBER_OF_UNION_D_U)
-         struct dentry *dentry = list_entry(pos, struct dentry, d_alias);
-#else
          struct dentry *dentry = list_entry(pos, struct dentry, d_u.d_alias);
-#endif
          dcount = hgfs_d_count(dentry);
          if (dcount) {
             LOG(4, ("Found %s %d \n", (dentry)->d_name.name, dcount));
EOF

With this done I get the vmhgfs module compiled and loaded.

rasa commented 9 years ago

@ashb That's weird. What VMware Tools version did you use?

ashb commented 9 years ago

I thought it was 9.6.2, but vmware-toolbox-cmd --version says 9.9.2 so I'm trying again.

cty12 commented 9 years ago

@vschoener

So just replace the 'd_alias' will be fine? Do I have to patch the code using the patch provided in this repo first?

Many thanks.

frol commented 9 years ago

@rasa It seems that Ubuntu team has backported some features from 3.17+ to LTS kernels (3.13.0-46, 3.16.0-31 and probably some other). I can confirm that applying the patch without a check for 3.18.1 kernel works for me on 3.13.0-46 (3.13.0-45 worker well without the patch).

vschoener commented 9 years ago

@cty12 I didn't patch anything according to the available patch here. I just replaced the 'd_alias' and everything works fine. (My kernel is 3.2.X)

rasa commented 9 years ago

Fixed in https://github.com/rasa/vmware-tools-patches/commit/192e3b78b94cfa872d45043d671fe0cb4572b714#

130s commented 9 years ago

Confirmed that 192e3b7 works. Thank you for the work @rasa and all.

3.13.0-46-generic Host: Ubuntu 14.04 64b Guest: Ubuntu 12.04 64b

mouse07410 commented 9 years ago

@vschoener, you're great! Thank you for saving my Ubuntu 14.10 LTS!

suntong commented 9 years ago

Thank you @vschoener, works great for

VMwareTools-9.9.2-2496486 for guest Ubuntu 14.10 with kernel 3.16.0-33-generic x86_64 under VMware Workstation for Windows v11.1.0.2496824

pscorrigan commented 9 years ago

@vschoener -
Many thanks for this ... your fix saved me time ... and a headache ! ...

This fix works perfectly for VMware Tools 9.6.2.31837 (build-1688356) guest Ubuntu 12.04.5 LTS with kernel 3.13.0-48-generic x86_64 under VMware Player 6.0.4 build-2249910 for Windows 7 Ultimate

pscorrigan commented 9 years ago

@vschoener -

Further note ...

This fix works also works perfectly for: VMware Tools 9.6.2.31837 (build-1688356) guest Ubuntu 14.04.2 LTS (trusty) with kernel 3.13.0-48-generic x86_64 under VMware Player 6.0.4 build-2249910 for Windows 7 Ultimate

... thanks again!

phlegx commented 9 years ago

@tuongngoc thx! Yout shell script works for me.

yakovkeselman commented 9 years ago

@tuongngoc: many thanks! Your shell script worked for me too! Great job!

papabasile commented 9 years ago

@tuongngoc Thanks! The script worked fine for me too!

rasa commented 9 years ago

Is everyone implying that master is broken?

jverhoeven commented 9 years ago

@vschoener

Great stuff. Fix works fine! Shame on VMWare for not fixing this immediately. Really: 2 replaces in one inode.c file?

vschoener commented 9 years ago

@jverhoeven : You're welcome :) Indeed, it's shame to let this broken.. But now there is a great community to fix the problem and make people happy :)

ethanlu2 commented 9 years ago

@vschoener Thanks a lot. It helped!

z-targz commented 9 years ago

Hopefully this works for me when I get home. Have to reinstall my entire VM after screwing up the boot trying to fix this problem. Using Ubuntu 15.04

armanshahrisa commented 9 years ago

Thanks a lot! It worked for me! I was getting crazy!!

au10tic commented 9 years ago

followed the instructions found here: https://github.com/rasa/vmware-tools-patches/ on "Lubuntu 14.04.2 LTS, Trusty Tahr" and vmhgfs and copy/paste works, drag and drop works from guest to host, not vice-versa. Lubuntu is running 3.16.0-30-generic

the patch would not work on "lubuntu 15.04 (vivid vervet)" running kernel 3.19.0-18 generic, [vmhgfs works, copy/paste, drag and drop dont work]

also restarting vmware-user gives this error: /usr/share/themes/Lubuntu-default/gtk-2.0/apps/thunar.rc:55: error: invalid string constant "thunar-statusbar", expected valid string constant

output below after running,/untar-and-patch.sh * 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 * 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 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 1745 (offset -5 lines). Hunk #3 succeeded at 1976 (offset -2 lines). * Skipping vmhgfs/01-compat_dcache.h.patch: did not apply cleanly * Skipping vmhgfs/02-patch_inode.c.patch: did not apply cleanly * Applying vmhgfs/03-vmhgfs-3.15-vfs_readlink.patch ... patching file link.c Hunk #1 succeeded at 160 (offset 9 lines). Hunk #2 succeeded at 200 (offset 11 lines). * Applying vmhgfs/04-vmhgfs-d_alias-kernel-3.18.1-tools-9.9.0.patch ... patching file inode.c patching file Makefile.kernel patching file shared/autoconf/d_alias.c * 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 * Skipping vmhgfs/07-vmhgfs-rename_deprecated-kernel-3.18.1-tools-9.6.1.patch: did not apply cleanly * Applying vmhgfs/08-vmhgfs-smp_mb_before_clear_bit-3.18-tools-9.9.0.patch ... patching file page.c * Skipping vmhgfs/09-vmhgfs-uid-gid-kernel-3.12-tools-9.6.1.patch: did not apply cleanly * Skipping vmhgfs/10-vmhgfs-vfs_readlink-kernel-3.16-tools-9.6.2.patch: did not apply cleanly * Skipping vmhgfs/11-vmhgfs-wait_on_bit-kernel-3.17-tools-9.6.2.patch: did not apply cleanly * Skipping vmhgfs/12-vmware9.compat_mm.patch: did not apply cleanly * Applying vmhgfs/13-vmhgfs-f_dentry-kernel-3.19-tools-9.9.2.patch ... patching file dir.c patching file file.c patching file fsutil.c patching file shared/compat_dentry.h * Skipping vmhgfs/14-vmhgfs-d_alias-kernel-3.18.1-tools-9.6.2.patch: did not apply cleanly * Applying vmhgfs/15-vmhgfs-bdi-kernel-4.0-tools-9.9.2.patch ... patching file filesystem.c patching file module.h patching file super.c * Skipping vmhgfs/16-vmhgfs-f_dentry-kernel-3.19.0-15-tools-9.6.2.patch: did not apply cleanly

william-dowling commented 9 years ago

@tuongngoc and @vschoener Your tweak worked great for me with this guest setup $ uname -a Linux desktop 3.2.0-85-generic #122-Ubuntu SMP Tue May 26 16:15:25 UTC 2015 i686 i686 i386 GNU/Linux Thanks!

ehallander9591 commented 9 years ago

I am glad I found this thread of discussion. It worked for me.

pgiu commented 9 years ago

Happened the same to me today. My configurations: Windows 7 Host Ubuntu 14.04 w/ 3.13.0-52 kernel Vmware 10.0.6 with Tools 9.6.5

I had the "d_alias" issue but the patches on the "patches" directory didn't solve the problem. Instead I got a new problem saying that there was a problem with a structure called DENTRY.

I ended up looking for a patch that had to do with the DENTRY struct and copied to the same patch directory with a name that matched my vmware tools version. I don't know how if that's the proper way to do it but it appears to be working now.

This is my two cents just in case anyone bumps into the same problem.

cd patches/vmhgfs
cp -p 16-vmhgfs-f_dentry-kernel-3.19.0-15-tools-9.6.2.patch 16-vmhgfs-f_dentry-kernel-3.13.0-15-tools-9.6.5.patch

And I can now see the windows drive mounted at /mnt Thanks for all the hard work!!

rasa commented 9 years ago

Wow. Running

cp -p 16-vmhgfs-f_dentry-kernel-3.19.0-15-tools-9.6.2.patch 16-vmhgfs-f_dentry-kernel-3.13.0-15-tools-9.6.5.patch

should not have fixed your issue as the filenames are meaningless, other than the sort order. I have no idea how that fixed your issue.

pgiu commented 9 years ago

Hi @rasa I thought that was what solved my problem but It seems that I was wrong. I just assumed that the script would patch depending on the vmware tools version so I decided to copy that patch. I was in a rush trying to make it work so I might have not payed full attention to it. I see that you're the owner of the project so feel free to disregard/delete my comment if you find it inappropriate. Anyway, thanks for sharing this.

asoc commented 9 years ago

I ran into this issue today with the following:

Ubuntu 12.04 w/ 3.5.0-41 VMware Fusion 7.1.2 and Tools 9.9.3-2759765

The included dalias patches weren't being applied because VMware's moved the relevant d_alias lines to a #define hgfs_d_alias() statement which caused shared/autoconf/dalias.c to fail to be patched.

I created a new patch, I've pasted it below so hopefully someone else will get some use out of it. It can probably be rewritten to just replace the file outright without caring about old contents, but it works for me as is...

patches/vmhgfs/18-vmhgfs-d_alias-kernel-3.18.1-tools-9.9.3.patch

diff -uwNr vmhgfs-only.orig/shared/autoconf/dalias.c vmhgfs-only/shared/autoconf/dalias.c
--- vmhgfs-only.orig/shared/autoconf/dalias.c   1969-12-31 16:00:00.000000000 -0800
+++ vmhgfs-only/shared/autoconf/dalias.c        2015-03-18 19:14:44.751231007 -0700
@@ -1,45 +1,21 @@
 /*********************************************************
- * Copyright (C) 2015 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ * Copyright (C) 2015 Ross Smith II. MIT Licensed.
  *
  *********************************************************/

 #include "compat_version.h"
 #include "compat_autoconf.h"

-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
 #include <linux/dcache.h>
-#include <linux/list.h>

 /*
- * After 3.19.0, the dentry d_alias field was moved. Fedora
- * backported this behavior into a 3.18.0 kernel.
+ * After 3.18.1, the dentry d_alias field was moved to struct d_u.
  *
  * This test will fail on a kernel with such a patch.
  */
 void test(void)
 {
-   struct dentry aliasDentry;
+   struct dentry dentry;

-   INIT_HLIST_NODE(&aliasDentry.d_alias);
+   dentry.d_alias.next = NULL;
 }
-
-#else
-/* Intentionally passes for earlier than 3.9.0 kernels as d_alias is valid. */
-#endif
-#else
-#error "This test intentionally fails on 3.19.0 or newer kernels."
-#endif
rasa commented 9 years ago

I added your patch in https://github.com/rasa/vmware-tools-patches/commit/cb6bce50f6b3a4e9e8ccc104fca405b0a1dedcdc, but I haven't tested it yet.

russt commented 9 years ago

@tuongngoc Thanks! Used your script to patch debian 8.1.0, VMwareTools-9.9.2-2496486.tar.gz I had to re-run vmware-config-tools.pl manually to re-select hgfs option, compiled fine the second time.

dkxl commented 9 years ago

@asoc - Thanks, your patch to dalias.c also works for debian wheezy (3.2.0-4-amd64) and VMwareTools 9.9.3.47419 (build-2759765)

LivioCzar commented 8 years ago

@vschoener - thanks for the simple solution - works for me with Windows 7 (Host) Xubuntu 14.04.03 LTS (Guest) Kernel 3.13.0-65-generic VMWare 10.0.3 VMWareTools 9.6.2.31837

tracyzhen commented 8 years ago

@vschoener thanks a lot, it works !

vschoener commented 8 years ago

You're welcome :)