How to fix error W: Target Packages (main/binary-amd64/Packages) is configured multiple times in my sources.list file? [duplicate]

Solution 1:

main, universe, multiverse, restricted are different components of the Sections portion in a sources.list entry and can not be duplicated for a given entry (same Type (e.g. deb), URI (e.g. http://archive.ubuntu.com/ubuntu/) , Suite (e.g. xenial)).

In your /etc/apt/sources.list, you have duplicate components (main, restricted, universe) in lines 2 and 5:

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

As line 5 is a superset of line 2, you can remove line 2 using your favorite editor or use sed:

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

Or comment out the 2nd line:

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

Solution 2:

Reset your repositories like this

  1. sudo rm /etc/apt/sources.list
  2. sudo software-properties-gtk
  3. Pick your options
  4. Save