好吧,举个例子。假设有人做了一些愚蠢的事情,试图跟随http://www.ewan.cc/?q=node/90但事实证明他无法遵循简单的指南。
在此过程中发生了一些错误,有人试图通过调用 apt-get upgrade 来恢复。因此发生了以下情况:
root@srv028:~# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
initscripts : Depends: sysv-rc or
file-rc but it is not installed
systemd : Depends: sysv-rc
Recommends: libpam-systemd but it is not installed
E: Unmet dependencies. Try using -f.
root@srv028:~# apt-get upgrade -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
Calculating upgrade... Done
The following NEW packages will be installed:
sysv-rc
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/82.8 kB of archives.
After this operation, 128 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Preconfiguring packages ...
/usr/bin/dpkg-split: 1: /usr/bin/dpkg-split: Syntax error: "(" unexpected
E: Sub-process /usr/bin/dpkg exited unexpectedly
root@srv028:~#
这个人将如何解决这个问题?
(PS,这个人显然不是我)
答案1
错误发生在包重新配置阶段,您使用的包不是下载的包而是缓存的版本:
The following NEW packages will be installed:
sysv-rc
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/82.8 kB of archives.
After this operation, 128 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Preconfiguring packages ...
请注意,系统需要获取“82.8 kBytes 中的 0 个字节”。
我怀疑那 82.8 kBytes 已经损坏,并且 dpkg-split 在尝试对其中一个进行解析时发生阻塞。
因此,尝试删除缓存的包:
apt-get clean; apt-get autoclean
答案2
删除 dpkg
rm /usr/bin/dpkg*
重新编译 dpkg
wget tarball,extract && ./configure; make and install
替换 dpkg-*
cp /usr/src/DPKG/bin/dpkg-* /usr/bin
从 .deb-packege 重新安装 apt
dpkg -i apt*.deb && apt-get update; apt-get -f install