Linux VMware Workstation Not Enough Physical Memory Is Available Error and Solution – POFTUT

Linux VMware Workstation Not Enough Physical Memory Is Available Error and Solution


VMware is a Linux based virtualization system that provides rich features. VMware supported by different platforms like Windows, MacOSX, Linux. As WMware is a closed source product we need to make some manual work on Linux systems. If we are using Ubuntu, Fedora, Debian, Mint, and similar up-to-date systems whose own kernel newer than 4.8 VMware does not work accordingly. In this tutorial we will look at the problem and how to fix it.

Not Enough Physical Memory Is Available Error

This error is related to the source code which checks the Linux kernel version. VMware checks for kernels 4.8 and older. But as we know the current Linux kernel used by popular distributions is newer than 4.8. Here is the screenshot of the error.

Not Enough Physical Memory Is Available Error
Not Enough Physical Memory Is Available Error

Fix The Problem

We need to change the source code of the problem. The source code is located in the file named vmmon.tar . This file is untarred and compile with the kernel updates or during installation.

$ cd /usr/lib/vmware/modules/source
$ tar xf vmmon.tar
$ cd vmmon-only/linux

Then we will open the file named hostif.c . We need root privileges in order to save changes to the file. So we can open hostif.c with sudo like below.

$ sudo nano hostif.c

Add the following lines after #include "versioned_atomic.h" line.

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
#   define global_zone_page_state global_page_state
#endif

static unsigned long get_nr_slab_unreclaimable(void)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
   return global_node_page_state(NR_SLAB_UNRECLAIMABLE);
#else
   return global_page_state(NR_SLAB_UNRECLAIMABLE);
#endif
}



static unsigned long get_nr_unevictable(void)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
   return global_node_page_state(NR_UNEVICTABLE);
#else
   return global_page_state(NR_UNEVICTABLE);
#endif
}



static unsigned long get_nr_anon_mapped(void)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
   return global_node_page_state(NR_ANON_MAPPED);
#else
   return global_page_state(NR_ANON_PAGES);
#endif
}

Now the second change is replace following lines

unsigned int lockedPages = global_page_state(NR_PAGETABLE) +
                              global_page_state(NR_SLAB_UNRECLAIMABLE) +
                              global_page_state(NR_UNEVICTABLE) +
                              hugePages + reservedPages;
   unsigned int anonPages =
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
      global_page_state(NR_ANON_MAPPED);
#else
      global_page_state(NR_ANON_PAGES);
#endif

with

unsigned int lockedPages = global_zone_page_state(NR_PAGETABLE) +
                              get_nr_slab_unreclaimable() +
                              get_nr_unevictable() +
                              hugePages + reservedPages;
unsigned int anonPages = get_nr_anon_mapped();

Compile and load changes with the following command.

$ cd ../..
$ tar cf vmmon.tar vmmon-only
$ rm -rf vmmon-only # cleanup
$ sudo vmware-modconfig --console --install-all
Fix The Problem
Fix The Problem

Now we can use VMware without a problem or error.

LEARN MORE  How To Download, Compile and Install Custom Linux Kernel Manually In Ubuntu, Debian, Mint, Kali, CentOS?

3 thoughts on “Linux VMware Workstation Not Enough Physical Memory Is Available Error and Solution”

Leave a Comment