VMware – Backward-Compatible 3.19 Fix..
After the solution to the Kernel 3.19/vmnet problem mentioned in previous posts, I have produced a fix that includes tests for kernel versions, and works with Kernel 3.19 and with earlier kernel versions..
This is probably not the most elegant code, but it works – I have tested it with VMware 11.0 and Kernels 3.19-rc5 and 3.18.3 (from kernel.org)..
In vmnet-only/driver.c – around line 267
change:
if (filp && filp->f_op && filp->f_op->ioctl == VNetFileOpIoctl) { ret = VNetFileOpIoctl(filp->f_dentry->d_inode, filp, iocmd, ioarg); } return ret; }
to:
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) if (filp && filp->f_op && filp->f_op->ioctl == VNetFileOpIoctl) { ret = VNetFileOpIoctl(filp->f_dentry->d_inode, filp, iocmd, ioarg); } return ret; #else if (filp && filp->f_op && filp->f_op->ioctl == VNetFileOpIoctl) { ret = VNetFileOpIoctl(filp->f_path.dentry->d_inode, filp, iocmd, ioarg); } return ret; #endif }
And, around line 1194
change:
if (filp && filp->f_dentry) { inode = filp->f_dentry->d_inode; } err = VNetFileOpIoctl(inode, filp, iocmd, ioarg); return err;
to:
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) if (filp && filp->f_dentry) { inode = filp->f_dentry->d_inode; } err = VNetFileOpIoctl(inode, filp, iocmd, ioarg); return err; #else if (filp && filp->f_path.dentry) { inode = filp->f_path.dentry->d_inode; } err = VNetFileOpIoctl(inode, filp, iocmd, ioarg); return err; #endif
In vmnet-only/userif.c – around line 526
change:
return skb_copy_datagram_iovec(skb, 0, &iov, len);
to:
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) return skb_copy_datagram_iovec(skb, 0, &iov, len); #else struct iov_iter to; iov_iter_init(&to, READ, &iov, 1, len); return skb_copy_datagram_iter(skb, 0, &to, len); #endif
Basically, test for kernel version prior to 3.19, and if found, use the ‘old’ code, otherwise, use the ‘new’ code..
Once again, thanks are due to Al Viro and coderus for the fix for skb_copy_datagram_iovec..
Hopefully this makes sense!
Robert Gadsdon January 23, 2015.
Thank you very much for this article! It was very helpful and it works like charm!
Me sirvio… bastante bueno y práctico. Eso de módificar el código sólo a un desarrollador se le pudo haber ocurrido… Hasta tuve que compilar el kernel pues estoy en debian 8 y en debian están en la versión 3.16. Muchas gracias ya me estaba dando por vencido.
Me alegro de que esto funcionó para usted ..
Atentamente,
RG
(utilizando Google Translate!)
Any tips on how to fix this issue on a fresh install of VMWare 11.0 with the 3.19 kernel? Maybe i did wrong but i haven’t found the vmnet-only folder and i can’t go through the kernel updater :/ thanks!
vmnet.tar can be found in /usr/lib/vmware/modules/source. un-tar this to get the vmnet-only directory, apply the changes, and re-tar, before starting vmware..
RG.
Any chance you could elaborate on this a little please chief? Running a custom 3.19 kernel-pf here and am well experienced in having to fix vmware on Ubuntu but have patched the files as per your instructions and still no luck. Here is the last line of my unhelpful logfile:
2015-02-20T21:19:56.916Z| vthread-4| W110: Failed to build vmnet. Failed to execute the build command.
VMware Workstation 11, Ubuntu 14.04.
Serves me right for upgrading from Workstation 10.
Ok, figured out how to modify the stuff in /usr/lib/vmware/modules/source and re-tar it but still no luck. It’s probably a self-inflicted injury (stupid custom kernels…) but any ideas? Previously this and the vmware unlocker have always worked first time for me.
ghost@failbot:/usr/lib/vmware/modules/source$ sudo vmware-modconfig –console –install-all
Stopping VMware services:
VMware Authentication Daemon done
VM communication interface socket family done
Virtual machine communication interface done
Virtual machine monitor done
Blocking file system done
Using kernel build system.
make: Entering directory `/tmp/modconfig-q0bvHH/vmmon-only’
/usr/bin/make -C /lib/modules/3.19.0-pf1-meowski+/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= modules
make[1]: Entering directory `/usr/src/linux-headers-3.19.0-pf1-meowski+’
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/linux/driver.o
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/linux/driverLog.o
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/linux/hostif.o
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/common/apic.o
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/common/comport.o
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/common/cpuid.o
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/common/hashFunc.o
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/common/memtrack.o
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/common/phystrack.o
/tmp/modconfig-q0bvHH/vmmon-only/linux/driver.c:1332:1: warning: always_inline function might not be inlinable [-Wattributes]
LinuxDriverSyncReadTSCs(uint64 *delta) // OUT: TSC max – TSC min
^
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/common/task.o
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/common/vmx86.o
/tmp/modconfig-q0bvHH/vmmon-only/linux/driver.c: In function ‘LinuxDriver_Ioctl’:
/tmp/modconfig-q0bvHH/vmmon-only/linux/driver.c:2054:1: warning: the frame size of 1129 bytes is larger than 1024 bytes [-Wframe-larger-than=]
}
^
CC [M] /tmp/modconfig-q0bvHH/vmmon-only/vmcore/moduleloop.o
LD [M] /tmp/modconfig-q0bvHH/vmmon-only/vmmon.o
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/modconfig-q0bvHH/vmmon-only/vmmon.mod.o
LD [M] /tmp/modconfig-q0bvHH/vmmon-only/vmmon.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.19.0-pf1-meowski+’
/usr/bin/make -C $PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= postbuild
make[1]: Entering directory `/tmp/modconfig-q0bvHH/vmmon-only’
make[1]: `postbuild’ is up to date.
make[1]: Leaving directory `/tmp/modconfig-q0bvHH/vmmon-only’
cp -f vmmon.ko ./../vmmon.o
make: Leaving directory `/tmp/modconfig-q0bvHH/vmmon-only’
Using kernel build system.
make: Entering directory `/tmp/modconfig-q0bvHH/vmnet-only’
/usr/bin/make -C /lib/modules/3.19.0-pf1-meowski+/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= modules
make[1]: Entering directory `/usr/src/linux-headers-3.19.0-pf1-meowski+’
CC [M] /tmp/modconfig-q0bvHH/vmnet-only/driver.o
CC [M] /tmp/modconfig-q0bvHH/vmnet-only/hub.o
CC [M] /tmp/modconfig-q0bvHH/vmnet-only/userif.o
CC [M] /tmp/modconfig-q0bvHH/vmnet-only/netif.o
In file included from include/linux/pci.h:34:0,
from /tmp/modconfig-q0bvHH/vmnet-only/compat_netdevice.h:27,
from /tmp/modconfig-q0bvHH/vmnet-only/netif.c:43:
include/linux/pci_ids.h:2251:0: warning: “PCI_VENDOR_ID_VMWARE” redefined [enabled by default]
#define PCI_VENDOR_ID_VMWARE 0x15ad
^
In file included from /tmp/modconfig-q0bvHH/vmnet-only/net.h:38:0,
from /tmp/modconfig-q0bvHH/vmnet-only/vnetInt.h:26,
from /tmp/modconfig-q0bvHH/vmnet-only/netif.c:42:
/tmp/modconfig-q0bvHH/vmnet-only/vm_device_version.h:56:0: note: this is the location of the previous definition
#define PCI_VENDOR_ID_VMWARE 0x15AD
^
/tmp/modconfig-q0bvHH/vmnet-only/driver.c: In function ‘register_ioctl32_handlers’:
/tmp/modconfig-q0bvHH/vmnet-only/driver.c:310:7: error: implicit declaration of function ‘register_ioctl32_conversion’ [-Werror=implicit-function-declaration]
retval = register_ioctl32_conversion(i, LinuxDriver_Ioctl32_Handler);
^
/tmp/modconfig-q0bvHH/vmnet-only/driver.c:310:47: error: ‘LinuxDriver_Ioctl32_Handler’ undeclared (first use in this function)
retval = register_ioctl32_conversion(i, LinuxDriver_Ioctl32_Handler);
^
/tmp/modconfig-q0bvHH/vmnet-only/driver.c:310:47: note: each undeclared identifier is reported only once for each function it appears in
/tmp/modconfig-q0bvHH/vmnet-only/driver.c:315:6: error: implicit declaration of function ‘unregister_ioctl32_conversion’ [-Werror=implicit-function-declaration]
unregister_ioctl32_conversion(j);
^
/tmp/modconfig-q0bvHH/vmnet-only/driver.c:320:16: error: ‘ioctl32_cmds’ undeclared (first use in this function)
for (i = 0; ioctl32_cmds[i]; i++) {
^
/tmp/modconfig-q0bvHH/vmnet-only/driver.c: In function ‘unregister_ioctl32_handlers’:
/tmp/modconfig-q0bvHH/vmnet-only/driver.c:372:16: error: ‘ioctl32_cmds’ undeclared (first use in this function)
for (i = 0; ioctl32_cmds[i]; i++) {
^
/tmp/modconfig-q0bvHH/vmnet-only/driver.c: At top level:
/tmp/modconfig-q0bvHH/vmnet-only/driver.c:380:2: error: #else without #if
#else
^
/tmp/modconfig-q0bvHH/vmnet-only/driver.c:383:2: error: #endif without #if
#endif
^
/tmp/modconfig-q0bvHH/vmnet-only/driver.c:1175:0: error: unterminated #if
#if defined(HAVE_COMPAT_IOCTL) || defined(HAVE_UNLOCKED_IOCTL)
^
/tmp/modconfig-q0bvHH/vmnet-only/driver.c:304:1: warning: ‘register_ioctl32_handlers’ defined but not used [-Wunused-function]
register_ioctl32_handlers(void)
^
/tmp/modconfig-q0bvHH/vmnet-only/driver.c:361:1: warning: ‘unregister_ioctl32_handlers’ defined but not used [-Wunused-function]
unregister_ioctl32_handlers(void)
^
cc1: some warnings being treated as errors
make[2]: *** [/tmp/modconfig-q0bvHH/vmnet-only/driver.o] Error 1
make[2]: *** Waiting for unfinished jobs….
make[1]: *** [_module_/tmp/modconfig-q0bvHH/vmnet-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.19.0-pf1-meowski+’
make: *** [vmnet.ko] Error 2
make: Leaving directory `/tmp/modconfig-q0bvHH/vmnet-only’
Unable to install all modules. See log for details.
Sorry for the noise, but I fixed it at last and thought I should share:
1: Uninstall VMware completely.
2: Delete old files littering /usr/lib/vmware/modules/source with sudo rm -rf ./*only
3: Reinstall VMware
4: cd /usr/lib/vmware/modules/source && sudo tar -xvf vmnet.tar && cd vmnet-only
5: Apply your patches to driver.c and userif.c
6: Blow away the old vmnet-only.tar and repackage the fixed versions: sudo rm vmnet.tar && sudo tar -cf vmnet.tar vmnet-only
7: sudo vmware-modconfig –console –install-all
8: Install VMware update and repeat entire process
9: Install vmware-unlocker for OSX guest access
10: Profit!
Details: Ubuntu 14.04 host, custom 3.19 based on pf-kernel, VMware Workstation 11.1.0 build-2496824.
Many thanks for your fix chief :]
Are you able to have sound in OSX through VM-Ware without the vcpu-0 unexpected signal 11 error? I have to disconnect the sound.
I don’t have any OSX systems.. You may be able to get an answer to this at the VMware forums.. https://communities.vmware.com/community/vmtn/workstation
RG.
Thanks, it works with VMware Player 7.1.0 on Fedora 21 (kernel version: 3.19.2-200.fc21)
Working fine in Ubuntu linux 3.19 provided by Ubuntu 15.04
Thanks for this!
Just realised that the
LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
test fails on the latest Arch stock kernel (3.19.2-1) not sure how or why, but changing the RHS to (3, 18, 0) is a remedial hack for anyone else that runs into this.
I Update to diff for easy use for any one
diff -aur vmnet-only-orig/driver.c vmnet-only/driver.c
— vmnet-only-orig/driver.c 2015-03-23 12:41:39.697253589 +0700
+++ vmnet-only/driver.c 2015-03-23 12:47:41.435822646 +0700
@@ -265,10 +265,17 @@
{
int ret = -ENOTTY;
– if (filp && filp->f_op && filp->f_op->ioctl == VNetFileOpIoctl) {
– ret = VNetFileOpIoctl(filp->f_dentry->d_inode, filp, iocmd, ioarg);
– }
– return ret;
+ #if LINUX_VERSION_CODE f_op && filp->f_op->ioctl == VNetFileOpIoctl) {
+ ret = VNetFileOpIoctl(filp->f_dentry->d_inode, filp, iocmd, ioarg);
+ }
+ return ret;
+ #else
+ if (filp && filp->f_op && filp->f_op->ioctl == VNetFileOpIoctl) {
+ ret = VNetFileOpIoctl(filp->f_path.dentry->d_inode, filp, iocmd, ioarg);
+ }
+ return ret;
+ #endif
}
@@ -1191,11 +1198,19 @@
struct inode *inode = NULL;
long err;
– if (filp && filp->f_dentry) {
– inode = filp->f_dentry->d_inode;
– }
– err = VNetFileOpIoctl(inode, filp, iocmd, ioarg);
– return err;
+ #if LINUX_VERSION_CODE f_dentry) {
+ inode = filp->f_dentry->d_inode;
+ }
+ err = VNetFileOpIoctl(inode, filp, iocmd, ioarg);
+ return err;
+ #else
+ if (filp && filp->f_path.dentry) {
+ inode = filp->f_path.dentry->d_inode;
+ }
+ err = VNetFileOpIoctl(inode, filp, iocmd, ioarg);
+ return err;
+ #endif
}
#endif
diff -aur vmnet-only-orig/userif.c vmnet-only/userif.c
— vmnet-only-orig/userif.c 2015-03-23 12:41:39.695253570 +0700
+++ vmnet-only/userif.c 2015-03-23 12:46:43.106241654 +0700
@@ -523,7 +523,13 @@
.iov_base = buf,
.iov_len = len,
};
– return skb_copy_datagram_iovec(skb, 0, &iov, len);
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
+ return skb_copy_datagram_iovec(skb, 0, &iov, len);
+ #else
+ struct iov_iter to;
+ iov_iter_init(&to, READ, &iov, 1, len);
+ return skb_copy_datagram_iter(skb, 0, &to, len);
+ #endif
}
For ARch users, there is a patch available on the VMware wiki page, for 3.19 kernels.
Pasting the summary.
# curl http://pastie.org/pastes/9934018/download -o /tmp/vmnet-3.19.patch
# cd /usr/lib/vmware/modules/source
# tar -xf vmnet.tar
# patch -p0 -i /tmp/vmnet-3.19.patch
# tar -cf vmnet.tar vmnet-only
# vmware-modconfig –console –install-all
Linux localhost.localdomain 3.19.1-201.fc21.x86_64 #1 SMP Wed Mar 18 04:29:24 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
I had the same problem.
1. # – as root user
$ cd /usr/lib/vmware/modules/source
$ tar -xvf vmnet.tar
2. Edit the driver.c and userif.c as instructed above.
3. $ tar -cvf vmnet.tar vmnet-only/
$ rm -rf vmnet-only/
$ vmware-modconfig –console –install-all
after that, player started with no problem.
thanks!!
My system is Fedora 21 on Kernel 3.19.2.
Vmware player version 7.1.0
I am also getting the same on compiling the vmnet & follwed the steps given by rakotomandimby (https://wiki.archlinux.org/index.php/VMware) & able to resolve the issue.
Thanks rakotomandimby & all for their help.
Upon installing vmware workstation 10.0.5 this morning, just after 15.04’s release, I made the changes that the OP mentioned, but there’s one additional change that needs to be made as well.
After making changes to driver.c and userif.c, I was still getting this error:
/tmp/modconfig-t7rj7B/vmnet-only/netif.c:152:64: error: macro “alloc_netdev” requires 4 arguments, but only 3 given
dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup);
In order to fix this, before I re-tarred up the vmnet.tar file, I also changed netif.c in the following way:
Around line 152, i changed this:
dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup);
to this:
dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_UNKNOWN, VNetNetIfSetup);
This fixed the issue. I found this solution here: http://rglinuxtech.com/?p=1184
Thanks for the info.. Good to know that ‘older’ versions of VMware can still be updated..
RG.
thanks for this!
Any fixes for Kernel 4.0?
This works for 4.0 as well.. There are more installation instructions – and a pre-built patch – at the ArchLinux wiki: https://wiki.archlinux.org/index.php/VMware#3.19_kernels
RG.
Works for me on 3.19.0-15-generic, thanks a lot.
I am frustrated. I am trying to run VMWare Workstation 9.0.4 on Kubuntu 15.04 kernel 3.19-0-16-generic and have tried all of the patches listed here. Nothing will get this thing working. Has anybody else done this with the same version I am using? Any more suggestions?
Thanks, Ken
I can’t find anything on getting VMware 9.x working.. Seems from the post above that 10.x can be made to work, but that seems to be the oldest working version with later kernels..
RG.
Thanks,
I went to VirtualBox and everything works fine. It seems I threw a bunch of money in the trash by paying for VmWare. 🙁
Firstly – thanks.
Secondly, here’s the unified diff patch:
diff -u vmnet-only/driver.c vmnet-only.patched/driver.c
— vmnet-only/driver.c 2015-02-07 11:54:17.000000000 +1100
+++ vmnet-only.patched/driver.c 2015-06-08 01:25:05.832361550 +1000
@@ -266,7 +266,11 @@
int ret = -ENOTTY;
if (filp && filp->f_op && filp->f_op->ioctl == VNetFileOpIoctl) {
+#if LINUX_VERSION_CODE f_dentry->d_inode, filp, iocmd, ioarg);
+#else
+ ret = VNetFileOpIoctl(filp->f_path.dentry->d_inode, filp, iocmd, ioarg);
+#endif
}
return ret;
}
@@ -1191,8 +1195,13 @@
struct inode *inode = NULL;
long err;
+#if LINUX_VERSION_CODE f_dentry) {
inode = filp->f_dentry->d_inode;
+#else
+ if (filp && filp->f_path.dentry) {
+ inode = filp->f_path.dentry->d_inode;
+#endif
}
err = VNetFileOpIoctl(inode, filp, iocmd, ioarg);
return err;
diff -u vmnet-only/userif.c vmnet-only.patched/userif.c
— vmnet-only/userif.c 2015-02-07 11:54:17.000000000 +1100
+++ vmnet-only.patched/userif.c 2015-06-08 01:22:28.320719458 +1000
@@ -523,7 +523,13 @@
.iov_base = buf,
.iov_len = len,
};
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
return skb_copy_datagram_iovec(skb, 0, &iov, len);
+#else
+ struct iov_iter to;
+ iov_iter_init(&to, READ, &iov, 1, len);
+ return skb_copy_datagram_iter(skb, 0, &to, len);
+#endif
}
Prepared patch for VMware player 7.1 on Ubuntu vivid 15.04:
$ patch -p0 < vmware-7.1.0-build-2496824-3.19.0-20-generic.patch
patching file vmnet-only/driver.c
patching file vmnet-only/userif.c
There is already a patch – and instructions – at https://wiki.archlinux.org/index.php/VMware#3.19_kernels_and_up
RG.
My code came out so wrong.
Ever heard of markdown?
Also, the linked archlinux code is redundant and has too many brackets. It’s a stupid patch IMHO.
This works for Ubuntu 15.04 and VMworkstation 11.1!
Thanks so much.
-Dan
found another bug in filter.c (ubuntu 15.04 – kernel 3.19.0-15-generic #15)
need change forward declaration:
**** old *****
/* netfilter hooks for filtering. */
static nf_hookfn VNetFilterHookFn;
**** new *****
/* netfilter hooks for filtering. */
static unsigned int
VNetFilterHookFn(unsigned int hooknum, // IN:
#ifdef VMW_NFHOOK_USES_SKB
struct sk_buff *skb, // IN:
#else
struct sk_buff **pskb, // IN:
#endif
const struct net_device *in, // IN:
const struct net_device *out, // IN:
int (*okfn)(struct sk_buff *)); // IN:
Which version of VMware was this?
RG.
6.0.1 build-1379776
Excellent information
After all of above changes were completed and placed into the vmnet.tar file all worked fine.
Works like a charm with Antix15 + VMware-Workstation-Full-11.0.0-2305329.x86_64 bundle/Linux.
And to think I was about to give up, now I’m going to try it with VMware-Workstation-Full-12.1.0-3272444.x86_64 instead.
Thanks a billion for your excellent post & also to mr.meowski for and brilliant Howto list.
Thanks everybody, this thread has been a real saver.