First letβs fix your issue before removing any folder
sudo journalctl -u mariadb
-- Logs begin at Tue 2020-07-14 21:11:03 BST, end at Tue 2020-07-14 21:30:38 BST. --
Jul 14 21:11:50 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jul 14 21:11:51 DietPi mysqld[670]: 2020-07-14 21:11:51 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as p
rocess 670 ...
Jul 14 21:11:54 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 14 21:11:54 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jul 14 21:11:54 DietPi systemd[1]: Failed to start MariaDB 10.3.22 database server.
cat /var/log/mysql/error.log outputs nothing, itβs emptyβ¦
yeah the file was truncated.
pls restart maria db and check the error.log afterwards
systemctl restart mariadb.service
cat /var/log/mysql/error.log
$ systemctl restart mariadb.service
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
$ cat /var/log/mysql/error.log
2020-07-14 23:37:55 0 [Note] InnoDB: Using Linux native AIO
2020-07-14 23:37:55 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-07-14 23:37:55 0 [Note] InnoDB: Uses event mutexes
2020-07-14 23:37:55 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-07-14 23:37:55 0 [Note] InnoDB: Number of pools: 1
2020-07-14 23:37:55 0 [Note] InnoDB: Using generic crc32 instructions
2020-07-14 23:37:55 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-07-14 23:37:55 0 [Note] InnoDB: Completed initialization of buffer pool
2020-07-14 23:37:55 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-07-14 23:37:55 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-07-14 23:37:55 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-07-14 23:37:55 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-07-14 23:37:55 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-07-14 23:37:55 0 [Note] InnoDB: 10.3.22 started; log sequence number 46552664; transaction id 115418
2020-07-14 23:37:55 0 [Note] InnoDB: Loading buffer pool(s) from /mnt/dietpi_userdata/mysql/ib_buffer_pool
2020-07-14 23:37:55 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-07-14 23:37:55 0 [Note] Recovering after a crash using tc.log
2020-07-14 23:37:55 0 [ERROR] Bad magic header in tc log
2020-07-14 23:37:55 0 [ERROR] Crash recovery failed. Either correct the problem (if it's, for example, out of memory error) and restart, or delete tc log and start mysqld with --tc-heuristic-recover={commit|rollback}
2020-07-14 23:37:55 0 [ERROR] Can't init tc log
2020-07-14 23:37:55 0 [ERROR] Aborting
2020-07-14 23:39:24 0 [Note] InnoDB: Using Linux native AIO
2020-07-14 23:39:24 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-07-14 23:39:24 0 [Note] InnoDB: Uses event mutexes
2020-07-14 23:39:24 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-07-14 23:39:24 0 [Note] InnoDB: Number of pools: 1
2020-07-14 23:39:24 0 [Note] InnoDB: Using generic crc32 instructions
2020-07-14 23:39:24 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-07-14 23:39:24 0 [Note] InnoDB: Completed initialization of buffer pool
2020-07-14 23:39:24 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-07-14 23:39:24 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-07-14 23:39:24 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-07-14 23:39:24 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-07-14 23:39:24 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-07-14 23:39:24 0 [Note] InnoDB: Waiting for purge to start
2020-07-14 23:39:24 0 [Note] InnoDB: 10.3.22 started; log sequence number 46552673; transaction id 115418
2020-07-14 23:39:24 0 [Note] InnoDB: Loading buffer pool(s) from /mnt/dietpi_userdata/mysql/ib_buffer_pool
2020-07-14 23:39:24 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-07-14 23:39:24 0 [Note] Recovering after a crash using tc.log
2020-07-14 23:39:24 0 [ERROR] Bad magic header in tc log
2020-07-14 23:39:24 0 [ERROR] Crash recovery failed. Either correct the problem (if it's, for example, out of memory error) and restart, or delete tc log and start mysqld with --tc-heuristic-recover={commit|rollback}
2020-07-14 23:39:24 0 [ERROR] Can't init tc log
2020-07-14 23:39:24 0 [ERROR] Aborting
$ systemctl restart mariadb.service
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
root@DietPi:/home/dt# systemctl status mariadb.service
β mariadb.service - MariaDB 10.3.22 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-07-14 23:39:27 BST; 33s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 892 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 893 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 895 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]
&& systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 952 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/F
AILURE)
Main PID: 952 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
Jul 14 23:39:24 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jul 14 23:39:24 DietPi mysqld[952]: 2020-07-14 23:39:24 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as p
rocess 952 ...
Jul 14 23:39:27 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 14 23:39:27 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jul 14 23:39:27 DietPi systemd[1]: Failed to start MariaDB 10.3.22 database server.
pls do
mv /mnt/dietpi_userdata/mysql/tc.log /mnt/dietpi_userdata/mysql/tc.save
systemctl restart mariadb.service
How did you know that you needed to do that mv? There was nothing in logs about that file βtc.saveβ β¦
DB server is running now. I can access NC, everything looks fine.
# systemctl restart mariadb.service
# cat /var/log/mysql/error.log
2020-07-15 9:08:54 0 [Note] InnoDB: Using Linux native AIO
2020-07-15 9:08:54 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-07-15 9:08:54 0 [Note] InnoDB: Uses event mutexes
2020-07-15 9:08:54 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-07-15 9:08:54 0 [Note] InnoDB: Number of pools: 1
2020-07-15 9:08:54 0 [Note] InnoDB: Using generic crc32 instructions
2020-07-15 9:08:54 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-07-15 9:08:54 0 [Note] InnoDB: Completed initialization of buffer pool
2020-07-15 9:08:54 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-07-15 9:08:54 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-07-15 9:08:54 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-07-15 9:08:54 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-07-15 9:08:54 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-07-15 9:08:54 0 [Note] InnoDB: 10.3.22 started; log sequence number 46552682; transaction id 115418
2020-07-15 9:08:54 0 [Note] InnoDB: Loading buffer pool(s) from /mnt/dietpi_userdata/mysql/ib_buffer_pool
2020-07-15 9:08:54 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-07-15 9:08:54 0 [Note] Recovering after a crash using tc.log
2020-07-15 9:08:54 0 [ERROR] Bad magic header in tc log
2020-07-15 9:08:54 0 [ERROR] Crash recovery failed. Either correct the problem (if it's, for example, out of memory error) and restart, or delete tc log and start mysqld with --tc-heuristic-recover={commit|rollback}
2020-07-15 9:08:54 0 [ERROR] Can't init tc log
2020-07-15 9:08:54 0 [ERROR] Aborting
2020-07-15 9:11:21 0 [Note] InnoDB: Using Linux native AIO
2020-07-15 9:11:21 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-07-15 9:11:21 0 [Note] InnoDB: Uses event mutexes
2020-07-15 9:11:21 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-07-15 9:11:21 0 [Note] InnoDB: Number of pools: 1
2020-07-15 9:11:21 0 [Note] InnoDB: Using generic crc32 instructions
2020-07-15 9:11:21 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-07-15 9:11:21 0 [Note] InnoDB: Completed initialization of buffer pool
2020-07-15 9:11:21 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-07-15 9:11:21 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-07-15 9:11:21 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-07-15 9:11:21 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-07-15 9:11:21 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-07-15 9:11:21 0 [Note] InnoDB: Waiting for purge to start
2020-07-15 9:11:21 0 [Note] InnoDB: 10.3.22 started; log sequence number 46552691; transaction id 115418
2020-07-15 9:11:21 0 [Note] InnoDB: Loading buffer pool(s) from /mnt/dietpi_userdata/mysql/ib_buffer_pool
2020-07-15 9:11:21 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-07-15 9:11:21 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-07-15 9:11:21 0 [Note] Reading of all Master_info entries succeeded
2020-07-15 9:11:21 0 [Note] Added new Master_info '' to hash table
2020-07-15 9:11:21 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.22-MariaDB-0+deb10u1' socket: '/run/mysqld/mysqld.sock' port: 3306 Raspbian 10
2020-07-15 9:11:21 0 [Note] InnoDB: Buffer pool(s) load completed at 200715 9:11:21
DietPi-Services
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
Mode: status
[ OK ] DietPi-Services | redis-server active (running) since Wed 2020-07-15 09:08:53 BST; 8min ago
[ OK ] DietPi-Services | mariadb active (running) since Wed 2020-07-15 09:11:21 BST; 5min ago
[ OK ] DietPi-Services | php7.3-fpm active (running) since Wed 2020-07-15 09:08:57 BST; 8min ago
[ OK ] DietPi-Services | lighttpd active (running) since Wed 2020-07-15 09:08:58 BST; 8min ago
[ OK ] DietPi-Services | cron active (running) since Wed 2020-07-15 09:08:58 BST; 8min ago
[ OK ] DietPi-Services | dropbear active (running) since Wed 2020-07-15 09:08:52 BST; 8min ago
[ OK ] DietPi-Services | dietpi-ramlog active (exited) since Wed 2020-07-15 00:23:15 BST; 8h ago
[ OK ] DietPi-Services | dietpi-preboot active (exited) since Wed 2020-07-15 00:23:15 BST; 8h ago
[ OK ] DietPi-Services | dietpi-boot active (exited) since Wed 2020-07-15 09:08:52 BST; 8min ago
[ OK ] DietPi-Services | dietpi-postboot active (exited) since Wed 2020-07-15 09:08:52 BST; 8min ago
[ INFO ] DietPi-Services | dietpi-wifi-monitor inactive (dead)
well the error was described within your error.log
2020-07-14 23:37:55 0 [ERROR] Bad magic header in tc log
2020-07-14 23:37:55 0 [ERROR] Crash recovery failed. Either correct the problem (if it's, for example, out of memory error) and restart, or delete tc log and start mysqld with --tc-heuristic-recover={commit|rollback}
2020-07-14 23:37:55 0 [ERROR] Can't init tc log
2020-07-14 23:37:55 0 [ERROR] Aborting
Itβs stating that the tc.log is corrupted. And we simply moved tc.log to tc.save. It could have been removed as well
Closing this topic.
Many thanks for helping me make things working again Joulinar
Hi, Iβm using this topic since my issue is kind of similar, I think. I would have given the same name to a new topic.
I upgraded my DietPi instance a on Friday using ~dietpi-update~. Since then I was unable to acces my Nextcloud instance. Then I paniced and try to fix things by restoring an old DietPi backup. The services seem to run fine but the Nextcloud ~error.log~ gives me the following:
[Sun Feb 18 13:19:08.994639 2024] [php7:error] [pid 4133] [client 178.25.242.45:43693] PHP Fatal error: Uncaught Doctrine\\DBAL\\Exception: Failed to connect to the database: An except\
ion occurred in the driver: SQLSTATE[HY000] [1698] Access denied for user 'oc_admin'@'localhost' in /var/www/nextcloud/lib/private/DB/Connection.php:139\nStack trace:\n#0 /var/www/nextc\
loud/3rdparty/doctrine/dbal/src/Connection.php(1519): OC\\DB\\Connection->connect()\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1041): Doctrine\\DBAL\\Connection->g\
etWrappedConnection()\n#2 /var/www/nextcloud/lib/private/DB/Connection.php(261): Doctrine\\DBAL\\Connection->executeQuery()\n#3 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/Query\
Builder.php(345): OC\\DB\\Connection->executeQuery()\n#4 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(281): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#5 /var/ww\
w/nextcloud/lib/private/AppConfig.php(419): OC\\DB\\QueryBuilder\\QueryBuilder->execute()\n#6 /var/www/nextcloud/lib/private/AppConfig.php(184): OC\\AppConfig->loadConfigValues()\n#7 /v\
ar/www/nextcloud/lib/private/AppConfig.php(37 in /var/www/nextcloud/lib/private/DB/Connection.php on line 139
Iβm lost.
somehow Nextcloud database user is not able to connect to database anymore. Usually this has nothing to do with a DietPi update.
Did you have done anything else?
Following need to be done as user root
Show user
mysql -e "SELECT User, Host FROM mysql.user;"
Show database
mysql -e "SHOW DATABASES;"
Ok, I executed those commands but the error remains.
After I restored the backup I ran apt update && apt upgrade
and got this notification:
Then I moved the nextcloud subfolder into the new mysql folder.
these commands are for checking / showing only. It was not intended to fix anything.
Yikes, sorry.
Here are the outputs for those commands:
Hosts:
+-------------+-----------+
| User | Host |
+-------------+-----------+
| mariadb.sys | localhost |
| mysql | localhost |
| root | localhost |
+-------------+-----------+
Database:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| nextcloud |
| performance_schema |
+--------------------+
hmm you are missing the NextCloud database user. Usually following user should be available
root@DietPiOPi5:~# mysql -e "SELECT User, Host FROM mysql.user;"
+-------------+-----------+
| User | Host |
+-------------+-----------+
| oc_admin | % |
| mariadb.sys | localhost |
| mysql | localhost |
| oc_admin | localhost |
| root | localhost |
+-------------+-----------+
You still have the old backup available?
Or you could try to recreate the NC database user.
I restored the old backup and updated the system.
How can do I recreate the NC database user?
means the DB user is still missing? Just to verify
mysql -e "SELECT User, Host FROM mysql.user;"
Yes, the ouput is still the same output.
Could it have something to do with me upgrading from buster to bookworm, back when the system was still fine and NC working as expected?
no, a Destro upgrade should not delete user from MariaDB. Probably this happen due to your restore followed by a reconfiguration of MariaDB.
Theoretically you could try to add the user back. This should show your current database user password:
cat /var/www/nextcloud/config/config.php | grep dbpassword
Output will look like this:
root@DietPi:~# cat /var/www/nextcloud/config/config.php | grep dbpassword
'dbpassword' => 'your_password',
root@DietPi:~#
Take your_password
and set it again as follow
mysql -e CREATE USER 'oc_admin'@localhost IDENTIFIED BY \"your_password\";;
mysql -e GRANT ALL PRIVILEGES on nextcloud.* to 'oc_admin'@localhost;
mysql -e FLUSH privileges;
I executed the commands above with some modifications because I got some syntax errors.
Now there is a the oc_admin user.
The output of mysql -e "SELECT User, Host FROM mysql.user;"
now is:
+-------------+-----------+
| User | Host |
+-------------+-----------+
| mariadb.sys | localhost |
| mysql | localhost |
| oc_admin | localhost |
| root | localhost |
+-------------+-----------+
According to Webmin the new user has All Rights
.
Now the apache2 error.log gives me this:
PHP Warning: PHP Startup: Unable to load dynamic library 'gd.so' (tried: /usr/lib/php/20190902/gd.so (/lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.33' not found (required by /usr/l>
[Wed Feb 21 18:40:18.826858 2024] [mpm_prefork:notice] [pid 627] AH00163: Apache/2.4.56 (Debian) OpenSSL/1.1.1w configured -- resuming normal operations
[Wed Feb 21 18:40:18.827050 2024] [core:notice] [pid 627] AH00094: Command line: '/usr/sbin/apache2'
The NC error.log is empty.
When I check the PHP version via php -v
I get this:
PHP Warning: PHP Startup: Unable to load dynamic library 'gd.so' (tried: /usr/lib/php/20190902/gd.so (/lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.33' not found (required by /usr/lib/arm-linux-gnueabihf/libXpm.so.4)), /usr/lib/php/20190902/gd.so.so (/usr/lib/php/20190902/gd.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.33 (cli) (built: Jun 9 2023 16:51:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies