Skip to content

[Bug]: Nextcloud always changes the MySQL db password #34123

@Ma27

Description

@Ma27

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

Since #33513 Nextcloud always recreates the MySQL installation password.

To explain why this is a problem, let me elaborate how Nextcloud is currently managed when using NixOS:

  • In the configuration file, you enable nextcloud and provide a few settings, including the database password.
  • These settings will be written to a file /var/lib/nextcloud/config/override.config.php (this takes precedence over config.php. We do this by design because NixOS is essentially a tool for configuration management and the config should be the single source of truth).
  • Nextcloud unconditionally changes the database password in MySQL, the value is written to config.php, but the original password in override.config.php is still effective and thus Nextcloud now uses the wrong MySQL password which renders the instance in a broken state.

We fixed the issue ourselves now by patching out the entire behavior: https://github.com/NixOS/nixpkgs/blob/e986ddf417949e1a045430326a7238f9972827c9/pkgs/servers/nextcloud/0001-Setup-remove-custom-dbuser-creation-behavior.patch

However I figured it's still reasonable to file a bug here:

  • As mentioned earlier, supplying additional *.config.php-files is useful for config management tools, however these tools are supposed to contain the single source of truth and diverging from that is IMHO a problem.
  • Also, I think it's completely counter-intuitive that passwords are silently regenerated by an application that's only a consumer of the database. In the end it's the administrator's job to configure the database correctly.

It's understandable to me though if you'd prefer to keep the behavior the way it currently is for a better installation experience (even though I disagree with the motivation). In the end, we fixed the issue on our end, I thought I'd still bring it to your attention :)

Steps to reproduce

  1. install Nextcloud via NixOS with mysql as db
  2. during the installation the mysql pw gets changed

Expected behavior

I'd expect Nextcloud to not touch the MySQL password, reasoning is outlined in the description.

Installation method

Other Community project

Operating system

Other

PHP engine version

PHP 8.0

Web server

Nginx

Database engine version

MySQL

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

Enabled:
  - accessibility: 1.10.0
  - activity: 2.16.0
  - calendar: 3.4.3
  - circles: 24.0.1
  - cloud_federation_api: 1.7.0
  - comments: 1.14.0
  - contacts: 4.2.0
  - contactsinteraction: 1.5.0
  - cospend: 1.4.8
  - dashboard: 7.4.0
  - dav: 1.22.0
  - federatedfilesharing: 1.14.0
  - federation: 1.14.0
  - files: 1.19.0
  - files_pdfviewer: 2.5.0
  - files_rightclick: 1.3.0
  - files_sharing: 1.16.2
  - files_trashbin: 1.14.0
  - files_versions: 1.17.0
  - files_videoplayer: 1.13.0
  - firstrunwizard: 2.13.0
  - logreader: 2.9.0
  - lookup_server_connector: 1.12.0
  - maps: 0.2.1
  - nextcloud_announcements: 1.13.0
  - notifications: 2.12.1
  - oauth2: 1.12.0
  - password_policy: 1.14.0
  - photos: 1.6.0
  - privacy: 1.8.0
  - provisioning_api: 1.14.0
  - recommendations: 1.3.0
  - serverinfo: 1.14.0
  - settings: 1.6.0
  - sharebymail: 1.14.0
  - support: 1.7.0
  - survey_client: 1.12.0
  - systemtags: 1.14.0
  - text: 3.5.1
  - theming: 1.15.0
  - twofactor_backupcodes: 1.13.0
  - updatenotification: 1.14.0
  - user_saml: 5.0.2
  - user_status: 1.4.0
  - viewer: 1.8.0
  - weather_status: 1.4.0
  - workflowengine: 2.6.0
Disabled:
  - admin_audit
  - encryption
  - files_external
  - user_ldap: 1.9.0

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

Installed via the NixOS module of nextcloud, https://nixos.org/manual/nixos/stable/index.html#module-services-nextcloud

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