所以我的问题很容易描述:我无法在我的Ubuntu安装中安装任何东西。在尝试修复其他一些软件包错误后,
让我试着解释一下我是如何陷入这种情况的...
我正在尝试安装
这就是那个Python脚本:
现在当我尝试通过`sudo apt-get install maven`来安装`maven`时(我怀疑是`maven2`导致这些错误,所以只尝试`maven`),我收到了以下错误信息:
``` 下载并安装 49.5 MB 的文件,用时 2 分 7 秒 (387 kB/s): 处理软件包 dpkg 时出错: ⠀软件包 dpkg 尚未准备好进行配置 无法配置(当前状态为 `half-installed') 处理过程中有错误发生: ⠀dpkg E: 子进程 /usr/bin/dpkg 返回错误代码(1) ```
还有其他一些我目前记不起来的`apt-get`命令会输出更长的错误。如果我再次遇到它们,我会更新这个问题。
我应该如何解决这个问题呢?
apt-get
停止工作了。现在我束手无策。让我试着解释一下我是如何陷入这种情况的...
我正在尝试安装
maven2
。我运行了sudo apt-get install maven2
,但没有成功。它告诉我git-core
缺少末尾的换行符。所以我查找了这个错误并尝试修复它。结果我找到了一个Python脚本,可以在/var/lib/dpkg/info
目录下的文件中添加换行符。这时候一切都变得更糟了...什么都无法正常工作,错误也更多了!这就是那个Python脚本:
import os
dpkg_path = '/var/lib/dpkg/info/'
paths = os.listdir(dpkg_path)
for path in paths:
path = dpkg_path + path
f = open(path, 'a+')
data = f.read()
if len(data) > 1 and data[-1:] != '\n':
f.write('\n')
print 'added newline character to:', path
f.close()
现在当我尝试通过`sudo apt-get install maven`来安装`maven`时(我怀疑是`maven2`导致这些错误,所以只尝试`maven`),我收到了以下错误信息:
``` 下载并安装 49.5 MB 的文件,用时 2 分 7 秒 (387 kB/s): 处理软件包 dpkg 时出错: ⠀软件包 dpkg 尚未准备好进行配置 无法配置(当前状态为 `half-installed') 处理过程中有错误发生: ⠀dpkg E: 子进程 /usr/bin/dpkg 返回错误代码(1) ```
还有其他一些我目前记不起来的`apt-get`命令会输出更长的错误。如果我再次遇到它们,我会更新这个问题。
我应该如何解决这个问题呢?
编辑
我按照评论部分的要求做了(尝试安装 maven
然后运行 sudo apt-get install -f
),这是终端的完整输出:
bash: /etc/bash_completion.d/git: No such file or directory
dugi@Dugi:~$ sudo apt-get install maven
[sudo] password for dugi:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libantlr-java libcommons-validator-java libdoxia-sitetools-java
libjdependency-java libmaven-archiver-java libmaven-clean-plugin-java
libmaven-compiler-plugin-java libmaven-dependency-tree-java
libmaven-filtering-java libmaven-install-plugin-java
libmaven-jar-plugin-java libmaven-plugin-tools-java
libmaven-reporting-impl-java libmaven-resources-plugin-java
libmaven-shade-plugin-java libplexus-compiler-java libplexus-digest-java
libplexus-velocity-java libwerken.xpath-java velocity
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libaether-java libaopalliance-java libasync-http-client-java libcdi-api-java
libcglib-java libgeronimo-interceptor-3.0-spec-java libguice-java
libjackrabbit-java libjcommander-java libmaven-parent-java libnetty-java
libplexus-classworlds2-java libplexus-cli-java libplexus-containers1.5-java
libplexus-utils2-java libsisu-guice-java libsisu-ioc-java libwagon2-java
libyaml-snake-java testng
Suggested packages:
libaopalliance-java-doc libasync-http-client-java-doc libjcommander-java-doc
libplexus-classworlds2-java-doc libplexus-cli-java-doc
libplexus-utils2-java-doc
The following NEW packages will be installed:
libaether-java libaopalliance-java libasync-http-client-java libcdi-api-java
libcglib-java libgeronimo-interceptor-3.0-spec-java libguice-java
libjackrabbit-java libjcommander-java libmaven-parent-java libnetty-java
libplexus-classworlds2-java libplexus-cli-java libplexus-containers1.5-java
libplexus-utils2-java libsisu-guice-java libsisu-ioc-java libwagon2-java
libyaml-snake-java maven testng
0 upgraded, 21 newly installed, 0 to remove and 129 not upgraded.
78 not fully installed or removed.
Need to get 0 B/49.5 MB of archives.
After this operation, 12.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: error processing package dpkg (--configure):
package dpkg is not ready for configuration
cannot configure (current status `half-installed')
Errors were encountered while processing:
dpkg
E: Sub-process /usr/bin/dpkg returned an error code (1)
dugi@Dugi:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fop java-wrappers libantlr-java libatinject-jsr330-api-java libbatik-java
libclassworlds-java libcommons-configuration-java libcommons-io-java
libcommons-jexl2-java libcommons-jxpath-java libcommons-net2-java
libcommons-validator-java libcommons-vfs-java libdom4j-java libdoxia-java
libdoxia-sitetools-java libfop-java libganymed-ssh2-java libguava-java
libhttpclient-java libhttpcore-java libitext1-java libjaxen-java
libjdependency-java libjdom1-java libjetty-java libjsoup-java libjsr305-java
libmaven-archiver-java libmaven-clean-plugin-java
libmaven-compiler-plugin-java libmaven-dependency-tree-java
libmaven-filtering-java libmaven-install-plugin-java
libmaven-jar-plugin-java libmaven-plugin-tools-java
libmaven-reporting-impl-java libmaven-resources-plugin-java
libmaven-scm-java libmaven-shade-plugin-java libmaven2-core-java
libmodello-java libnetbeans-cvsclient-java libplexus-ant-factory-java
libplexus-archiver-java libplexus-bsh-factory-java libplexus-build-api-java
libplexus-cipher-java libplexus-classworlds-java libplexus-compiler-java
libplexus-container-default-java libplexus-containers-java
libplexus-digest-java libplexus-i18n-java libplexus-interactivity-api-java
libplexus-interpolation-java libplexus-io-java libplexus-sec-dispatcher-java
libplexus-utils-java libplexus-velocity-java libqdox-java libslf4j-java
libwagon-java libwerken.xpath-java libxbean-java libxmlgraphics-commons-java
libxpp2-java libxpp3-java velocity
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 129 not upgraded.
78 not fully installed or removed.
Need to get 0 B/41.3 MB of archives.
After this operation, 0 B of additional disk space will be used.
dpkg: error processing package dpkg (--configure):
package dpkg is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libbsh-java (--configure):
package libbsh-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package bsh (--configure):
package bsh is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libjaxp1.3-java (--configure):
package libjaxp1.3-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libxalan2-java (--configure):
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
package libxalan2-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libbsf-java (--configure):
package libbsf-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libavalon-framework-java (--configure):
package libavalon-framework-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libcommons-io-java (--configure):
package libcommons-io-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package java-wrappers (--configure):
package java-wrappers is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libbatik-java (--configure):
package libbatik-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libxmlgraphNo apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
ics-commons-java (--configure):
package libxmlgraphics-commons-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libfop-java (--configure):
package libfop-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package fop (--configure):
package fop is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libantlr-java (--configure):
package libantlr-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libatinject-jsr330-api-java (--configure):
package libatinject-jsr330-api-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libclassworlds-java (--configure):
package libclassworlds-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: erNo apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
ror processing package libcommons-configuration-java (--configure):
package libcommons-configuration-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libcommons-jexl2-java (--configure):
package libcommons-jexl2-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libcommons-jxpath-java (--configure):
package libcommons-jxpath-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libcommons-net2-java (--configure):
package libcommons-net2-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libcommons-validator-java (--configure):
package libcommons-validator-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libcommons-vfs-java (--configure):
package libcommNo apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
ons-vfs-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libjaxen-java (--configure):
package libjaxen-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libxpp2-java (--configure):
package libxpp2-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libxpp3-java (--configure):
package libxpp3-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libdom4j-java (--configure):
package libdom4j-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libhttpcore-java (--configure):
package libhttpcore-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libhttpclient-java (--configure):
package libhNo apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
ttpclient-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libitext1-java (--configure):
package libitext1-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package liblog4j1.2-java (--configure):
package liblog4j1.2-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libplexus-interpolation-java (--configure):
package libplexus-interpolation-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libplexus-utils-java (--configure):
package libplexus-utils-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libplexus-container-default-java (--configure):
package libplexus-container-default-java is not ready for configuration
cannot configure (current status `half-inNo apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
stalled')
dpkg: error processing package libjsr305-java (--configure):
package libjsr305-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libguava-java (--configure):
package libguava-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libplexus-classworlds-java (--configure):
package libplexus-classworlds-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libxbean-java (--configure):
package libxbean-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libplexus-containers-java (--configure):
package libplexus-containers-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libplexus-i18n-java (--configure):
package libplexus-i18n-java is not ready for conNo apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
figuration
cannot configure (current status `half-installed')
dpkg: error processing package libdoxia-java (--configure):
package libdoxia-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libexcalibur-logkit-java (--configure):
package libexcalibur-logkit-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libjdom1-java (--configure):
package libjdom1-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libwerken.xpath-java (--configure):
package libwerken.xpath-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package velocity (--configure):
package velocity is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libplexus-velocity-java (--configure):
package libplexuNo apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
s-velocity-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libdoxia-sitetools-java (--configure):
package libdoxia-sitetools-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libganymed-ssh2-java (--configure):
package libganymed-ssh2-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libjdependency-java (--configure):
package libjdependency-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libslf4j-java (--configure):
package libslf4j-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libjetty-java (--configure):
package libjetty-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: error processing package libjsoup-java (--configure):
package libjsoup-java is not ready for configuration
cannot configure (current status `half-installed')
dpkg: too many errors, stopping
Errors were encountered while processing:
dpkg
libbsh-java
bsh
libjaxp1.3-java
libxalan2-java
libbsf-java
libavalon-framework-java
libcommons-io-java
java-wrappers
libbatik-java
libxmlgraphics-commons-java
libfop-java
fop
libantlr-java
libatinject-jsr330-api-java
libclassworlds-java
libcommons-configuration-java
libcommons-jexl2-java
libcommons-jxpath-java
libcommons-net2-java
libcommons-validator-java
libcommons-vfs-java
libjaxen-java
libxpp2-java
libxpp3-java
libdom4j-java
libhttpcore-java
libhttpclient-java
libitext1-java
liblog4j1.2-java
libplexus-interpolation-java
libplexus-utils-java
libplexus-container-default-java
libjsr305-java
libguava-java
libplexus-classworlds-java
libxbean-java
libplexus-containers-java
libplexus-i18n-java
libdoxia-java
libexcalibur-logkit-java
libjdom1-java
libwerken.xpath-java
velocity
libplexus-velocity-java
libdoxia-sitetools-java
libganymed-ssh2-java
libjdependency-java
libslf4j-java
libjetty-java
libjsoup-java
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
dugi@Dugi:~$
sudo apt-get install maven
命令进行安装,如果失败,请尝试使用sudo apt-get install -f
命令并提供结果。请以usr@host:$ sudo apt-get install ....
的格式发布内容,以便我们查看完整输出。 - Mitchsudo dpkg --configure -a
和再次运行sudo apt-get install -f
的结果吗? - Mitchsudo dpkg --configure -a
时,我收到以下消息:dugi@Dugi:~/Desktop$ sudo dpkg --configure -a dpkg: error: corrupt info database format file '/var/lib/dpkg/info/format'
. - aborted