thanhtn
By:
thanhtn

apt-get install unzip get strange error

September 17, 2016 1.2k views
Deployment Ubuntu

hello,

i am trying to install unzip and get this error:

root@bo:~# apt-get install unzip
Reading package lists... Done
Building dependency tree

Reading state information... Done
Suggested packages:
zip
The following packages will be upgraded:
unzip
1 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.
1 not fully installed or removed.
Need to get 0 B/193 kB of archives.
After this operation, 386 kB of additional disk space will be used.
(Reading database ...
dpkg: warning: files list file for package `unzip' missing, assuming package has no files currently installed.
(Reading database ... 219960 files and directories currently installed.)
Preparing to replace unzip 6.0-4ubuntu2.5 (using .../unzip6.0-4ubuntu2.5amd64.deb) ...
Unpacking replacement unzip ...
dpkg: unrecoverable fatal error, aborting:
fork failed: Cannot allocate memory
E: Sub-process /usr/bin/dpkg returned an error code (2)

Please suggest to fix that issue.

thanks,
ThanhTruong

1 Answer
xMudrii September 17, 2016
Accepted Answer

I would suggest reinstalling package with following command:

  • sudo apt-get install --reinstall unzip

This command will completely remove package and install it again, but will not remove packages that depends on it. This is what you need in your current situation.

  • Hi xMudrii,

    I have tried and got:

    root@bo:/# sudo apt-get install --reinstall unzip
    Reading package lists... Done
    Building dependency tree

    Reading state information... Done
    Suggested packages:
    zip
    The following packages will be upgraded:
    unzip
    1 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.
    1 not fully installed or removed.
    Need to get 0 B/193 kB of archives.
    After this operation, 386 kB of additional disk space will be used.
    (Reading database ...
    dpkg: warning: files list file for package `unzip' missing, assuming package has no files currently installed.
    (Reading database ... 219960 files and directories currently installed.)
    Preparing to replace unzip 6.0-4ubuntu2.5 (using .../unzip6.0-4ubuntu2.5amd64.deb) ...
    Unpacking replacement unzip ...
    dpkg: unrecoverable fatal error, aborting:
    fork failed: Cannot allocate memory
    E: Sub-process /usr/bin/dpkg returned an error code (2)

    • It looks like you don't have enough RAM available to execute reinstall operation.
      What droplet you use and what services are active?
      Also could you post output of

      • free -t

      It is used to show how much RAM you have left including RAM + Swap if it exist.
      Example output:

                    total        used        free      shared  buff/cache   available
      Mem:        4029008     2266040      361800       54436     1401168     1397848
      Swap:       5982204       14724     5967480
      Total:     10011212     2280764     6329280
      
      • Hello,

        this is output

        root@bo:/var/www/html# free -t
                     total       used       free     shared    buffers     cached
        Mem:        501452     484972      16480          0       1676      26748
        -/+ buffers/cache:     456548      44904
        Swap:            0          0          0
        Total:      501452     484972      16480
        
        
        • This looks like you have 512 MB droplet.
          Also you are very low on memory, and this could be reason you can't reinstall.
          Units is KB and it looks like you only have 16 MB of RAM available.

          Do you have something resource hungry process like mysql? You should try freeing some RAM, for example by stopping high-ram processes until it's done.

          • Dear,

            Thank you for your suggestion. i have stopped apache2 and start install successfully.

            I got it works now.

            Thank you,
            ThanhTruong

Have another answer? Share your knowledge.