W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/extra.list:1 and /etc/apt/sources.list.d/ubuntu.sources:1
means the same repository and component are listed in two places. It is a warning:
the update still worked. Remove the duplicate line (the one you added) and the warnings
stop.
The message names both files and the line number in each, so you know exactly where to
look. In the test the duplicate was a one-line file added by hand; the image's own
ubuntu.sources was left as it was.
The error
$ echo 'deb http://archive.ubuntu.com/ubuntu noble main' > /etc/apt/sources.list.d/extra.list
exit code: 0
$ apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:3 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:4 http://archive.ubuntu.com/ubuntu noble-backports InRelease
Reading package lists...
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/extra.list:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/extra.list:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/extra.list:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/extra.list:1 and /etc/apt/sources.list.d/ubuntu.sources:1
exit code: 0
Why it happens
The ubuntu:24.04 image keeps its own sources in
/etc/apt/sources.list.d/ubuntu.sources. Its non-comment lines, read with
grep -v '^#' in a fresh container, include
Suites: noble noble-updates noble-backports and
Components: main universe restricted multiverse, so it already lists
noble with main. The added line,
deb http://archive.ubuntu.com/ubuntu noble main, asked for the same index
files again. apt noticed and warned, once for each architecture index
(binary-amd64 and binary-all), and each pair came out twice in
this run. The update returned 0 and all four sources showed Hit:, so
nothing was broken; the extra line did nothing useful.
A line that adds a component the image already lists does the same:
deb http://archive.ubuntu.com/ubuntu noble-backports universe gave the same
warnings for universe in the same container. Before adding a line from a
guide, read ubuntu.sources to see whether you need it at all.
The fix
$ mv /etc/apt/sources.list.d/extra.list /root/extra.list.off
exit code: 0
$ apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu noble-backports InRelease
Reading package lists...
exit code: 0
Moving the added file out of /etc/apt/sources.list.d/ (here into
/root, so it can be put back) removed every warning. When the duplicate is between two files you added, keep one; when one of them is
ubuntu.sources, keep that one and drop yours.
How it was reproduced
The capture was made in an ubuntu:24.04 container (Ubuntu 24.04.5 LTS,
apt 2.8.3) on Docker Engine 29.9.3, standing in for Ubuntu in WSL. As root, a one-line
extra.list repeating noble main was written next to the
image's ubuntu.sources, apt-get update was run, the file was
moved out of the folder and the update was run again.
Frequently asked
- How do I fix 'Target Packages is configured multiple times'?
- Remove the duplicate line named in the message. In the test moving the added extra.list out of /etc/apt/sources.list.d/ removed every warning.
- Is 'configured multiple times' an error?
- No. It is a W: line. In the test apt-get update returned 0 and every source showed Hit while the warnings were printed.
- Where are the Ubuntu 24.04 apt sources?
- In the ubuntu:24.04 image they are in /etc/apt/sources.list.d/ubuntu.sources, the second file named in the warning.
More decoded errors in the Fixes category. When a repository line is wrong rather than repeated, see does not have a Release file.