Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL: faulty database connection upon completing installation wizard #482

Closed
pmattern opened this issue Jul 20, 2016 · 8 comments · Fixed by #497
Closed

PostgreSQL: faulty database connection upon completing installation wizard #482

pmattern opened this issue Jul 20, 2016 · 8 comments · Fixed by #497
Labels

Comments

@pmattern
Copy link
Contributor

pmattern commented Jul 20, 2016

Using PostgreSQL the first database connection upon completing the installation wizard ("Finish setup") is faulty both in current master checkouts and 9.0.53.

Both 020a2a6 and 9.0.53 first try to connect to database "postgres" instead of their dedicated one according to the PostgreSQL server's logs. As for the Git checkout this results in failure and a warning
nextcloud_postgres-installation-credentials_020a2a6
In 9.0.5{3,2} the installation wizard of which still needs the vendor specific "psql" driver an attempt to connect to database "postgres" is made as well but it's followed by some other connection attempt and the resulting warning is
nextcloud_postgres-installation-credentials_9 0 52
Unlike the findings with branch master this isn't reproducible 100% but happens most of the time, so far I failed to figure out the exact conditions.
Both times config.php is written but incomplete, in particular dbpassword and installed are missing. The correct dedicated database of Nextcloud is filed in dbname, though.

Arch Linux x86_64, hence PostgreSQL 9.5.3, PHP 7.0.8 and Apache 2.4.23 using the PHP module. Database server on an other host than the one running Apache / Nextcloud, credentials definitely valid as verified by invoking psql from the latter.

@MorrisJobke
Copy link
Member

cc @icewind1991

@bauna
Copy link

bauna commented Aug 10, 2016

I'm experiencing the same issue deploying on a virtual machine on Amazon EC2. I can login to Postgresql instance from the same vm and create tables, but nextcloud installer(from web and command line) says that credentials are not valid. On command line I tried with option "-vvv" to get more info but I got the same message. The installation with mysql works as expected.

These the versions on my VM:
Ubuntu 14.04
PHP 5.5.9-1ubuntu4.19
Nextcloud version 9.0.53
Apache 2.4.7-1ubuntu4.13
PosrgreSQL 9.5.2

Thanks!

@ramondg
Copy link

ramondg commented Nov 30, 2016

+1

@MorrisJobke
Copy link
Member

+1

@ramondg Could you test the changes in #497? Thanks :)

@MorrisJobke MorrisJobke added this to the Nextcloud 11.0 milestone Dec 5, 2016
@pmattern
Copy link
Contributor Author

There seems to be a small remnant.

Right upon clicking the wizard's Finish setup button there's still the error message

FATAL: no pg_hba.conf entry for host "fd99:aaaa:bbbb:2:5054:ff:fe12:213", user "u_nextcloud1", database "postgres", SSL off

in the PostgreSQL server's log, where the database name is wrong but the other credentials are correct.
Error messages other than this don't seem to exist, even when log_min_messages = debug5 is set in postgresql.conf, and I couldn't see any problem corresponding with the message running the wizard or Nextcloud itself either.
So not sure about the impact.

Arch Linux x64-64, Apache 2.4.25, PHP 7.1.1, PostgreSQL 9.6.1, Nextcloud b5990b7.

@go2sh
Copy link
Contributor

go2sh commented Jan 27, 2017

This is a postgres error unrelated to nextcloud. You use an ip address to connect to postgres which is not allowed in the pg_hba.conf file. Usually only local host is allowed to connect.
See https://www.postgresql.org/docs/9.6/static/auth-pg-hba-conf.html for more information about the correct configuration. You find the file under /var/lib/postgres/data/pg_hba.conf in Arch Linux.

@pmattern
Copy link
Contributor Author

This is a postgres error unrelated to nextcloud. [...]

The finding has exactly nothing to do with pg_hba.conf which is configured properly. How else should everything except the error message work fine?
Rather, as written in my previous post as well, the point is the wrong database name "postgres" that Nextcloud is using for whatever reason.

@go2sh
Copy link
Contributor

go2sh commented Jan 30, 2017

@pmattern
Yes, but that is no real error. You can safely ignore that error. I took a look at the code and nextcloud connects to the postgres database to check whether it has access to it, to check for the db user, and to create it eventually. See:
https://github.com/nextcloud/server/blob/master/lib/private/Setup/PostgreSQL.php
In a default postgres setup, the check will always fail and the failed login will be logged in the postgres log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants