Resolving memory errors on a Dedicated server

Overview

Dedicated server users attempting to execute a shared binary or interpreter (such as Python pip) may see a memory error similar to the following:

MemoryError: Cannot allocate write+execute memory for ffi.callback(). 
You might be running on a system that prevents this.
For more information, see https://cffi.readthedocs.io/en/latest/using.html#callbacks

This is due to grsec blocking unprivileged execution and the memory allocation that the binary or interpreter needs to function. This article explains how to resolve this issue by editing a configuration file with your admin user.

The steps in this article require you to create an admin user on your Dedicated server. View the following article for instructions on creating this user:

Fixing the error

A script has been added to the following directory on your Dedicated server:

/root/shared-interpreters-pax.sh

This file can be modified and executed as a admin user to adjust memory allocation.

  1. Log into your server using your admin user.
  2. Edit the following file using sudo.
    [server]$ sudo nano /root/shared-interpreters-pax.sh
    The following list appears in this file:
    list=( java javac pip pip3 python python3 )
  3. Add the binary or interpreter you're using to this list.
  4. Execute the file:
    [server]$ ./root/shared-interpreters-pax.sh
  5. Rerun your original command.
    The memory errors will be resolved.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?