apt-get install git-core failed

11,382

Try this, works for me most of the time

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

$ cd /var/cache/apt/archives

and remove the git file that gives problem with adminstrator privileges.

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

or the corresponding file.

then run

$ sudo apt-get update

and

$ sudo apt-get install git-core

If still problem persists, try removing all the files in the /var/cache/apt/archives by

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

and then run

$ sudo apt-get update
$ sudo apt-get install git-core
Share:
11,382

Related videos on Youtube

resting
Author by

resting

Updated on September 18, 2022

Comments

  • resting
    resting over 1 year

    After running sudo apt-get install git-core, I get

    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)
    

    So I followed the instructions from Error Installing Git with Apt-Get but that didn't work either.

    I encountered this after running 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 ...
    

    At some point I was asked to run sudo apt-get -f install to fix things but it's saying its going to 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.
    

    And after clicking yes, the error occurs again:

    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)
    

    For some reasons, when I do dpgk --get-selections | grep git, I get:

    git                                             install
    git-core                                        install
    git-man                                         install
    

    So I'm stuck in this cycle. How can I fix it?

    On Ubuntu 10.04.4 LTS

    • Admin
      Admin over 11 years
      try sudo dpkg --configure -a from your terminal
    • Admin
      Admin about 11 years
      files list file for package 'git-core' missing makes me shiver. Somehow the DPKG database (in this case it's either the list of files or the packages status) has become corrupted. This does not occur by itself and I think you're looking at a glitch in the direction of disk corruption, unclean killed apt/dpkg operations, manual edit to the /var/lib/dpkg directory, etc.
    • Admin
      Admin about 11 years
      Thanks for the suggestions, but a team member solved the problem for me. not exactly sure what he did, but I believe he removed the package and reinstall through lucid repo instead of nutty which he said it was on previously.