![软件包安装:dpkg 解析错误](https://linux22.com/image/75277/%E8%BD%AF%E4%BB%B6%E5%8C%85%E5%AE%89%E8%A3%85%EF%BC%9Adpkg%20%E8%A7%A3%E6%9E%90%E9%94%99%E8%AF%AF.png)
每当我尝试使用安装任何新软件包时sudo apt-get install *package*
,都会收到以下错误:
dpkg: parse error, in file '/var/lib/dpkg/status' near line 95 package 'python-nova':
`Depends' field, invalid package name `python:any': character `:' not allowed (only letters, digits and characters `-+._')
E: Sub-process /usr/bin/dpkg returned an error code (2)
谁能给我提供解决这个问题的步骤?
当我输入时head -100 /var/lib/dpkg/status | tail -10
我得到:
Architecture: all
Source: nova
Version: 1:2014.1.5-0ubuntu1.3
Provides: python2.7-nova
Depends: openssh-client, openssl, python-amqplib (>= 0.6.1), python-anyjson (>= 0.3.3), python-babel, python-boto (>= 2.4.0), python-cinderclient (>= 1:1.0.5), python-eventlet (>= 0.13.0), python-glanceclient (>= 1:0.9.0), python-greenlet (>= 0.3.2), python-iso8601, python-jinja2, python-jsonschema (>= 1.3.0), python-keystoneclient (>= 1:0.3.2), python-kombu (>= 2.5.12), python-lxml (>= 2.3), python-m2crypto, python-migrate, python-netaddr (>= 0.7.6), python-neutronclient (>= 1:2.3.0), python-oslo.config (>= 1:1.2.0), python-paramiko (>= 1.8.0), python-paste, python-pastedeploy (>= 1.5.0), python-pyasn1, python-pycadf (>= 0.1.9), python-routes, python-simplejson, python-six (>= 1.5.2), python-sqlalchemy-ext (>= 0.7.8-1~) | python-sqlalchemy (<< 0.6.3-2), python-stevedore (>= 0.12), python-suds, python-webob (>= 1.2.3), sudo, python (>= 2.7), python (<< 2.8), python:any (>= 2.7.1-0ubuntu2), python-pbr, python-sqlalchemy (>= 0.8~), python-sqlalchemy (<< 0.9), python-oslo.rootwrap, python-oslo.messaging
Recommends: python-mysqldb
Suggests: python-ldap
Conflicts: python-cjson
Description: OpenStack Compute Python libraries
OpenStack is a reliable cloud infrastructure. Its mission is to produce
答案1
不知怎的,你/var/lib/dpkg/status
被破坏了。
你可以
尝试编辑该文件并手动修复它。
恢复包选择数据
如果
/var/lib/dpkg/status
由于任何原因损坏,Debian 系统会丢失软件包选择数据并遭受严重损失。在/var/lib/dpkg/status-old
或 处 查找旧的 /var/lib/dpkg/status 文件/var/backups/dpkg.status.*
。保留
/var/backups/
在单独的分区中可能是一个好主意,因为该目录包含许多重要的系统数据。如果旧
/var/lib/dpkg/status
文件不可用,您仍然可以从/usr/share/doc/
.# ls /usr/share/doc | \ grep -v [A-Z] | \ grep -v '^texmf$' | \ grep -v '^debian$' | \ awk '{print $1 " install"}' | \ dpkg --set-selections # dselect --expert # reinstall system, de-select as needed