Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I attempt to install git on a server distribution of Ubuntu 11.04, I get an error. I used the following command:

sudo apt-get install git

And that generated this error:

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

I'm using the following repositories:

# 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

Anyone have any idea what's going on or how I can fix this and get git to install?

[edit] Here's the output of apt-cache policy 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

And now apt is completely broken. I attempted to update dpkg, because I noticed that it was a couple versions out of date. It failed because it couldn't install git. I attempted apt-get purge, apt-get clean and apt-get update. Still the same problem. I attempted to remove git and got this:

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)
share|improve this question
1  
Can you please edit your question & add the output of 'apt-cache policy dpkg'? –  ajmitch Feb 1 '12 at 21:42
    
@ajmitch It is done. –  Daniel Bingham Feb 2 '12 at 16:55
    
How long do I have to wait before I can start a bounty for this question? I really need an answer to this rather soonish :( –  Daniel Bingham Feb 2 '12 at 19:10
    
Your problems look to be because you have a lucid install, but are trying to install packages from natty (without upgrading to maverick in between) –  ajmitch Feb 2 '12 at 19:44
    
@ajmitch Oh you know what? I did do that a while back. I needed upgraded version of vim that was in the natty repository but not the lucid one and I didn't want to deal with a full update. Thanks for reminding me! –  Daniel Bingham Feb 2 '12 at 20:54
add comment

2 Answers

up vote 3 down vote accepted

Alright, I got it fixed. I had to manually remove the package and then force dpkg to clear itself. Afterwards I installed it from git-core and that worked fine. To manually remove the package I went to

/var/cache/apt/archives

And removed git_1%3a1.7.4.1-3_i386.deb file. After that I went to

/var/lib/dpkg/info

And did an ls | grep git and removed everything that turned up. Afterwards, I ran

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

To clean dpkg of the package. Once that was done I was able to install git from git-core instead of the git package and it worked just fine.

share|improve this answer
    
I ran into the same problem and this fixed it for me as well. –  John Fiala Jun 28 '12 at 2:26
add comment

Just in case: it is apt-get install git-core, not just apt-get install git.

share|improve this answer
1  
I'm not sure when it changed, but git should also work, not just git-core. Certainly in natty, the git package really is git –  Hamish Downer Feb 1 '12 at 22:12
    
Since 10.04 I had to do git-core, else I got the same error message. –  Marc-André Appel Feb 1 '12 at 22:13
    
Nope, same error. –  Daniel Bingham Feb 2 '12 at 16:56
    
The description for git-core says "obsolete". –  Louis May 29 '13 at 3:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.