Fix apt-get “cannot copy extracted data for ‘…’ to ‘…’: unexpected end of file or stream”

I was doing an apt-get upgrade and got this error:

Preparing to replace liborc-0.4-0:armhf 1:0.4.16-2 (using .../liborc-0.4-0_1%3a0.4.18-1rpi1rpi2_armhf.deb) ...
Unpacking replacement liborc-0.4-0:armhf ...
dpkg-deb (subprocess): decompressing archive member: internal gzip read error: ': incorrect data check'
dpkg-deb: error: subprocess  returned error exit status 2
dpkg: error processing /var/cache/apt/archives/liborc-0.4-0_1%3a0.4.18-1rpi1rpi2_armhf.deb (--unpack):
 cannot copy extracted data for './usr/lib/arm-linux-gnueabihf/liborc-0.4.so.0.18.0' to '/usr/lib/arm-linux-gnueabihf/liborc-0.4.so.0.18.0.dpkg-new': unexpected end of file or stream

I tried deleting the faulty deb file:

sudo rm /var/cache/apt/archives/liborc-0.4-0_1%3a0.4.18-1rpi1rpi2_armhf.deb

And upgrade again:

sudo apt-get upgrade

But it failed complaining with unresolved dependencies and said to force the process with the -f parameter:

sudo apt-get -f upgrade

Then it failed again with the first error. Then I figured that cleaning all the deb cache could fix it and it did. Just had to run:

sudo apt-get clean

And then the upgrade process worked fine.

You might also like

MongoDB: Recover Data after an Unexpected Shutdown in Ubuntu
If you try to run mongod but it fails to start and have this error in the log file (/var/log/mongodb/mongodb.log)...

Install a Symfony2 application using Composer
Before installing any Symfony2 project you have to meet the minimum requirements for it in your server....

Fix ‘ERROR: column “spclocation” does not exist’ in phpPgAdmin
I was going to create a new database with phpPgAdmin and it crashed with this error:ERROR: column...

Fix ‘ERROR: column “spclocation” does not exist’ in phpPgAdmin
I was going to create a new database with phpPgAdmin and it crashed with this error:ERROR: column...

  1. Cool. Never had the problem, but glad to know their is a simple fix. As an Ubuntu user, I’m a contributer and user of ask ubuntu, so maybe I’ll be able to help someone else. Thanks!

  2. Roger Greenlaw

    Thanks for posting this. I just installed an older version of Ubuntu and got this error while trying to upgrade it.

  3. Yohei Kuchiki

    I had the same problem and this post solved it. Thanks.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.