server
server copied to clipboard
[Bug]: fresh install with postgresql, occ maintenance:install error
⚠️ This issue respects the following points: ⚠️
- [X] This is a bug, not a question or a configuration/webserver/proxy issue.
- [X] This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- [X] I agree to follow Nextcloud's Code of Conduct.
Bug description
Fresh install nextcloud & postgresql, when occ maintenance:install
, will post an error something like:
PostgreSQL username and/or password not valid
-> You need to enter details of an existing account.
Trace: #0 /var/www/lib/private/Setup.php(353): OC\Setup\PostgreSQL->setupDatabase()
#1 /var/www/core/Command/Maintenance/Install.php(104): OC\Setup->install()
#2 /var/www/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Maintenance\Install->execute()
#3 /var/www/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#4 /var/www/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#5 /var/www/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#6 /var/www/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#7 /var/www/console.php(100): OC\Console\Application->run()
#8 /var/www/occ(11): require_once('...')
#9 {main}
Previous: Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at "postgres" (192.168.16.6), port 5432 failed: FATAL: database "nextcloud" does not exist
Trace: #0 /var/www/lib/private/Setup/PostgreSQL.php(112): OC\DB\Connection->connect()
#1 /var/www/lib/private/Setup.php(353): OC\Setup\PostgreSQL->setupDatabase()
#2 /var/www/core/Command/Maintenance/Install.php(104): OC\Setup->install()
#3 /var/www/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Maintenance\Install->execute()
#4 /var/www/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#5 /var/www/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#6 /var/www/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#7 /var/www/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#8 /var/www/console.php(100): OC\Console\Application->run()
#9 /var/www/occ(11): require_once('...')
#10 {main}
Steps to reproduce
- fresh nextcloud
- fresh postgresql with superuser
postgres
& thepassword - occ maintenance:install --database pgsql --database-host localhost:5432 --database-name nextcloud --database-user postgres --database-pass thepassword --admin-user admin --admin-pass adminpassword--data-dir /path/to/data/
Expected behavior
Nextcloud was successfully installed
Installation method
Community Docker image
Nextcloud Server version
26
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.1
Web server
Nginx
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- [X] Default user-backend (database)
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other
Configuration report
No response
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
This bug is related to this pull request. https://github.com/nextcloud/server/pull/34645
Because when execute $connectionMainDatabase->executeQuery('GRANT CREATE ON SCHEMA public TO ' . addslashes($this->dbUser));
the postgres database may not create.
https://github.com/nextcloud/server/blob/eb7b682dc08f522212a86636994abc90ea926616/lib/private/Setup/PostgreSQL.php#L82
Same issue: https://github.com/nextcloud/server/commit/eb7b682dc08f522212a86636994abc90ea926616#commitcomment-95275498
Same issue.
Same here, but in plain (not Docker) web install of the latest NC. Spent 3 days trying figure out what's wrong with my Postgres settings - ended here with NC bug. It's pity that since Jun 2023 Posgtres setup isn't supported in fact despite what's stated on official reqs page...