我在终端中运行随机命令并得到以下响应:
无法找到可用应用程序的数据库,请以 root 身份运行 update-command-not-found 来修复此问题
自然地,我跑
未找到更新命令
作为 root,它开始获取以下文件:
http://http.debian.net/debian/dists/jessie/main/Contents-i386.gz
http://http.debian.net/debian/dists/jessie/contrib/Contents-i386.gz
http://http.debian.net/debian/dists/jessie/non-free/Contents-i386.gz
然而,该命令并没有完全完成,而是抛出了这个错误
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
我被困住了。正在寻找未找到更新命令在寻找解决这个问题的过程中并没有产生积极的结果IOError:不是 gzip 压缩文件涉及Python编程的问题,我有点不明白。
有什么解决方法可以解决这个问题吗?这是在新安装的 Debian Jessie (8) 上,它是最低限度安装的,后来我添加/删除了一些 DE 和软件包。
结果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
结果lsb_release-rd
描述:DebianEdu/Skolelinux 版本:8.2
感谢您的任何帮助。
答案1
我找到未找到更新命令下载了一些目录-i386.gz文件到/var/cache/apt/apt 文件/目录。不知何故,下载的文件有问题,文件大小与原始文件不匹配。为什么会出现这个问题,对我来说仍然是个谜。我必须使用 wget 手动下载(使用 -O 开关重命名下载的文件),如下所示:
这是命令(用于复制和粘贴目的):
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
对其余文件执行相同的操作:
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
现在/var/cache/apt/apt 文件/包含正确的文件,我可以update-command-not-found
使用-n
switch 运行以防止此命令下载并用错误的文件覆盖正确的文件。
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
注意:我必须security.debian.org_dists_jessie_updates_main_Contents-i386.gz
从/var/cache/apt/apt-file/
目录中删除,因为以前的wget
结果是ERROR 404: Not Found
.