VMWare Network Hickups ( sent link down event. )

I ran into this because I went to a hotel that had DHCP renew every 300 seconds, trying to download something inside the VM was getting clobbered...

If you check your syslog or kern.log and see the following entries; then I might have the solution for you:

kernel: [235397.022939] userif-3: sent link down event.
kernel: [235397.022943] userif-3: sent link up event.

Then the issue is one that when your DHCP renews it calls into the kernel with the new information; unfortunately this causes VMWare Workstation & Player (might effect other VMWare products?) to reset its network stack, even though nothing changed...

The solution after a lot of time googling different terms and trying to figure out what exactly was going on. I finally found it here (by Jan Just Keijer): https://www.nikhef.nl/~janjust/vmnet/ (The original link is now dead, you can read it on Wayback machine here) it was for an much older version of VMWare Player; but the solution still applies to VMWare workstation 16 & 17...

To make sure the information doesn't just disappear in the future (and so I can easily find it myself) I'm going to quote the relevant code and/or modifications I did..

Extract the /usr/lib/vmware/modules/source/vmnet-only.tar tar file, you need to modify the userif.c file. Search it for VNetUserIfSetUplinkState function and right after the variable declaration add if (!linkUp) return 0;

// Around line 966
VNetUserIfSetUplinkState(VNetPort *port, uint8 linkUp)
 {
    VNetUserIF *userIf;
    VNetJack *hubJack;
    VNet_LinkStateEvent event;
    int retval;

    /* ADD: never send link down events */   
    if (!linkUp) return 0;
    /* END Added code */
    
    ... rest of code ...

This will eliminate the linkdown events; which disconnect the internet from the VMWare network driver...

After you do that; recreate the vmnet-only.tar and replace the original. Then you can run: /usr/bin/vmware-modconfig --console --install-all

And then either
systemctl restart vmware
or
service vmware restart

If you still see " sent link down event." in your logs; then the patch wasn't applied properly.

There is also a GitHub issue for this issue, that has been sitting open since early 2022. It is unlikely this issue will be fixed unless there is a lot of people thumb upping that they run into this...

Finally, you can also clone the latest vmware network modules source code (you still have to apply this patch) from https://github.com/mkubecek/vmware-host-modules

12 comments

  1. Ok the patch works! The link down events is gone, but now I have a lot of link up events 🙂 without the link down... weird

    1. That is because the patch forces the driver to ignore all "link" down events. A better solution would be to ignore the link down event for a second, then push it thru if no link-up event occurred, but this is a quick and dirty hack to eliminate the issue that is caused by dns renewals that occur with a very short time frame. You still see the link up's because the dns renew event generates this event. But because the network is already connected, it basically does nothing other than the very first "link up" time...

  2. Many, many thanks for this 🙏.

    I need to recurringly run a network-sensitive program in a virtual machine, and I've pulled my hair for the good part of an evening due to this problem today. I was about to call it a day and move to VirtualBox 😅.

  3. I've been struggling with this issue for months. I didn't know if the problem was Pop-OS 22.04 related or tied to linux 6.X kernels, but my network interface would constantly flap. I knew about Michal Kubeček's fix, but it never worked... until now! It torques me to no end why VMware doesn't fix this once and for all.

    1. Nope, not tied to any specific kernel and I believe it could even affect Windows or Mac technically as small DHCP renewals is typically where you see this issue occur from. It is an annoying bug, especially if your renewal is set to something that occurs often (or very often).

  4. Thanks for this, it looks very promising as I'm experiencing this as well.
    I'm installing VMWare Workstation on a Manjaro system via the AUR but I can't seem to apply your patch as there is no source folder in /usr/lib/vmware/modules just a modules.xml file.
    Would you happen to have suggestions as to what I should try?

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.