Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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?

share|improve this question
1  
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) –  lumbric Dec 21 '11 at 15:52
    
Are you running in a VPS ? –  bodhi.zazen Dec 21 '11 at 16:14
    
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. –  xrado Dec 21 '11 at 21:58
    
I am getting exactly same problem, also lots of others. See this: ubuntuforums.org/showthread.php?p=11649751 –  BlackDivine Jan 29 '12 at 20:00
    
How much memory is bash using when it happens? ps -o rss,vsize,args $$ –  geirha Feb 26 '12 at 21:11

1 Answer 1

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|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.