Skip to content

[Bug]: fresh install with postgresql, occ maintenance:install error #38749

@whlsxl

Description

@whlsxl

⚠️ This issue respects the following points: ⚠️

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

  1. fresh nextcloud
  2. fresh postgresql with superuser postgres & thepassword
  3. 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?

  • 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. #34645
Because when execute $connectionMainDatabase->executeQuery('GRANT CREATE ON SCHEMA public TO ' . addslashes($this->dbUser)); the postgres database may not create.

$connectionMainDatabase->executeQuery('GRANT CREATE ON SCHEMA public TO ' . addslashes($this->dbUser));

Same issue: eb7b682#commitcomment-95275498

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions