Не удалось запустить команду Sudo apt-get update? Пожалуйста, подскажите, как разрешить его на Ubuntu 16.04? [dубликат]

я просто установил Ubuntu с GNOME 16.04. Я сказал это, чтобы сохранить Мои документы - которые работали. Некоторые программы пришлось переустановить. Теперь когда я запускаю sudo apt-get update я вижу это:

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

есть ли автоматизированный способ исправить это?

84
задан 29 January 2018 в 09:04

4 ответа

Недавнее, актуальное решение

Я написал сценарий Python для автоматизации этой задачи. Вы можете найти самую последнюю версию здесь.

Установка:

Установите предварительные условия: sudo apt install python3-apt Загрузите пакет ZIP (aptsources-cleanup.zip) из последней версии.

Использование:

Установите предварительные условия: sudo apt install python3-apt

Установите предварительные условия:

Историческое, устаревшее решение

Следуйте инструкциям, появляющимся на экране.

#!/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.')

Это более старая, более короткая и более простая версия, более подходящая для встроенной цитаты: [ ! d19]

Он не принимает никаких параметров и работает на всех /etc/apt/sources.list* с помощью пакета python3-apt. Строки не обязательно должны быть точными дубликатами (даже после нормализации), но его достаточно, если тип, URI, набор и по крайней мере один компонент перекрываются.

111
ответ дан 18 July 2018 в 03:59

последнее, вплоть до даты решения

я написал скрипт на Python, чтобы автоматизировать эту задачу. Вы можете найти самую последнюю версию здесь.

монтаж

:

установить предпосылки: sudo apt install python3-apt скачать пакет zip (aptsources-cleanup.zip) из последнего выпуска.

использование:

установить предпосылки: sudo apt install python3-apt

установить предпосылки:

[dиода d17][!dиода d17]

историческое, устаревшее решение

следуйте инструкциям, появляющимся на экране.

#!/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.')

это старый, короткий и простой вариант больше подходит для встроенного Цитата:

он не принимает никаких параметров и работает на всех /etc/apt/sources.list* с помощью пакета python3-apt. Линии не обязательно должны быть точной копией (даже после нормализации), но его достаточно если типа, Ури, Свит и по меньшей мере один компонент перекрываются.

111
ответ дан 24 July 2018 в 17:58

Сбросьте свои репозитории, подобные этому

sudo rm /etc/apt/sources.list sudo software-properties-gtk Выберите ваши варианты Сохранить

(PS У меня была такая же проблема сегодня после обновления Ubuntu 15.10 до Ubuntu 16.04.) [ ! d7]

22
ответ дан 18 July 2018 в 03:59

Сбросьте свои репозитории, подобные этому

sudo rm /etc/apt/sources.list sudo software-properties-gtk Выберите ваши варианты Сохранить

(PS У меня была такая же проблема сегодня после обновления Ubuntu 15.10 до Ubuntu 16.04.) [ ! d7]

22
ответ дан 24 July 2018 в 17:58
  • 1
    Я просил автоматизированный метод. – Tim 6 November 2016 в 14:58
  • 2
    это лучшее решение, чем чтение иностранный сценарий питон3 перед его выполнением... работал отлично – Max 28 August 2017 в 15:06
  • 3
    Это хороший ответ! Отлично работал для меня – haksayng 6 November 2017 в 21:02
  • 4
    Можете ли вы удалить «дубликаты»? которые имеют другой тип? Например, у меня есть http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main и http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main (source code). Сохраняется ли удаление (исходный код) один (этот флажок не установлен, в отличие от другого)? – Deruijter 1 March 2018 в 14:02
  • 5
    @Deruijter: Не могли бы вы открыть новый вопрос , если у вас есть новый или последующий вопрос? Раздел комментариев не подходит или предназначен для новых вопросов или расширенного обсуждения. Вы можете отправить мне комментарий с уведомлением, чтобы привлечь мое внимание к нему. Благодарю. – David Foerster 13 June 2018 в 21:07

Другие вопросы по тегам:

Похожие вопросы: