9

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?

1
  • 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
    Commented May 29, 2015 at 19:39

3 Answers 3

8

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.

1
  • 2
    Thank you for a well written post. This solved the issue for me. Commented Jul 1, 2015 at 7:44
4

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
5
  • 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.) Commented Jun 30, 2015 at 15:49
  • 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. Commented Feb 1, 2016 at 3:02
  • Same as @JavaScriptDude. How to patch for 4.4 kernel?
    – akahunahi
    Commented Oct 25, 2016 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. Commented Oct 26, 2016 at 19:19
  • Thanks @JavaScriptDude - agreed. I ended up going to virtual box as well. I'm a happy camper :-) Hopefully the comments can help other Linux users. Happy coding.
    – akahunahi
    Commented Oct 28, 2016 at 18:09
2

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
  • 1
    Hi budiap. Any chance of an idiots guide about how to apply this patch? Thanks.
    – Simmo
    Commented May 15, 2015 at 16:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .