Tag Archives: apt-get

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.

Install software in unsupported Ubuntu versions with apt-get

When an Ubuntu version goes unsupported its repositories get moved to an archive server. If you don’t update the repo origins you’ll get some errors like those:

Err http://archive.ubuntu.com quantal/main i386 Packages
  404  Not Found [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com quantal/restricted i386 Packages
  404  Not Found [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com quantal/universe i386 Packages
  404  Not Found [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com quantal/multiverse i386 Packages
  404  Not Found [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com quantal-updates/main i386 Packages
  404  Not Found [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com quantal-updates/restricted i386 Packages
  404  Not Found [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com quantal-updates/universe i386 Packages
  404  Not Found [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com quantal-updates/multiverse i386 Packages
  404  Not Found [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com quantal-security/main i386 Packages
  404  Not Found [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com quantal-security/restricted i386 Packages
  404  Not Found [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com quantal-security/universe i386 Packages
  404  Not Found [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com quantal-security/multiverse i386 Packages
  404  Not Found [IP: 91.189.91.14 80]

The key to solve this is changing the repo urls from archive.ubuntu.com and security.ubuntu.com to old-releases.ubuntu.com:

sudo sed -i -e 's/archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

Then update:

sudo apt-get update

apt-get-404

Ref: http://askubuntu.com/questions/91815/how-to-install-software-or-upgrade-from-old-unsupported-release