How do you handle a “ENOMEM” error when trying to run a Chef command?

Problem scenario:  You recently installed Chef server on a Linux t2.micro instance (an AWS virtual server with 1 vCPU and 1 GB of RAM).  You ran this command "chef-server-ctl reconfigure" and received this error:

"Errno::ENOMEM occurred in delayed notification: runit_service[opscode-solr4] ( private-chef::opscode-solr4 line 37) had an error: Errno::ENOMEM: Cannot allocate memory - fork(2)"

What should you do?

Solution
Root cause:  A t2.micro instance has insufficient RAM.  You will need a server with more memory.
Try this command:  free -mh

The results of the above command will look something like this if there is enough memory:
  total        used        free      shared  buff/cache   available
Mem:           3.5G        1.1G        217M         68M        2.1G        2.0G
Swap:            0B          0B          0B

You need a server with at least 4 GB of RAM.   Chef's hardware requirements are 4 GB.  See this Chef document for more information.  To install a standalone Chef instance, follow these directions.  To add RAM to a VM click here for AWS resizing directions or here for GCP resizing directions.  For directions on adding or configuring virtual memory, see this posting.

Leave a comment

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