Report this

What is the reason for this report?

"dpkg: unrecoverable fatal error" when trying to update monitoring agent

Posted on October 13, 2019

Hi,

I’m following the guide to upgrade the monitoring agent https://www.digitalocean.com/docs/monitoring/how-to/upgrade-legacy-agent/

However when I run

sudo apt-get purge do-agent

I get

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

I run the command as instructed and then re-run the first command but that results in

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  linux-headers-4.4.0-154
The following packages will be REMOVED:
  do-agent* letsencrypt
The following packages will be upgraded:
  linux-headers-4.4.0-154
1 upgraded, 0 newly installed, 2 to remove and 213 not upgraded.
3 not fully installed or removed.
Need to get 0 B/10.2 MB of archives.
After this operation, 63.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 870640 files and directories currently installed.)
Removing letsencrypt (0.19.0-1+ubuntu16.04.1+certbot+1) ...
dpkg: unrecoverable fatal error, aborting:
 fork failed: Cannot allocate memory
E: Sub-process /usr/bin/dpkg returned an error code (2)

Can anyone help?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@KDSys unfortunately the dry-run gives us another error:

dpkg: dependency problems prevent removal of debconf-i18n:
 ubuntu-minimal depends on debconf-i18n.

dpkg: error processing package debconf-i18n (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 debconf-i18n

Hi @KDSys,

Sorry for the long delay in getting back to you. Unfortunately we’re still in the same situation after adding those additional sources:

dpkg: error processing package debconf-i18n (--configure):
 package debconf-i18n is not ready for configuration
 cannot configure (current status 'half-installed')
Errors were encountered while processing:
 debconf-i18n
E: Sub-process /usr/bin/dpkg returned an error code (1)

Hi @Workshed,

You get the error as there is no memory for the process to allocate

dpkg: unrecoverable fatal error, aborting:
 fork failed: Cannot allocate memory
E: Sub-process /usr/bin/dpkg returned an error code (2)

This happens when your server does not have enough memoryor SWAP configured.

Do you by any chance have SWAP configured for these cases? If not, let’s configure it and see if the issue would still appear.

First see if you have swap

sudo swapon --show

If the output is empty, it means that your system does not have swap space enabled.

Creating a Swap File

Start by creating a file which will be used for swap:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576

Set the correct permissions by typing so that only the root user can write to the file:

sudo chmod 600 /swapfile

Use the mkswap utility to set up a Linux swap area on the file:

sudo mkswap /swapfile

Activate the swap file:

sudo swapon /swapfile

Now, if you wish for the SWAP file to be there even if you reboot the droplet open the /etc/fstab file:

sudo nano /etc/fstab

and paste the following line:

/swapfile swap swap defaults 0 0

Once you have SWAP configured, please try again to run the command.

Please note this takes 1GB of your droplet’s Disk Space.

Regards, KDSys

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.