How do I avoid "'/usr/bin/aptitude safe-upgrade' failed: FATAL -> Failed to fork"?

May 15, 2017 381 views
Ansible Ubuntu

I have an Ubuntu 14.04 droplet which I set up with Ansible. When I run my playbook it currently fails when trying to upgrade APT packages:

'/usr/bin/aptitude safe-upgrade' failed: FATAL -> Failed to fork.

I'm not sure what this means or how to get round it.

The playbook's worked fine plenty of times before on this droplet. My droplet was recently migrated as part of some DO improvement and this is the first time I've run the playbook since then.

1 Answer
jtittle1 May 15, 2017
Accepted Answer

@philgyford

That message generally means there's not enough RAM available for the process to continue to run. I've seen it before, though it's been a while.

In such a case, the Droplet may simply need more RAM. One way to test this would be to reboot the Droplet (so all RAM is freed up), then run the playbook. If you still see the error, try upgrading just the CPU and RAM (since you can't just upgrade RAM right now) to the next highest.

You'll have to shut down the Droplet, then navigate to:

DigitalOcean CP -> Droplet -> Resize

Choose CPU and RAM Only, select the next plan, and click Resize. It'll take a few seconds to a minute to finish up. Once done, power on the Droplet and run the playbook again.

...

You can check the free RAM on your Droplet using free -mh

  • Thanks jtittle. I didn't get a chance to try again yesterday but got it working today.

    Checking the free RAM before I rebooted I got:

                 total       used       free     shared    buffers     cached
    Mem:          490M       484M       5.2M       100M       1.2M       123M
    -/+ buffers/cache:       360M       129M
    Swap:         511M       297M       214M
    

    And after reboot:

                 total       used       free     shared    buffers     cached
    Mem:          490M       470M        19M        39M        15M       150M
    -/+ buffers/cache:       304M       185M
    Swap:         511M         0B       511M
    

    But as I didn't try the updates again today, I'm not 100% sure what the state of the RAM was yesterday.

    Anyway, I rebooted, ran my playbook again and everything updated successfully. So thanks for the advice!

Have another answer? Share your knowledge.