Kesalahan Menginstal Git dengan Apt-Get

11

Ketika saya mencoba menginstal git pada distribusi server Ubuntu 11.04, saya mendapatkan kesalahan. Saya menggunakan perintah berikut:

sudo apt-get install git

Dan itu menghasilkan kesalahan ini:

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

Saya menggunakan repositori berikut:

# 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

Adakah yang tahu apa yang terjadi atau bagaimana saya bisa memperbaikinya dan meminta git untuk menginstal?

[sunting] Berikut ini adalah keluaran dari kebijakan cache-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

Dan sekarang apt benar-benar rusak. Saya mencoba memperbarui dpkg, karena saya perhatikan bahwa itu beberapa versi yang ketinggalan zaman. Gagal karena tidak bisa menginstal git. Saya mencoba pembersihan apt-get, apt-get clean, dan apt-get update. Masih masalah yang sama. Saya mencoba menghapus git dan mendapatkan ini:

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)
Daniel Bingham
sumber
1
Bisakah Anda mengedit pertanyaan Anda & menambahkan output 'kebijakan apt-cache dpkg'?
ajmitch
@ajmitch Sudah selesai.
Daniel Bingham
Berapa lama saya harus menunggu sebelum saya dapat memulai hadiah untuk pertanyaan ini? Aku benar-benar butuh jawaban untuk :( agak soonish ini
Daniel Bingham
Masalah Anda tampaknya karena Anda memiliki instalasi yang jelas, tetapi mencoba untuk menginstal paket dari natty (tanpa meningkatkan ke maverick di antaranya)
ajmitch
@ajmitch Oh, Anda tahu? Saya melakukan itu beberapa waktu lalu. Saya membutuhkan versi peningkatan vim yang ada di repositori yang bagus tapi bukan yang jelas dan saya tidak ingin berurusan dengan pembaruan penuh. Terima kasih sudah mengingatkan saya!
Daniel Bingham

Jawaban:

5

Untuk jaga-jaga: itu apt-get install git-core, bukan hanya apt-get install git.

Marc-André Appel
sumber
1
Saya tidak yakin kapan itu berubah, tetapi git juga harus bekerja, bukan hanya git-core. Tentunya dengan rapi, paket git benar-benar git
Hamish Downer
Sejak 10,04 yang harus saya lakukan git-core, kalau tidak saya mendapat pesan kesalahan yang sama.
Marc-André Appel
Tidak, kesalahan yang sama.
Daniel Bingham
Deskripsi untuk git-coremengatakan "usang".
Louis Waweru
1
Awalnya, gitpaket itu untuk Alat Interaktif GNU, yang sebenarnya tidak ada yang menggunakan. Saat ini, gitmengacu pada Git VCS, dan git-coresudah usang.
Jörg W Mittag
5

Baiklah, saya sudah memperbaikinya. Saya harus menghapus paket secara manual dan kemudian memaksa dpkg untuk menghapus sendiri. Setelah itu saya menginstalnya dari git-core dan itu bekerja dengan baik. Untuk menghapus secara manual paket yang saya kunjungi

/var/cache/apt/archives

Dan menghapus git_1%3a1.7.4.1-3_i386.debfile. Setelah itu saya pergi ke

/var/lib/dpkg/info

Dan melakukan ls | grep gitdan menghapus semua yang muncul. Setelah itu, saya berlari

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

Untuk membersihkan dpkg paket. Setelah selesai saya bisa menginstal git dari git-corepada gitpaket dan itu bekerja dengan baik.

Daniel Bingham
sumber
Saya mengalami masalah yang sama dan ini memperbaikinya untuk saya juga.
John Fiala