Bitnami init script couldn't start export Mariadb cannot start

Keywords: WordPress - AWS - Technical issue - Services (Apache, MariaDB, MySQL…)

bnsupport ID: ffc4f638-a9d4-c93a-a6f0-268c23757118

bndiagnostic output:

? Mariadb: Found possible issues
? Connectivity: Found possible issues
? Resources: Found possible issues
? Processes: Found possible issues
https://docs.bitnami.com/aws/apps/wordpress/troubleshooting/debug-errors-mariadb/
https://docs.bitnami.com/general/how-to/troubleshoot-permission-issues/
https://docs.bitnami.com/general/faq/administration/use-firewall/

bndiagnostic failure reason: The suggested guides are not related with my issue

Description:
Hi guys, I am trying to export my database running this command :
sudo mysqldump -h wordpress -u root -p bitnami_wordpress > rescue2.database.sql

and got this error : mysqldump: Got error: 2005: “Unknown MySQL server host ‘wordpress’ (-2)” when trying to connect

Thanks for helping it’s been 2 weeks I am searching for…

I would like at liest export my data from Mariadb then I could setup a new container from scratch

Hi @emile.cantero,

If you are using the Bitnami WordPress singleVM solution in AWS, you do not need to specify any host parameter in the mysqldump command

https://docs.bitnami.com/aws/apps/wordpress/administration/backup-restore-mysql-mariadb/

Please note that the MariaDB server must be running when running that command and it’s not right now. The Bitnami Diagnostic Tool warned you about that


[Mariadb]

Found recent error messages in the MariaDB error log:

2021-12-08 13:45:49 0 [ERROR] Aborting

Please check the following guide to troubleshoot MariaDB issues:

https://docs.bitnami.com/aws/apps/wordpress/troubleshooting/debug-errors-mariadb/

Another installation of MariaDB is running:

root 696 0.0 0.2 2388 1340 ? S 07:57 0:00 /bin/sh /usr/bin/mysqld_safe mysql 845 0.0 11.0 1254896 54604 ? Sl 07:57 0:07 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/x86_64-linux-gnu/mariadb19/plugin --user=mysql --skip-log-error --pid-file=/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock

If Bitnami MariaDB isn’t starting this is the most likely cause. Please run the following command to stop it:

Some files don’t have the expected permissions. Please check the following guide:

https://docs.bitnami.com/general/how-to/troubleshoot-permission-issues/

[Connectivity]

Server ports 22, 80 and/or 443 are not publicly accessible. Please check the following guide to open server ports for remote access:

https://docs.bitnami.com/general/faq/administration/use-firewall/

[Resources]

Your instance has little available RAM memory.

 total used free shared buff/cache available Mem: 482 320 8 8 153 141 Swap: 634 16 618

You could try to increase your instance’s memory. Please check your cloud provider’s documentation for more information.

[Processes]

One or more component’s processes are not running:

apache not running mariadb not running

You can try to restart the process with the following command:

$ sudo /opt/bitnami/ctlscript.sh start COMPONENT_NAME


Happy to help!


Was my answer helpful? Click on :heart:

Thanks for helping :slight_smile:

When I ran sudo mysqldump -A -u root -p > backup.sql

got this error : -bash: backup.sql: Permission denied

Then I ran :

Blockquote sudo su

Then got : Got error: 2002: “Can’t connect to local MySQL server through socket ‘/opt/bitnami/mariadb/tmp/mysql.sock’ (2)” when t
rying to connect

Server ports 22, 80 and/or 443 have permitted rules in my lightsail settings

Plus when I ran sudo /opt/bitnami/ctlscript.sh start mariadb or sudo /opt/bitnami/ctlscript.sh start apache got Failed to start mariadb: Failed to start mariadb or Failed to start apache: Failed to start apache

Plus running systemctl status bitnami.service
give me : [20183]: /opt/bitnami/scripts/apache/start.sh: line 21: /opt/bitnami/apache/bin/httpd

I ran sudo mysqldump -h exemple.com -u root bitnami_wordpress --single-transaction >rescue5.database.sql then got error : mysqldump: Got error: 1698: “Access denied for user ‘root’@‘localhost’” when trying to connect

Hi @emile.cantero,

Where did you run that command? It seems you do not have permissions to write in that folder. What about these other ones?

cd /tmp
sudo mysqldump -A -u root -p > backup.sql

Is the database running?

This error is different. It seems you can’t access the database using the password your use. Can you confirm it’s the correct one?

cd /tmp
sudo mysqldump -A -u root -p > backup.sql

==> mysqldump: Got error: 2002: “Can’t connect to local MySQL server through socket ‘/opt/bitnami/mariadb/tmp/mysql.sock’ (2)” when t
rying to connect

Is the database running?
sudo service mariadb status

● mariadb.service - MariaDB 10.3.31 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/

This error is different. It seems you can’t access the database using the password your use. Can you confirm it’s the correct one?
I tried with the same I used to connect me to the WP admin and tried also the one included there in the mysql config file such as :
// ** MySQL settings - You can get this info from your web host ** //

/** The name of the database for WordPress */

define( ‘DB_NAME’, ‘bitnami_wordpress’ );

/** MySQL database username */

define( ‘DB_USER’, ‘bn_wordpress’ );

/** MySQL database password */

define( ‘DB_PASSWORD’, ‘password’ );

/** MySQL hostname */

define( ‘DB_HOST’, ‘localhost:3306’ );

Hi @emile.cantero,

You are using the sytem’s MariaDB database while the Bitnami’s MariaDB database is in a different path. That’s why WordPress can’t access its information because it’s not there. Please stop that system’s MariaDB database

sudo service mariadb stop

and start the Bitnami’s one

sudo /opt/bitnami/ctlscript.sh start

Running teses two commands give me :

Blockquote

Job for bitnami.service failed because the control process exited with error code.
See “systemctl status bitnami.service” and “journalctl -xe” for details.

Blockquote

systemctl status bitnami.service give me : bitnami.service - LSB: bitnami init script
Loaded: loaded (/etc/init.d/bitnami; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2021-12-15 13:01:36 UTC; 7min ago
Process: 12527 ExecStart=/etc/init.d/bitnami start (code=exited, status=1/FAILURE)
Tasks: 11 (limit: 558)
bitnami[12527]: /opt/bitnami/scripts/apache/start.sh: line 21: /opt/bitnami/apache/bin/httpd
systemd[1]: bitnami.service: Control process exited, code=exited, status=1/FAILURE
exemple.com systemd[1]: bitnami.service: Failed with result ‘exit-code’.
exemple.com systemd[1]: Failed to start LSB: bitnami init script.

What about restarting the services this way?

for file in `find /opt/bitnami/scripts/ -name stop.sh`; do sudo $file; done
for file in `find /opt/bitnami/scripts/ -name start.sh`; do sudo $file; done

Thanks jota for helps., first line gives me :

apache 04:43:17.91 INFO  ==> apache is not running
varnish 04:43:17.93 INFO  ==> varnish is not running
php 04:43:18.95 INFO  ==> php-fpm stopped
mariadb 04:43:18.98 INFO  ==> mariadb is not running

Second one :

bitnami@mywebsite:~$ for file in `find /opt/bitnami/scripts/ -name start.sh`; do sudo $file; done
/opt/bitnami/scripts/apache/start.sh: line 21: /opt/bitnami/apache/bin/httpd: No such file or directory
Warnings:
VCL compiled.

Debug: Version: varnish-6.5.1 revision 1dae23376bb5ea7a6b8e9e4b9ed95cdc9469fb64
Debug: Platform: Linux,4.19.0-18-cloud-amd64,x86_64,-junix,-smalloc,-sdefault,-hcritbit
Debug: Child (5978) Started
varnish 04:43:52.96 INFO  ==> varnish started
php 04:43:57.99 INFO  ==> php-fpm started
mariadb 04:44:58.04 ERROR ==> mariadb did not start

Hi @emile.cantero,

MariaDB could not be started, what’s the content of its log file?

sudo tail -n 30 /opt/bitnami/mariadb/logs/mysqld.log

https://docs.bitnami.com/aws/apps/wordpress/troubleshooting/debug-errors-mariadb/

Yes @jota :slight_smile:

Memory allocated by threads:             198856



Events status:
LLA = Last Locked At  LUA = Last Unlocked At
WOC = Waiting On Condition  DL = Data Locked
The Event Scheduler is disabled

2021-12-11 17:32:48 0 [Warning] 'proxies_priv' entry '@% root@ip-172-26-6-96' ignored in --skip-name-resolve mode.
2021-12-11 17:35:34 9 [Warning] 'proxies_priv' entry '@% root@ip-172-26-6-96' ignored in --skip-name-resolve mode.
2021-12-11 19:14:51 10 [Warning] Access denied for user 'root'@'localhost' (using password: NO)
2021-12-11 19:15:24 11 [Warning] Access denied for user 'root'@'localhost' (using password: NO)
2021-12-11 19:15:34 12 [Warning] Access denied for user 'toto'@'localhost' (using password: NO)
2021-12-11 19:15:53 13 [Warning] Access denied for user 'toto'@'localhost' (using password: YES)
2021-12-11 19:16:04 14 [Warning] Access denied for user 'root'@'localhost' (using password: YES)
2021-12-11 19:23:59 15 [Warning] Access denied for user 'root'@'localhost' (using password: NO)
2021-12-11 19:24:29 16 [Warning] Access denied for user 'root'@'localhost' (using password: YES)
2021-12-11 19:25:01 17 [Warning] Access denied for user 'root'@'localhost' (using password: YES)
2021-12-11 19:25:27 18 [Warning] Access denied for user 'user'@'localhost' (using password: YES)
2021-12-11 19:25:55 19 [Warning] Access denied for user 'user'@'localhost' (using password: YES)
2021-12-11 19:39:58 0 [Note] mysqld (initiated by: unknown): Normal shutdown
2021-12-11 19:39:58 0 [Note] InnoDB: FTS optimize thread exiting.
2021-12-11 19:39:58 0 [Note] InnoDB: Starting shutdown...
2021-12-11 19:39:58 0 [Note] InnoDB: Dumping buffer pool(s) to /bitnami/mariadb/data/ib_buffer_pool
2021-12-11 19:39:58 0 [Note] InnoDB: Buffer pool(s) dump completed at 211211 19:39:58
2021-12-11 19:39:59 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2021-12-11 19:39:59 0 [Note] InnoDB: Shutdown completed; log sequence number 357062489; transaction id 367608
2021-12-11 19:39:59 0 [Note] mysqld: Shutdown complete

Hi @emile.cantero

According to the log:

  • The database was once running fine
  • A series of failed attempts to connect to it, with and without providing password, happened
  • A regular request to stop the database was performed

Then, I’m not completely sure why the init script does not work and produces an error. Please, perform the following steps in order and provide the output. Let’s see if we can spot the error :slightly_smiling_face:

sudo service mariadb stop
sudo /opt/bitnami/ctlscript.sh status
sudo /opt/bitnami/ctlscript.sh stop
sudo /opt/bitnami/ctlscript.sh start mariadb
sudo /opt/bitnami/ctlscript.sh status
sudo gonit status
sudo journalctl -xe
sudo systemctl status bitnami.service
sudo tail -n 30 /opt/bitnami/mariadb/logs/mysqld.log

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart:

Many thanks for your help, hope we ago solve it !
When running this :

sudo service mariadb stop
sudo /opt/bitnami/ctlscript.sh status

Got this :

Cannot find any running daemon to contact. If >it is running
, make sure you are pointing to the right pid >file (/var/ru
n/gonit.pid)

When running this :

sudo /opt/bitnami/ctlscript.sh stop
sudo /opt/bitnami/ctlscript.sh start mariadb
sudo /opt/bitnami/ctlscript.sh status
Got this :
Stoping services…
start mariadb
then waiting one minute
Failed to start mariadb: Failed to start >mariadb
Cannot find any running daemon to contact. If >it is running
, make sure you are pointing to the right pid >file (/var/ru
n/gonit.pid)

When running this :

sudo gonit status

Give me this:

Cannot find any running daemon to contact. If it is running
, make sure you are pointing to the right pid file (/var/ru
n/gonit.pid)

Got other logs but cannot post them due to hidden flag coming from moderator