I run a random command in terminal and got this response:

Could not find the database of available applications, run update-command-not-found as root to fix this

Naturally, I run


as root, and it starts fetching the following files:


However, the command did not completely finished, but instead throwing this error

I: Writing data for ftp.us.debian.org_debian_dists_jessie_main_Contents-i386.gz ...
Traceback (most recent call last):
File "/usr/sbin/update-command-not-found", line 95, in <module> write_db_apt_file()
File "/usr/sbin/update-command-not-found", line 72, in write_db_apt_file write_db_core(fobj)
File "/usr/sbin/update-command-not-found", line 39, in write_db_core for i in text:   File "/usr/lib/python2.7/gzip.py", line 462, in readline c = self.read(readsize)
File "/usr/lib/python2.7/gzip.py", line 268, in read self._read(readsize)
File "/usr/lib/python2.7/gzip.py", line 303, in _read self._read_gzip_header()
File "/usr/lib/python2.7/gzip.py", line 197, in _read_gzip_header raise IOError, 'Not a gzipped file' 
IOError: Not a gzipped file

I am stuck. Searching for update-command-not-found did not yield positive results to solve this problem, while searching for IOError: Not a gzipped file relates the problem with Python programming, which I do not understand a bit.

Is there any workarounds to solve this issue? This is on a fresh installed Debian Jessie (8), it was installed minimally and I added/removed some DE and packages later.

result from uname -a

Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt20-1+deb8u1 (2015-12-14) i686 GNU/Linux

result from lsb_release -rd

Description: DebianEdu/Skolelinux Release: 8.2

Thanks for any helps.

1 Answer 1


I found that update-command-not-found downloaded a handful of Contents-i386.gz files into /var/cache/apt/apt-file/ directory. Somehow, the files downloaded is faulty, the filesize did not match the original. Why this problem arise, still remains a mystery to me. I had to download manually using wget (with -O switch to rename the downloaded files) like below:

Here's the command (for copy-and-paste purpose):

wget http://ftp.us.debian.org/debian/dists/jessie/main/Contents-i386.gz -O /var/cache/apt/apt-file/ftp.us.debian.org_debian_dists_jessie_main_Contents-i386.gz

And do the same thing for rest of the files:

wget http://http.debian.net/debian/dists/jessie/main/Contents-i386.gz -O /var/cache/apt/apt-file/http.debian.net_debian_dists_jessie_main_Contents-i386.gz
wget http://http.debian.net/debian/dists/jessie/contrib/Contents-i386.gz -O /var/cache/apt/apt-file/http.debian.net_debian_dists_jessie_contrib_Contents-i386.gz
wget http://http.debian.net/debian/dists/jessie/non-free/Contents-i386.gz -O /var/cache/apt/apt-file/http.debian.net_debian_dists_jessie_non-free_Contents-i386.gz

Now that /var/cache/apt/apt-file/ contains the correct files, I can run update-command-not-found with -n switch to prevent this command downloads and overwrites the correct files with the faulty ones.

root@debian:/var/cache/apt# update-command-not-found -n
I: Writing data for ftp.us.debian.org_debian_dists_jessie_main_Contents-i386.gz ... . done
I: Writing data for http.debian.net_debian_dists_jessie_contrib_Contents-i386.gz ... . done
I: Writing data for http.debian.net_debian_dists_jessie_main_Contents-i386.gz ... . done
I: Writing data for ftp.us.debian.org_debian_dists_jessie-updates_main_Contents-i386.gz ... . done
I: Writing data for http.debian.net_debian_dists_jessie_non-free_Contents-i386.gz ... . done

NB: I had to delete security.debian.org_dists_jessie_updates_main_Contents-i386.gz from within /var/cache/apt/apt-file/ directory because previous wget results in ERROR 404: Not Found.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .