如何修复错误 W:目标包(main/binary-amd64/Packages)在我的 sources.list 文件中配置了多次?

如何修复错误 W:目标包(main/binary-amd64/Packages)在我的 sources.list 文件中配置了多次?

我有 Ubuntu 16.04 Xenial Xerus,当我想要运行sudo apt-get updatesudo apt-get autocleansudo apt-get install (package name)或时sudo apt-get install -f,我收到以下消息:

Citire liste de pachete... 0%
Citire liste de pachete... Terminat
Se construiește arborele de dependență       
Se citesc informațiile de stare... Terminat
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Translations (main/i18n/Translation-ro_RO) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Translations (main/i18n/Translation-ro) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Translations (restricted/i18n/Translation-ro_RO) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Translations (restricted/i18n/Translation-ro) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Packages (universe/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Packages (universe/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Packages (universe/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Translations (universe/i18n/Translation-ro_RO) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Translations (universe/i18n/Translation-ro) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Translations (universe/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target DEP-11 (universe/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target DEP-11-icons (universe/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Translations (main/i18n/Translation-ro_RO) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Translations (main/i18n/Translation-ro) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Translations (restricted/i18n/Translation-ro_RO) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Translations (restricted/i18n/Translation-ro) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target DEP-11 (restricted/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target DEP-11-icons (restricted/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Packages (universe/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Packages (universe/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Packages (universe/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Translations (universe/i18n/Translation-ro_RO) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Translations (universe/i18n/Translation-ro) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target Translations (universe/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target DEP-11 (universe/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8
W: Target DEP-11-icons (universe/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:4 and /etc/apt/sources.list:8

这是我的/etc/apt/sources.list

/etc/apt/sources.list

答案1

main、、、是条目中部分的不同组成部分,对于给定universe的条目不能重复(相同(例如)、(例如)、(例如))。multiverserestrictedSectionssources.listTypedebURIhttp://archive.ubuntu.com/ubuntu/Suitexenial

在您的 中,第 2 行和第 5 行/etc/apt/sources.list有重复的组件(mainrestricted, ):universe

deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe
deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse

由于第 5 行是第 2 行的超集,因此您可以使用自己喜欢的编辑器删除第 2 行,或者使用sed

sudo sed -i '2d' /etc/apt/sources.list

或者注释掉第二行:

sudo sed -i '2 s/^/# /' /etc/apt/sources.list

答案2

谨防:这将删除您的所有存储库,并且您可能无法再使用 apt 安装软件包,直到您添加新的 sources.list 文件。

重置你的存储库像这样

  1. sudo rm /etc/apt/sources.list
  2. sudo software-properties-gtk
  3. 选择你的选项
  4. 节省

答案3

我也遇到了这个问题,我通过错误信息修复了它:

"W: Target Packages (main/binary-amd64/Packages) is configured multiple 
times in /etc/apt/sources.list:2 and /etc/apt/sources.list:5".

你可以sudo vim /etc/apt/sources.list

然后找到第二行,使用#注释掉该行。

保存文件,sudo apt-get update问题就解决了。

答案4

这是 Ubuntu 16.04 的问题

你可以用以下方法修复它xenial-backports

sudo apt install appstream/xenial-backports

sudo appstreamcli refresh --force

执行第二条命令后你将得到

AppStream cache update completed successfully.

相关内容