Skip directly to content

Sub-process gzip returned an error code (1)

on Sat, 2007-07-21 00:42

When I was updating Ubuntu on my laptop today, both Synaptic and apt-get update returned the error message Sub-process gzip returned an error code (1). Since it took me a while to figure out what was going on, I thought I should share what I found and also the very simple solution.

The problem

The error message occurred when APT, or its graphical front-end Synaptic, tried to update the packages list. It ended up in the following error message:1

gzip: stdin: not in gzip format
   Err http://archive.ubuntu.com/ubuntu/dists/feisty-updates/main/binary-i386/Packages.gz
   Sub-process gzip returned an error code (1)

The error message recurred each time I tried to update the packages list. What puzzled me was the fact that I was able to download and unzip the package files by hand.

It took me a little while to figure out what was going on. The troublesome file was only partially downloaded the first time. Hence, apt-get stored it in /var/lib/apt/lists/partial. Of some reason I do not fully understand, APT was completing or replacing the partial file on the following tries.

The solution

Once I understood the problem, the solution was obvious: delete the partial file.

To summarize, if Synaptic or apt-get update gives you the error message “Sub-process gzip returned an error code (1)”, the solution is:

sudo rm /var/lib/apt/lists/partial/*

  1. Actually, the error message was in Swedish and read: http://se.archive.ubuntu.com/ubuntu/dists/feisty-updates/main/binary-i386/Packages.gz: Underprocessen gzip returnerade en felkod (1)

Post new comment