错误:
W: Target Packages (partner/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target Packages (partner/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target Packages (partner/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target Translations (partner/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target Translations (partner/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target DEP-11 (partner/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target DEP-11-icons (partner/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target Packages (partner/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target Packages (partner/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target Packages (partner/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target Translations (partner/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target Translations (partner/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target DEP-11 (partner/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
W: Target DEP-11-icons (partner/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:40 and /etc/apt/sources.list.d/canonical_partner.list:1
我使用在这里找到的脚本来清除重复项,并且它有效,并且我得到了“无重复”的结果。
检测并以交互方式停用重复的 Apt 源条目。
用法:
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.')
检查了我的来源列表,没有重复: http://4.1m.yt/ZpBycBf.png和http://2.1m.yt/Wh3BMA.png
资料来源清单2: 2.1m.yt/BJ84IEB.png(抱歉只允许 2 个链接>.>)
kali@ADELL:/etc/apt/sources.list.d$ ls
canonical_partner.list
canonical_partner.list.save
mefrio-g-ubuntu-plymouthmanager-xenial.list
mefrio-g-ubuntu-plymouthmanager-xenial.list.save
noobslab-ubuntu-macbuntu-xenial.list
noobslab-ubuntu-macbuntu-xenial.list.save
noobslab-ubuntu-themes-xenial.list
noobslab-ubuntu-themes-xenial.list.save
rodsmith-ubuntu-refind-xenial.list
rodsmith-ubuntu-refind-xenial.list.save
答案1
好的,为您快速修复:
sudo su
rm /etc/apt/sources.list.d/canonical_partner.list
rm /etc/apt/sources.list.d/canonical_partner.list.save
您可以将下一个块完全复制并粘贴到终端并按一次回车键:
cat > /etc/apt/sources.list << EOF
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu xenial-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu xenial-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
EOF
exit
之后只需执行以下操作:
sudo apt-get update
sudo apt-get dist-upgrade
而且我确信您的重复输入消息已经消失了。