debian: FATAL -> Failed to fork

First time in my life I have something like this:

root@peklan:~# aptitude install git-core
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
FATAL -> Failed to fork.   

can somebody explain how to get rid of this message?


Solution 1:

that error message generally means aptitude or apt-get ran out of memory.

some suggestions:

  • if it's a VM, try increasing the RAM allocated to it. if it's a physical machine, try upgrading RAM.

    • if you've got some big memory hungry programs running (e.g. iceweasel, chromium, openoffice) then try killing them. in fact, if you're logged in with X, try logging out and running your upgrade from a text console or over an ssh session.
  • if you've got lots of deb and deb-src entries in your sources.list file(s), then try commenting out most of them, running 'apt-get update', and 'apt-get install git-core'.

(definitely comment out all the deb-src entries unless you frequently rebuild debian source packages for some reason - most people don't.)

  • i'm not sure if it will help (probably won't), but you might also want to look at the Cache-Limit setting. see the man page for apt.conf for details, but in short add something like the following to /etc/apt/apt.conf or to a new text file in /etc/apt/apt.conf.d:

    APT { Cache-Limit "56777216";} };

Solution 2:

You can also add swap memory before you attempt to install the package.

You can add 512Mb swap by executing:

curl -sSL https://manageacloud.com/api/cm/configuration/activate_swap/ubuntu/manageacloud-production-script.sh | bash