当我尝试在 Ubuntu 11.04 的服务器分发版上安装 git 时,出现错误。我使用了以下命令:
sudo apt-get install git
Run Code Online (Sandbox Code Playgroud)
这产生了这个错误:
(Reading database ...
dpkg: warning: files list file for package `git' missing, assuming package has no files currently installed.
(Reading database ... 20310 files and directories currently installed.)
Preparing to replace git 1:1.7.4.1-3 (using .../git_1%3a1.7.4.1-3_i386.deb) ...
/var/lib/dpkg/tmp.ci/preinst: 12: dpkg-maintscript-helper: not found
dpkg: error processing /var/cache/apt/archives/git_1%3a1.7.4.1-3_i386.deb (--unpack):
subprocess new pre-installation script returned error exit status 127
/var/lib/dpkg/tmp.ci/postrm: 14: dpkg-maintscript-helper: not found
dpkg: error while cleaning up:
subprocess new post-removal script returned error exit status 127
Errors were encountered while processing:
/var/cache/apt/archives/git_1%3a1.7.4.1-3_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
我正在使用以下存储库:
# deb cdrom:[Ubuntu 8.04.3 _Hardy Heron_ - Release i386 (20090713.1)]/ hardy main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ natty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ natty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ natty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ natty-updates main restricted
## main & restricted repositories
# deb http://us.archive.ubuntu.com/ubuntu/ lucid main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ lucid main restricted
#deb http://security.ubuntu.com/ubuntu lucid-security main restricted
#deb-src http://security.ubuntu.com/ubuntu lucid-security main restricted
## universe repositories
#deb http://us.archive.ubuntu.com/ubuntu/ lucid universe
#deb-src http://us.archive.ubuntu.com/ubuntu/ lucid universe
#deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe restricted main
#deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe
#deb http://security.ubuntu.com/ubuntu lucid-security universe
#deb-src http://security.ubuntu.com/ubuntu lucid-security universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://us.archive.ubuntu.com/ubuntu/ natty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ natty universe
deb http://us.archive.ubuntu.com/ubuntu/ natty-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ natty-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ natty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ natty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ natty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ natty-updates multiverse
Run Code Online (Sandbox Code Playgroud)
任何人都知道发生了什么或者我如何解决这个问题并安装git?
[编辑] 这是 apt-cache 策略 dpkg 的输出:
dpkg:
Installed: 1.15.5.6ubuntu4
Candidate: 1.16.0~ubuntu7.1
Version table:
1.16.0~ubuntu7.1 0
500 http://us.archive.ubuntu.com/ubuntu/ natty-updates/main Packages
1.16.0~ubuntu7 0
500 http://us.archive.ubuntu.com/ubuntu/ natty/main Packages
*** 1.15.5.6ubuntu4 0
100 /var/lib/dpkg/status
Run Code Online (Sandbox Code Playgroud)
现在 apt 完全坏了。我试图更新 dpkg,因为我注意到它有几个版本已经过时了。它失败了,因为它无法安装 git。我尝试了 apt-get purge、apt-get clean 和 apt-get update。还是一样的问题。我试图删除 git 并得到这个:
Removing git-core ...
dpkg: error processing git (--remove):
Package is in a very bad inconsistent state - you should
reinstall it before attempting a removal.
Errors were encountered while processing:
git
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
好的,我搞定了。我必须手动删除包,然后强制 dpkg 自行清除。之后我从 git-core 安装了它并且运行良好。要手动删除我去的包
/var/cache/apt/archives
Run Code Online (Sandbox Code Playgroud)
并删除git_1%3a1.7.4.1-3_i386.deb文件。之后我去了
/var/lib/dpkg/info
Run Code Online (Sandbox Code Playgroud)
并ls | grep git删除了所有出现的内容。后来我跑了
sudo dpkg --remove --force-remove-reinstreq git
Run Code Online (Sandbox Code Playgroud)
清理包的dpkg。一旦完成,我就可以安装 gitgit-core而不是git包,它工作得很好。
| 归档时间: |
|
| 查看次数: |
25480 次 |
| 最近记录: |