Sudo apt-update – Fixing Upgrade Issues

updatesupgrade

So I am running WSL 2, and acquired the ubuntu 20.04 LTS installation through the windows store.

I have downloaded a few programs like (Python 3 et el). I also know I have to keep my system up to date. Although I have not touched the kernel upgrade stuff. I have been using the commands sudo apt-update and then sudo apt-upgrade.

This was great for the first two to three months until these messages started to appear.

W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/pgdg.list:1 and /etc/apt/sources.list.d/pgdg.list:2
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/pgdg.list:1 and /etc/apt/sources.list.d/pgdg.list:2
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/pgdg.list:1 and /etc/apt/sources.list.d/pgdg.list:2
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list.d/pgdg.list:1 and /etc/apt/sources.list.d/pgdg.list:2
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/pgdg.list:1 and /etc/apt/sources.list.d/pgdg.list:2
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/pgdg.list:1 and /etc/apt/sources.list.d/pgdg.list:2
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/pgdg.list:1 and /etc/apt/sources.list.d/pgdg.list:2
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/pgdg.list:1 and /etc/apt/sources.list.d/pgdg.list:2
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list.d/pgdg.list:1 and /etc/apt/sources.list.d/pgdg.list:2
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/pgdg.list:1 and /etc/apt/sources.list.d/pgdg.list:2

Now can someone explain what is actually going on, why are they configured multiple times? Are these backups? How do I go about tidying the multiple logs up? Is it safe to do so? Little confused here. All feedback grateful and welcome. Thank you in advanced.

Big Edit:

shanzem@Shanzem-Laptop:~$ cat /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main
deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main

How Bizarre! going to comment out line 2! will post results.

PROBLEM SOLVED

Best Answer

As explained in other answers like this one and this one, your problem is duplicate sources in one of your sources.list files.

The error states that the problem is with the file /etc/apt/sources.list.d/pgdg.list

The error also states that the duplicate is listed on line 1 and line 2 of the file.

You can use the following command to edit the file:

sudo nano /etc/apt/sources.list.d/pgdg.list

Use this text editor mode to remove duplicate lines.

If line 1 and line 2 are identical, delete one of the two lines and then press CTRL+o to save the file and then press CTRL+x to exit nano.

After you edit the file, run the following commands to update your package list and upgrade (update) your software to the newest versions:

sudo apt update
sudo apt upgrade

If the two lines are not identical, please edit your question and post the contents of your /etc/apt/sources.list.d/pgdg.list file so I can provide more detailed instructions.

Related Question