Apt hatasını “W: Hedef Paketler… birçok kez yapılandırılmış” olarak nasıl düzeltebilirim?


127

Ubuntu Gnome 16.04'ü yeni yükledim. Belgelerimi kaydetmesini söyledim - işe yaradı. Bazı yazılımların yeniden yüklenmesi gerekiyordu. Şimdi kaçtığımda sudo apt-get updateşunu görüyorum:

W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (restricted/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: The repository 'http://extras.ubuntu.com/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: http://dl.google.com/linux/chrome/deb/dists/stable/Release.gpg: Signature by key 4CCA1EAF950CEE4AB83976DCA040830F7FAC5991 uses weak digest algorithm (SHA1)
W: http://repo.sinew.in/dists/stable/InRelease: Signature by key B6DA722E2E65721AF54B93966F7565879798C2FC uses weak digest algorithm (SHA1)
E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/source/Sources  404  Not Found [IP: 91.189.92.152 80]
E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found [IP: 91.189.92.152 80]
E: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/xenial/main/binary-i386/Packages  404  Not Found [IP: 91.189.92.152 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (restricted/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87
W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:33 and /etc/apt/sources.list:87

Bunu düzeltmenin otomatik bir yolu var mı?

Yanıtlar:


161

En yeni, güncel çözüm

Bu görevi otomatikleştirmek için bir Python betiği yazdım. Sen bulabilirsiniz Burada en son sürümünü .

Kurulum:

  1. Önkoşulları yükleyin:

    sudo apt install python3-apt
    
  2. ZIP paketini ( aptsources-cleanup.zip) en son sürümden indirin .

Kullanımı:

  1. ZIP paketinin indirme konumundan (yukarıdaki 2. adıma bakın) çalıştırın:

    sudo python3 -OEs aptsources-cleanup.zip
    
  2. Ekrandaki talimatları izleyin.

Bir sorunu bildirmek , yorum yapmak ya da kaynak kodunu yazmak istiyorsanız, lütfen GitHub’da yapın .


Tarihsel, modası geçmiş çözüm

Bu, satır içi teklife daha uygun, daha eski, daha kısa ve daha basit bir versiyondur:

#!/usr/bin/env python3
"""
Detects and interactively deactivates duplicate Apt source entries.

Usage: sudo python3 apt-remove-duplicate-source-entries.py
"""

from __future__ import print_function
import aptsources.sourceslist

EMPTY_COMPONENT_LIST = (None,)

def get_duplicates(sourceslist):
    """
    Detects and returns duplicate Apt source entries.
    """

    sentry_map = dict()
    duplicates = list()
    for se in sourceslist.list:
        if not se.invalid and not se.disabled:
            for c in (se.comps or EMPTY_COMPONENT_LIST):
                key = (se.type, se.uri, se.dist, c)
                previous_se = sentry_map.setdefault(key, se)
                if previous_se is not se:
                    duplicates.append((se, previous_se))
                    break

    return duplicates


if __name__ == '__main__':
    try:
        input = raw_input
    except NameError:
        pass

    sourceslist = aptsources.sourceslist.SourcesList(False)
    duplicates = get_duplicates(sourceslist)

    if duplicates:
        for dupe, orig in duplicates:
            print(
                'Overlapping source entries:\n'
                '  1. {0}: {1}\n'
                '  2. {2}: {3}\n'
                'I disabled the latter entry.'.format(
                    orig.file, orig, dupe.file, dupe),
                end='\n\n')
            dupe.disabled = True

        print('\n{0} source entries were disabled:'.format(len(duplicates)),
            *[dupe for dupe, orig in duplicates], sep='\n  ', end='\n\n')
        if input('Do you want to save these changes? (y/N) ').upper() == 'Y':
            sourceslist.save()

    else:
        print('No duplicated entries were found.')

Hiçbir parametre almaz ve tüm paket /etc/apt/sources.list*yardımı ile çalışır python3-apt. Satırların tam kopyaları olması gerekmez (normalizasyondan sonra bile) ancak tür, URI, paket ve en az bir bileşen üst üste bindiğinde yeterlidir.

Eşitlik testinin tüm köşe durumlarda (örneğin, çeşitli “seçenek” dizileri) doğru olduğundan emin değilim.


Terminalden, " github.com/davidfoerster/aptsources-cleanup/releases/download/… " komutunu kullanarak indirebilirsiniz
Sami

@Sami: Şu anda evet, ama başka bir sürüm yaptığımda artık en son sürüm olmayacak.
David Foerster

ubuntu 18.04 kullanıcı: çekicilik gibi çalışır. teşekkürler dostum.
Ali,

osboxes @ osboxes: /etc/apt/sources.list.d$ sudo python3 -OEs aptsources-cleanup.zip python3: 'aptsources-cleanup.zip' dosyasını açamıyor: [Errno 2] Böyle bir dosya veya dizin yok
Toolkit

@Toolkit: Kullanım talimatlarını gözden geçirdim. Lütfen onları okuyun ve tekrar deneyin. Açıklık olmadığı için özür dilerim.
David Foerster

79

Benim için (16.04 LTS)

Sistem ayarları >> Yazılım ve Güncellemeler >> Diğer Yazılımlar ve çift girişlerin listeden çıkarılması iyi sonuç verdi.


6
Otomatik bir yöntem istiyordum.
Tim

17
bu çalıştırmadan önce yabancı python3 senaryosunu okumaktan daha iyi bir çözüm ... mükemmel çalıştı
Max

2
Farklı türde olan "kopyaları" silebilir misiniz? Mesela http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial mainve var http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main (source code). Birini (kaynak kodunu) silmek (bu biri diğerine zıt olarak kontrol edilmez) saklanıyor mu?
Deruijter

1
@Tim doğru, ancak çoğu kişinin bu soruya gelmesinin nedeni bu değil
Joel Berkeley

2
@Deruijter "Kaynak kod" yazan bir diğerinin kopyası olarak kabul edilmez. Bununla birlikte, bazı paketleri kendi başlarına derlemek için kaynak kodunu indirmek istemediğiniz sürece, "kaynak kod" diyene ihtiyacınız yoktur.
mchid

31

Depolarınızı bu şekilde sıfırlayın

  1. sudo rm /etc/apt/sources.list
  2. sudo software-properties-gtk
  3. Seçeneklerinizi seçin
  4. Kayıt etmek

(PS Ubuntu 15.10’u Ubuntu 16.04’e yükselttikten sonra bugün aynı sorunu yaşadım.)


Bunu, yalnızca software-properties-gtksisteminizde kurulu olduğundan emin olduktan sonra kontrol etmeniz gerektiğine dikkat edin . Bana bunu yazmamı neyin sağladığını sorma.
Miloš Đakonović

5

Hatalar size sorunun nerede olduğunu ve tüm sorunların tek bir kopya satırdan kaynaklandığını söylediğinden, bunu manuel olarak vim, nano, vb. Gibi bir metin editörü ile kolayca düzeltebilirsiniz. problem nedir ve düzeltmek için ne yapıyorsunuz?

Senin durumunda, sudo veya root olarak, /etc/apt/sources.list dosyasını bir metin editöründe açın. Satır 33'ü veya satır 87'yi silin. Önce kopya olduklarını görsel olarak kontrol edebilirsiniz.

Vim'den hoşlanıyorsan ...

$ sudo vim /etc/apt/sources.list
33 [Shift]+g    # to goto line 33
87 [Shift]+g    # to goto line 87, don't need a duplicate of line 33
dd              # to delete the line you're on
:wq             # to write the file and quit

Ya da bir hata yaparsanız çıkmak için ...

:q!             # to quit without saving any changes

4

Linux nane içeren Ubuntu tabanlı sistemler için, Yazılım Kaynakları> Bakım> Çoğaltılmış paketleri kaldır seçeneğine gidin.


Bunu yaparken hiçbir yinelenen bulunamadı, ancak yine de aynı hatayı görüyorum
cipricus
Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.