Ubuntu – Internal gzip read error

dpkggzip

I have a Dell Optiplex 755 Core 2 Duo that I made a fresh install of 12.04. There is no Winows OS on the machine. It has been running mostly fine for over a week. I do keep getting system crashes due to an xserver-xorg-intel conflict, but at least I know the source of that. Recently, running upgrade && update I keep getting a conflict, seemingly with just one update, the most recent linux-libc-dev. Here's what I get:

jay@jay-jay:/$ sudo apt-get upgrade && sudo apt-get update
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  linux-libc-dev
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/828 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 208582 files and directories currently installed.)
Preparing to replace linux-libc-dev 3.2.0-23.36 (using .../linux-libc-dev_3.2.0-24.37_i386.deb) ...
Unpacking replacement linux-libc-dev ...
dpkg-deb (subprocess): data: internal gzip read error: ': data error'
dpkg-deb: error: subprocess  returned error exit status 2
dpkg: error processing /var/cache/apt/archives/linux-libc-dev_3.2.0-24.37_i386.deb (--unpack):
 subprocess dpkg-deb --fsys-tarfile returned error exit status 2
No apport report written because the error message indicates an issue on the local system
         Errors were encountered while processing:
 /var/cache/apt/archives/linux-libc-dev_3.2.0-24.37_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have searched AskUbuntu, have found similar questions and have tried the accepted answers where I thought they may have been of use. At this point, I am stalled.

Best Answer

Obviously there is something wrong between dpkg-deb (a program, which is part of the debian package management used by apt-get) and tar (which is packing/unpacking files from/into single archives).

Now the dpkg-deb is calling tar with an unsopported option, so somehow there is a version mismatch between those programs.

You can run this, to try solve this issue:

`aptitude clean` or `apt-get clean`

if didn't solve, try this trick:

Rename /bin/tar to /bin/tar.original:

mv /bin/tar /bin/tar.original

Then wrote simple script into /bin/tar file:

#!/bin/bash
tar.original xf -

then make it executable using

chmod a+x /bin/tar

The last step is reinstallation of broken packages:

apt-get install --reinstall dpkg
apt-get install --reinstall tar
Related Question