How to remove an apt error

I was trying to install PostgreSQL from the directions giving on the PostgreSQL website. I’ve now found out that I can install in via “apt install postgresql”. However, I need to resolve/cleanup the following error message before I can continue:

Conflicting values set for option Signed-By regarding source https://apt.postgresql.org/pub/repos/apt/ noble-pgdg: /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc != /usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg
E: The list of sources could not be read.

How do I clean up the above error to move forward?

Thanks

mablelongshoreman

Look as the sources list file is now miss configured.
In small steps we move forward.
What release are you on ?

lsb_release -a

as the location of this file has fairly recently changed.
Once we know the release we know where to look.

-ain’t nothing but a thing-

Please use code tags when posting terminal or script output. It makes it much easier to read and analyze.

If installed, show us the output of inxi -r

If not, it can be installed with sudo apt install inxi

Thanks.

1 Like
lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.3 LTS
Release:	24.04
Codename:	noble

Thanks for your help, what should I do next.

Thanks

I’m unable to get anything to work with “apt”, whenever I enter any apt command I get the same error message:

E: Conflicting values set for option Signed-By regarding source https://apt.postgresql.org/pub/repos/apt/ noble-pgdg: /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc != /usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg
E: The list of sources could not be read.

Thanks

It seems the PostgreSQL APT repository may possibly be configured twice (or perhaps inconsistently).

Not important how it got there, let’s see what we can do to clean things up.

Run this in the terminal and post the output with code tags </> on the ribbon:
grep -r "apt.postgresql.org" /etc/apt/sources.list /etc/apt/sources.list.d/

Here is the output that you requested:

tgrep -r "apt.postgresql.org" /etc/apt/sources.list /etc/apt/sources.list.d/
/etc/apt/sources.list.d/pgdg.sources:URIs: https://apt.postgresql.org/pub/repos/apt
/etc/apt/sources.list.d/pgdg.sources:Signed-By: /usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg
/etc/apt/sources.list.d/pgdg.list:deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt noble-pgdg main
ype or paste code here

What does it say?
How can I fix my problem?

Thanks

You have two PostgreSQL repository lists.

As a result, APT sees both and thinks they are the same repository but with different keys, and refuses to proceed.

.sources is the modern, recommended format, so we will keep it and remove the other one.

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

If no errors, then
sudo apt update

This should resolve the issue and you can update and install normally again.

As a test, try the command I suggested earlier sudo apt install inxi

If there are still errors, post them here again.

1 Like

Thanks for your help.

So should continue with the installation on the PostgreSQL website or just run: “sudo apt install postgresql”?

Thanks

Personally, I always recommend using the packages in the official Ubuntu repositories.

Glad you were able to resolve the issue.

Please mark the relevant post as the solution to help the community.

1 Like

One more question, how to I get rid of the error message below:

Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://apt.postgresql.org/pub/repos/apt noble-pgdg InRelease' doesn't support architecture 'i386'
type or paste code here

Thanks

Edit the sources file to tell APT to skip looking for 32-bit packages, which I assume you do not need.

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

Add or modify this line:
Architectures: amd64

Ctrl + O to write the change followed by Enter and then Ctrl + X to exit.

Run sudo apt update and the message should be gone.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.