使用Apt-Get安装Git时出错


11

当我尝试在Ubuntu 11.04的服务器发行版上安装git时,出现错误。我使用以下命令:

sudo apt-get install git

并产生此错误:

(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)

我正在使用以下存储库:

# 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

任何人都知道发生了什么事或如何解决这个问题并安装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

现在,apt已被完全破坏。我尝试更新dpkg,因为我注意到它已经过时了。它失败了,因为它无法安装git。我尝试了apt-get清除,apt-get清理和apt-get更新。还是一样的问题。我试图删除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)

1
您能编辑您的问题并添加“ apt-cache policy dpkg”的输出吗?
ajmitch

@ajmitch完成。
丹尼尔·宾汉

我必须等多久才能开始悬赏这个问题?我真的需要对这个相当早的答案:(
丹尼尔·宾汉

您的问题似乎是因为您进行了清楚的安装,但正在尝试从
natty

@ajmitch哦,你知道吗?我前一段时间确实做到了。我需要包含在natty存储库中的vim的升级版本,而不是清晰的,并且我不想处理完整的更新。谢谢你提醒我!
丹尼尔·宾汉

Answers:


5

以防万一:是的apt-get install git-core,不只是apt-get install git


1
我不确定何时更改,但是git也应该起作用,而不仅仅是git-core。当然,git包确实是git
Hamish Downer'2

从10.04开始,我不得不这样做git-core,否则我得到了相同的错误消息。
马克·安德烈·阿佩尔

不,同样的错误。
丹尼尔·宾厄姆

描述为git-core“过时”。
Louis Waweru

1
最初,该git软件包用于GNU交互式工具,直到没人真正使用。如今,git指的是Git VCS,git-core已被弃用。
约尔格W¯¯米塔格

5

好吧,我已经解决了。我必须手动删除软件包,然后强制dpkg清除自身。之后,我从git-core安装了它,效果很好。要手动删除我去过的包裹

/var/cache/apt/archives

并删除git_1%3a1.7.4.1-3_i386.deb文件。之后我去了

/var/lib/dpkg/info

并做了ls | grep git并删除了所有出现的内容。之后,我跑了

sudo dpkg --remove --force-remove-reinstreq git

清洁包装的dpkg。一旦完成,我就可以从中安装git git-core而不是从git软件包中安装它,并且一切正常。


我遇到了同样的问题,这也为我解决了。
约翰·菲亚拉
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.