Because this answer is only for kernel 3.13, so I'd like to share a solution for the problem Failed to build vmnet for kernel 3.19 and earlier versions. Thus this is not my actual problem and is only intended to help future readers.

Question

When I want to run VMware Workstation or VMware Player for the first time, it needs to deploy some packages at kernel level but it fails with this line of error.

Failed to build vmnet. Failed to execute the build command.

What should I do to resolve this problem?

  • Note that this no longer appears to be the case. As of a fresh installation today, on a Linux system, I have not been able to replicate this build problem. – Thomas Ward May 29 '15 at 19:39
up vote 8 down vote accepted

Solution

  1. Change directory into the vmware module source directory. [1]

    cd /usr/lib/vmware/modules/source
    
  2. Untar the vmnet modules. [1]

    sudo tar -xvf vmnet.tar
    
  3. Open vmnet-only/driver.c with your favorite text editor.

    sudo gedit vmnet-only/driver.c
    
  4. Around line 267, change the following [2]

    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
    
  5. Around line 1194, change the following [2]

    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
    
  6. Save this file and then open file vmnet-only/userif.c

    sudo gedit vmnet-only/userif.c
    
  7. Around line 526, change the following [2]

    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
    
  8. Save this file and then re-tar the modules. [1]

    sudo tar -uvf vmnet.tar vmnet-only
    
  9. Delete the previous working directory. [1]

    sudo rm -r vmnet-only
    
  10. Run the GUI (Workstation or Player) again and let it to build the modules.

References

[1] : An answer from nonsleepr.
[2] : A write-up from Robert Gadsdon.

  • 2
    Thank you for a well written post. This solved the issue for me. – ChosSimbaOne Jul 1 '15 at 7:44

Thanks budiap for posting patch for Workstation 10! It just took me a while to figure out that you need to use that code to apply that code to a patch file. Here is the post I made to vmware workstation forums.

OKAY! I got it. Workstation 10 on Ubuntu15.04, or whatever-buntu. I tested this on Xubuntu 15.04 Kernel 3.19.0-18-generic

Created new pastie(10215458) for patch for Workstation 10.

After fresh install of Workstation 10.06 Specifically - > VMware-Workstation-Full-10.0.6-2700073.x86_64.bundle

Must be root, but you can basically copy/paste.

curl http://pastie.org/pastes/10215458/download -o /tmp/vmnet-3.19.patch_ws10

cd /usr/lib/vmware/modules/source
tar -xf vmnet.tar
patch -p0 -i /tmp/vmnet-3.19.patch_ws10
mv vmnet.tar vmnet.tar.SAVED
tar -cf vmnet.tar vmnet-only
rm -r vmnet-only
vmware-modconfig --console --install-all
  • Can't believe I'm the first person to upvote this! This is a great, great answer. (Hope you don't mind my suggested edit.) – Mark E. Haase Jun 30 '15 at 15:49
  • Nope, edits welcome and thanks! – Lon Kaut Aug 19 '15 at 19:29
  • 1
    I just tried this with Kernel 4.2 with Ubuntu 15.10 and it did not work. I could not find any patch to get WS10 working on 15.10 and had to back down to 14 LTS which used Kernel 3.19. – Timothy C. Quinn Feb 1 '16 at 3:02
  • Same as @JavaScriptDude. How to patch for 4.4 kernel? – Ligemer Oct 25 '16 at 16:17
  • @Ligemer - I've given up on trying to get older versions of vmware workstation to work on Linux and switched over to virtual box and the decision has served me well. For Linux, and vmware I think the only practical solution is to buy a license for the latest Workstation version -or- just use free vmware player and come up with an external snapshot mechanism like ZFS or BTRFS. – Timothy C. Quinn Oct 26 '16 at 19:19

if you are running vmware workstation 10, apply this patch to make it work on kernel 3.19

diff -rupN vmnet-only/driver.c vmnet-only-modified/driver.c
--- vmnet-only/driver.c 2015-01-17 09:25:58.000000000 +0800
+++ vmnet-only-modified/driver.c    2015-05-07 14:53:18.272218785 +0800
@@ -265,10 +265,17 @@ LinuxDriver_Ioctl32_Handler(unsigned int
 {
    int ret = -ENOTTY;

+#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
 }


@@ -1191,11 +1198,19 @@ VNetFileOpUnlockedIoctl(struct file    *
    struct inode *inode = NULL;
    long err;

+#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
 }
 #endif

diff -rupN vmnet-only/netif.c vmnet-only-modified/netif.c
--- vmnet-only/netif.c  2015-01-17 09:25:58.000000000 +0800
+++ vmnet-only-modified/netif.c 2015-05-07 14:51:43.326885576 +0800
@@ -149,7 +149,7 @@ VNetNetIf_Create(char *devName,  // IN:
    memcpy(deviceName, devName, sizeof deviceName);
    NULL_TERMINATE_STRING(deviceName);

-   dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup);
+   dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_UNKNOWN, VNetNetIfSetup);
    if (!dev) {
       retval = -ENOMEM;
       goto out;
diff -rupN vmnet-only/userif.c vmnet-only-modified/userif.c
--- vmnet-only/userif.c 2015-01-17 09:25:58.000000000 +0800
+++ vmnet-only-modified/userif.c    2015-05-07 14:52:32.095595913 +0800
@@ -523,7 +523,13 @@ VNetCopyDatagram(const struct sk_buff *s
       .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
 }
  • 1
    Hi budiap. Any chance of an idiots guide about how to apply this patch? Thanks. – Simmo May 15 '15 at 16:05

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.