Я только что установил 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
Есть ли автоматизированный способ исправить это?
Я написал сценарий Python для автоматизации этой задачи. Самую последнюю версию можно найти здесь .
Установите необходимые компоненты:
sudo apt install python3-apt
Загрузите пакет PYZ ( aptsources-cleanup.pyz
) из последней версии .
Отметьте пакет PYZ как исполняемый файл:
chmod a + x apts- cleanup.pyz
Из места загрузки пакета PYZ (см. Шаг 2 выше) запустите:
sudo ./aptsources-cleanup.pyz
Следуйте инструкциям, появляющимся на экране.
Если вы хотите сообщить о проблеме , оставить комментарий или разветвить исходный код, сделайте это на GitHub .
Это более старая, более короткая и простая версия, более подходящая для встроенного цитирования:
#!/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
. Строки не обязательно должны быть точными дубликатами (даже после нормализации), но этого достаточно, если тип, URI, набор и хотя бы один компонент перекрываются.
Я не уверен, что проверка равенства верна во всех угловых случаях (например, в различных Строки «option»).
Выполните сброс ваших репозиториев следующим образом:
software-properties-gtk
(вы можете запустить software- properties-gtk -h
, чтобы убедиться, что вы получили справочное сообщение) sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo software-properties-gtk
После того, как все заработает, вы можете удалить резервную копию с помощью sudo rm -rf /etc/apt/sources.list.bak[1182783 impression.
Для меня (16.04 LTS) переход к
Системные настройки >> Программное обеспечение и обновления >> Другое программное обеспечение и удаление каждой повторяющейся записи из списка работали нормально.
Для систем на основе Ubuntu с Linux mint перейдите в Источники программного обеспечения> Обслуживание> Удалить повторяющиеся пакеты
Поскольку ошибки говорят вам, где проблема, и что все проблемы связаны с одной дублированной строкой, вы можете легко исправить это вручную с помощью текстового редактора, такого как vim, nano и т. д. Одним из преимуществ этого является то, что вы можете точно видеть, в чем проблема и что вы делаете, чтобы ее исправить.
В вашем случае с помощью sudo или root откройте / etc / apt / sources.список в текстовом редакторе. Удалите строку 33 или строку 87. Сначала вы можете визуально проверить, что они дублируются.
Если вам нравится vim ...
$ 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
Или, чтобы выйти, если вы ошиблись ...
:q! # to quit without saving any changes
Я встретился с этим для 18,10. Я использовал Синаптический для проверки репозиториев и затем удалил тех, я думал, были дубликаты. Результат: больше никаких сообщений об ошибках.