web-dev-qa-db-fra.com

apt-get install git-core a échoué

Après avoir exécuté Sudo apt-get install git-core, je reçois

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)

J'ai donc suivi les instructions de Erreur lors de l'installation de Git avec Apt-Get mais cela n'a pas fonctionné non plus.

J'ai rencontré ceci après avoir exécuté 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 ...

À un moment donné, on m'a demandé de lancer Sudo apt-get -f install pour réparer les choses, mais il dit que cela va installer 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.

Et après avoir cliqué sur oui, l'erreur se reproduit:

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)

Pour certaines raisons, quand je fais dpgk --get-selections | grep git, je reçois:

git                                             install
git-core                                        install
git-man                                         install

Donc je suis coincé dans ce cycle. Comment puis-je le réparer?

Sur Ubuntu 10.04.4 LTS

5
resting

Essayez ceci, fonctionne pour moi la plupart du temps

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

$ cd /var/cache/apt/archives

et supprimez le fichier git qui pose problème avec les privilèges d’administrateur.

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

ou le fichier correspondant.

puis courir

$ Sudo apt-get update

et

$ Sudo apt-get install git-core

Si le problème persiste, essayez de supprimer tous les fichiers du répertoire/var/cache/apt/archives en

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

puis courir

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