fork: Cannot allocate memory

18,948

Can you provide us with the output of ulimit -a ran in a session where this happens?

/etc/pam.d/sshd should involve pam_limits.so when you open a session. This module will use /etc/security/limits.conf to apply various restrictions to your session, including regarding memory usage.

Share:
18,948

Related videos on Youtube

xrado
Author by

xrado

Updated on September 18, 2022

Comments

  • xrado
    xrado over 1 year

    I am frequently getting:

    fork: Cannot allocate memory
    

    when running commands over ssh. I have 4 GB of RAM and usually 2 GB free. This started happening since I upgraded to Ubuntu 11.10.

    I then need to repeatably run the command until it finishes successfully.

    I'm connecting from my laptop to my server both from my home LAN. Some times happens even when I run apt-get.

    Any idea why?

    • lumbric
      lumbric over 12 years
      I think you have to provide more details otherwise this won't be solveable. I suppose the machine you are describing is the ssh server you are connecting to? (and not the client) When this happens run free and post the output here (and what program caused the error)
    • Panther
      Panther over 12 years
      Are you running in a VPS ?
    • xrado
      xrado over 12 years
      I'm connecting from my laptop to my server both in home lan. Some times happens even when I run apt-get. I'll check free next time.
    • DivinesLight
      DivinesLight over 12 years
      I am getting exactly same problem, also lots of others. See this: ubuntuforums.org/showthread.php?p=11649751
  • J. Starnes
    J. Starnes over 6 years
    Welcome to askubuntu. You could improve your answer by including an example command to enable swap. From review.