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

Drupal cannot connect to database #75146

Closed
dirkpauli opened this issue Nov 23, 2024 · 5 comments
Closed

Drupal cannot connect to database #75146

dirkpauli opened this issue Nov 23, 2024 · 5 comments
Assignees
Labels
drupal solved stale 15 days without activity tech-issues The user has a technical issue about an application triage Triage is needed

Comments

@dirkpauli
Copy link

dirkpauli commented Nov 23, 2024

Name and Version

bitnami/drupal:11.0.9

What architecture are you using?

amd64

What steps will reproduce the bug?

create docker containers for mariadb and drupal as described in bitnami/drupal's readme

What is the expected behavior?

Containers will come up and connect providing a Drupal instance

What do you see instead?

Attaching to drupal-1
drupal-1  | drupal 11:49:53.54 INFO  ==>
drupal-1  | drupal 11:49:53.54 INFO  ==> Welcome to the Bitnami drupal container
drupal-1  | drupal 11:49:53.54 INFO  ==> Subscribe to project updates by watching https://github.com/bitnami/containers
drupal-1  | drupal 11:49:53.54 INFO  ==> Submit issues and feature requests at https://github.com/bitnami/containers/issues
drupal-1  | drupal 11:49:53.55 INFO  ==> Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit https://bitnami.com/enterprise
drupal-1  | drupal 11:49:53.55 INFO  ==>
drupal-1  | drupal 11:49:53.55 INFO  ==> ** Starting Drupal setup **
drupal-1  | drupal 11:49:53.57 DEBUG ==> Validating settings in APACHE_* environment variables
drupal-1  | drupal 11:49:53.58 DEBUG ==> Copying files from /opt/bitnami/apache/conf.default to /opt/bitnami/apache/conf
drupal-1  | realpath: /bitnami/apache/conf: No such file or directory
drupal-1  | drupal 11:49:53.60 INFO  ==> Configuring Apache ServerTokens directive
drupal-1  | drupal 11:49:53.60 DEBUG ==> Configuring ServerTokens Prod on file /opt/bitnami/apache/conf/httpd.conf
drupal-1  | drupal 11:49:53.62 INFO  ==> Configuring PHP options
drupal-1  | drupal 11:49:53.63 INFO  ==> Setting PHP opcache.enable option
drupal-1  | drupal 11:49:53.65 INFO  ==> Setting PHP expose_php option
drupal-1  | drupal 11:49:53.66 INFO  ==> Setting PHP output_buffering option
drupal-1  | drupal 11:49:53.68 INFO  ==> Validating settings in MYSQL_CLIENT_* env vars
drupal-1  | drupal 11:49:53.71 DEBUG ==> Validating settings in DRUPAL_* environment variables...
drupal-1  | drupal 11:49:53.79 INFO  ==> Restoring persisted Drupal installation
drupal-1  | drupal 11:49:53.82 INFO  ==> Trying to connect to the database server
drupal-1  | drupal 11:49:53.82 DEBUG ==> Getting host from Drupal database configuration
drupal-1  | drupal 11:49:53.83 DEBUG ==> Getting port from Drupal database configuration
drupal-1  | drupal 11:49:53.83 DEBUG ==> Getting database from Drupal database configuration
drupal-1  | drupal 11:49:53.84 DEBUG ==> Getting username from Drupal database configuration
drupal-1  | drupal 11:49:53.84 DEBUG ==> Getting password from Drupal database configuration
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
drupal-1  | drupal 11:49:53.86 DEBUG ==> Executing SQL command:
drupal-1  | SELECT 1
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
'). Legal suffix characters are: K, M, G, T, P, E
' to 'port' /opt/bitnami/mysql/bin/mysql: Error while setting value '3306
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
drupal-1  | drupal 11:49:58.89 DEBUG ==> Executing SQL command:
drupal-1  | SELECT 1
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
'). Legal suffix characters are: K, M, G, T, P, E
' to 'port' /opt/bitnami/mysql/bin/mysql: Error while setting value '3306
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
drupal-1  | drupal 11:50:03.94 DEBUG ==> Executing SQL command:
drupal-1  | SELECT 1
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
'). Legal suffix characters are: K, M, G, T, P, E
' to 'port' /opt/bitnami/mysql/bin/mysql: Error while setting value '3306
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
drupal-1  | drupal 11:50:08.97 DEBUG ==> Executing SQL command:
drupal-1  | SELECT 1
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
'). Legal suffix characters are: K, M, G, T, P, E
' to 'port' /opt/bitnami/mysql/bin/mysql: Error while setting value '3306
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
drupal-1  | drupal 11:50:14.00 DEBUG ==> Executing SQL command:
drupal-1  | SELECT 1
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
'). Legal suffix characters are: K, M, G, T, P, E
' to 'port' /opt/bitnami/mysql/bin/mysql: Error while setting value '3306
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
drupal-1  | drupal 11:50:19.03 DEBUG ==> Executing SQL command:
drupal-1  | SELECT 1
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
'). Legal suffix characters are: K, M, G, T, P, E
' to 'port' /opt/bitnami/mysql/bin/mysql: Error while setting value '3306
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
drupal-1  | drupal 11:50:24.07 DEBUG ==> Executing SQL command:
drupal-1  | SELECT 1
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
'). Legal suffix characters are: K, M, G, T, P, E
' to 'port' /opt/bitnami/mysql/bin/mysql: Error while setting value '3306
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
drupal-1  | drupal 11:50:29.12 DEBUG ==> Executing SQL command:
drupal-1  | SELECT 1
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
'). Legal suffix characters are: K, M, G, T, P, E
' to 'port' /opt/bitnami/mysql/bin/mysql: Error while setting value '3306
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
drupal-1  | drupal 11:50:34.15 DEBUG ==> Executing SQL command:
drupal-1  | SELECT 1
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
'). Legal suffix characters are: K, M, G, T, P, E
' to 'port' /opt/bitnami/mysql/bin/mysql: Error while setting value '3306
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
drupal-1  | drupal 11:50:39.18 DEBUG ==> Executing SQL command:
drupal-1  | SELECT 1
drupal-1  | /opt/bitnami/mysql/bin/mysql: Deprecated program name. It will be removed in a future release, use '/opt/bitnami/mysql/bin/mariadb' instead
'). Legal suffix characters are: K, M, G, T, P, E
' to 'port' /opt/bitnami/mysql/bin/mysql: Error while setting value '3306

Additional information

up to 11.0.5, everything worked fine. Starting with 11.0.6 the above behavior occurs

@dirkpauli dirkpauli added the tech-issues The user has a technical issue about an application label Nov 23, 2024
@github-actions github-actions bot added the triage Triage is needed label Nov 23, 2024
@carrodher
Copy link
Member

Hi, the issue may not be directly related to the Bitnami container image/Helm chart, but rather to how the application is being utilized, configured in your specific environment, or tied to a particular scenario that is not easy to reproduce on our side.

If you think that's not the case and want to contribute a solution, we'd like to invite you to create a pull request. The Bitnami team is excited to review your submission and offer feedback. You can find the contributing guidelines here.

Your contribution will greatly benefit the community. Please feel free to contact us if you have any questions or need assistance.

Suppose you have any questions about the application, customizing its content, or technology and infrastructure usage. In that case, we highly recommend that you refer to the forums and user guides provided by the project responsible for the application or technology.

With that said, we'll keep this ticket open until the stale bot automatically closes it, in case someone from the community contributes valuable insights.

@dirkpauli
Copy link
Author

dirkpauli commented Dec 1, 2024

Hey Carlos,
I think I found the cause of the problem (and it is nothing related to anything "special" in my installation!)
With commit df18860, the file /opt/bitnami/scripts/libdrupal.sh was changed from using grep to awk to extract the Drupal database configuration.

With that, line 100 in /opt/bitnami/scripts/libmysqlclient.sh expands now to

mysql -N -u $'bn_drupal\r' $'bitnami_drupal\r' $'-paPassword\r' -h $'mariadb\r' -P $'3306\r' --connect-timeout=5 --skip-ssl

whereas before 11.0.6, it has been expanded to

mysql -N -u bn_drupal bitnami_drupal -paPassword -h mariadb -P 3306 --connect-timeout=5 --skip-ssl

The remaining $-signs now crash the execution at that point. Using the container bitnami/drupal:11, but replacing the file /opt/bitnami/scripts/libdrupal.sh with the older version (from 11.0.5) fixes the bug.

just documentation purposes, the database array in my settings.php looks like this:

$databases['default']['default'] = array (
  'database' => 'bitnami_drupal',
  'username' => 'bn_drupal',
  'password' => 'aPassword',
  'prefix' => '',
  'host' => 'mariadb',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
  'isolation_level' => 'READ COMMITTED',
);

So you probably want to revert commit df18860 and find a better solution for the underlying problem.

@carrodher
Copy link
Member

Thank you for bringing this issue to our attention. We appreciate your involvement!
Since you discovered the issue and properly explained it, if you're interested in contributing a solution, we welcome you to create a pull request. The Bitnami team is excited to review your submission and offer feedback. You can find the contributing guidelines here.

Your contribution will greatly benefit the community. Feel free to reach out if you have any questions or need assistance.

Copy link

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label Dec 18, 2024
Copy link

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

@bitnami-bot bitnami-bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
drupal solved stale 15 days without activity tech-issues The user has a technical issue about an application triage Triage is needed
Projects
None yet
Development

No branches or pull requests

3 participants