PSQL is failing to connect to Postgres 16 running on the local Fedora 40 Linux server.

I can connect from a remote server or through PGAdmin using pqsl, but not locally. I get the same error when trying to connect to the remote machine using PSQL.


bash-5.2$ psql
Password for user postgres:
psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: FATAL:  parameter "listen_addresses" cannot be changed without restarting the server


listen_addresses = '*'
port is default 5432


# "local" is for Unix domain socket connections only

local   all             all                                     md5

# IPv4 local connections:

host    all             all              md5

# IPv6 local connections:

host    all             all             ::1/128                 md5

# Allow replication connections from localhost, by a user with the
# replication privilege.

local   replication     all                                     md5
host    replication     all               md5
host    replication     all             ::1/128                 md5

I have restarted postgresql-16 after making any changes (systemctl restart postgresql-16) without any errors.

I also don't see much in the log beside a copy of the connection error.

I have also opened that port in the firewall.

More details The server with the issue is an Azure VM running Fedora 40, and Postgresql 16. I can connect from a Fedora 37 on premise Lenovo ThinkCentre that has Postgresql 14. I cannot connect from the Fedora 40 to Fedora 37 but can connect from the 37 to the 40 all using the psql command.

  • 1
    try command bash-5.2$ PGOPTIONS='' psql. I have only one idea how you can get such an error, I want to check it.
    – Melkij
    Commented Jun 18 at 19:01
  • Just wondering, does it behave the same if you use psql parameters like --host= and --port? And also if you try to connect to loopback ip, but also to public ip with --host parameter, are there any differences there? Commented Jun 18 at 21:35
  • @Melkij You must be right. Commented Jun 19 at 6:19
  • The PGOPTIONS='' worked. Changing the host and parameters does work.
    – Kyle
    Commented Jun 24 at 20:04
  • Sorry, I commented with haste. Changing host and port parameters does NOT work. Is that the env variable? echo $PGOPTIONS returns "-i"
    – Kyle
    Commented Jun 24 at 20:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.