web-dev-qa-db-ja.com

apt-get git-coreのインストールに失敗しました

Sudo apt-get install git-coreを実行すると、

Unpacking git-core (from .../git-core_1%3a1.7.4.1-3_all.deb) ...
Errors were encountered while processing:
 /var/cache/apt/archives/git_1%3a1.7.4.1-3_AMD64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Apt-GetでGitをインストールする際のエラー の指示に従いましたが、それでもうまくいきませんでした。

Sudo dpkg --remove --force-remove-reinstreq gitを実行した後にこれに遭遇しました:

dpkg: warning: overriding problem because --force enabled:
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
(Reading database ... 
dpkg: warning: files list file for package `git' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `git-man' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `git-core' missing, assuming package has no files currently installed.
(Reading database ... 79719 files and directories currently installed.)
Removing git ...

ある時点で、私はSudo apt-get -f installを実行して問題を修正するように求められましたが、gitをインストールすると言っています

The following extra packages will be installed:
  git
Suggested packages:
  git-doc git-el git-Arch git-cvs git-svn git-email git-daemon-run git-gui gitk gitweb
The following NEW packages will be installed:
  git
0 upgraded, 1 newly installed, 0 to remove and 480 not upgraded.
1 not fully installed or removed.
Need to get 4,658kB of archives.
After this operation, 10.9MB of additional disk space will be used.

[はい]をクリックすると、エラーが再び発生します。

Do you want to continue [Y/n]? y
Get:1 http://ubuntu.mirror.cambrium.nl/ubuntu/ natty/main git 1:1.7.4.1-3 [4,658kB]
Fetched 4,658kB in 5s (907kB/s)
Selecting previously deselected package git.
(Reading database ... 
dpkg: warning: files list file for package `git-man' missing, assuming package has no files currently installed.

dpkg: warning: files list file for package `git-core' missing, assuming package has no files currently installed.
(Reading database ... 79719 files and directories currently installed.)
Unpacking git (from .../git_1%3a1.7.4.1-3_AMD64.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_AMD64.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_AMD64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

何らかの理由で、dpgk --get-selections | grep gitを実行すると、次の結果が得られます。

git                                             install
git-core                                        install
git-man                                         install

だから私はこのサイクルで立ち往生しています。どうすれば修正できますか?

Ubuntu 10.04.4 LTSの場合

5
resting

これを試して、ほとんどの場合私のために働く

$ Sudo apt-get remove git-core
$ Sudo apt-get autoremove

$ cd /var/cache/apt/archives

管理者権限の問題を引き起こすgitファイルを削除します。

$ rm git_1%3a1.7.4.1-3_AMD64.deb

または対応するファイル。

その後、実行します

$ Sudo apt-get update

そして

$ Sudo apt-get install git-core

それでも問題が解決しない場合は、/ var/cache/apt/archives内のすべてのファイルを削除してみてください

$ Sudo rm /var/cache/apt/archives/*

そして、実行します

$ Sudo apt-get update
$ Sudo apt-get install git-core
3
shivshnkr