MariaDB error

Hi, Joulinar could you also help me with this problem? I have exactly same error like Fabio, but today before i want to uninstall Nextcloud (I installed it 2 months ago but didnt even use it) I was just checking settings in dietpi and saw that MardiDB service “failed”. I restarted system and services but it still shows failed.
This is what I got after running your commands:

root@DietPi:~# 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:~# systemctl status mariadb.service
● mariadb.service - MariaDB 10.3.27 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset:
 enabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─dietpi-services_edit.conf
   Active: failed (Result: exit-code) since Mon 2021-03-01 11:59:12 C
ET; 54s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 6332 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/ru
n/mysqld (code=exited, status=0/SUCCESS)
  Process: 6333 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START
_POSITION (code=exited, status=0/SUCCESS)
  Process: 6335 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR
= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemc
tl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/S
UCCESS)
  Process: 6391 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WS
REP_START_POSITION (code=exited, status=1/FAILURE)
 Main PID: 6391 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"

mar 01 11:59:10 DietPi systemd[1]: Starting MariaDB 10.3.27 database server...
mar 01 11:59:10 DietPi mysqld[6391]: 2021-03-01 11:59:10 0 [Note] /usr/sbin/mysq
ld (mysqld 10.3.27-MariaDB-0+deb10u1) starting as process 6391 ...
mar 01 11:59:10 DietPi mysqld[6391]: 2021-03-01 11:59:10 0 [Warning] Could not i
ncrease number of max_open_files to more than 16384 (request: 32186)
mar 01 11:59:10 DietPi mysqld[6391]: 2021-03-01 11:59:10 0 [Warning] Can't creat
e test file /var/lib/mysql/DietPi.lower-test
mar 01 11:59:12 DietPi systemd[1]: mariadb.service: Main
 process exited, code=exited, status=1/FAILURE
mar 01 11:59:12 DietPi systemd[1]: mariadb.service: Fail
ed with result 'exit-code'.
mar 01 11:59:12 DietPi systemd[1]: Failed to start Maria
DB 10.3.27 database server.
root@DietPi:~# 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:~# journalctl -u mariadb
-- Logs begin at Mon 2021-03-01 11:50:30 CET, end at Mon 2021-03-01 12:02:30 CET
. --
mar 01 11:51:01 DietPi systemd[1]: Starting MariaDB 10.3.27 database server...
mar 01 11:51:01 DietPi mysqld[1516]: 2021-03-01 11:51:01 0 [Note] /usr/sbin/mysq
ld (mysqld 10.3.27-MariaDB-0+deb10u1) starting as process 1516 ...
mar 01 11:51:01 DietPi mysqld[1516]: 2021-03-01 11:51:01 0 [Warning] Could not i
ncrease number of max_open_files to more than 16384 (request: 32186)
mar 01 11:51:01 DietPi mysqld[1516]: 2021-03-01 11:51:01 0 [Warning] Can't creat
e test file /var/lib/mysql/DietPi.lower-test
mar 01 11:51:01 DietPi mysqld[1516]: [97B blob data]
mar 01 11:51:01 DietPi mysqld[1516]: 2021-03-01 11:51:01 0 [ERROR] Aborting
mar 01 11:51:01 DietPi systemd[1]: mariadb.service: Main
 process exited, code=exited, status=1/FAILURE
mar 01 11:51:01 DietPi systemd[1]: mariadb.service: Fail
ed with result 'exit-code'.
mar 01 11:51:01 DietPi systemd[1]: Failed to start Maria
DB 10.3.27 database server.
mar 01 11:52:50 DietPi systemd[1]: Starting MariaDB 10.3.27 database server...
mar 01 11:52:50 DietPi mysqld[2632]: 2021-03-01 11:52:50 0 [Note] /usr/sbin/mysq
ld (mysqld 10.3.27-MariaDB-0+deb10u1) starting as process 2632 ...
mar 01 11:52:50 DietPi mysqld[2632]: 2021-03-01 11:52:50 0 [Warning] Could not i
ncrease number of max_open_files to more than 16384 (request: 32186)
mar 01 11:52:50 DietPi mysqld[2632]: 2021-03-01 11:52:50 0 [Warning] Can't creat
e test file /var/lib/mysql/DietPi.lower-test
mar 01 11:52:50 DietPi mysqld[2632]: [97B blob data]
mar 01 11:52:50 DietPi mysqld[2632]: 2021-03-01 11:52:50 0 [ERROR] Aborting
mar 01 11:52:50 DietPi systemd[1]: mariadb.service: Main
 process exited, code=exited, status=1/FAILURE
mar 01 11:52:50 DietPi systemd[1]: mariadb.service: Fail
ed with result 'exit-code'.
mar 01 11:52:50 DietPi systemd[1]: Failed to start Maria
DB 10.3.27 database server.
mar 01 11:57:11 DietPi systemd[1]: Starting MariaDB 10.3.27 database server...
mar 01 11:57:11 DietPi mysqld[5265]: 2021-03-01 11:57:11 0 [Note] /usr/sbin/mysq
ld (mysqld 10.3.27-MariaDB-0+deb10u1) starting as process 5265 ...
mar 01 11:57:11 DietPi mysqld[5265]: 2021-03-01 11:57:11 0 [Warning] Could not i
ncrease number of max_open_files to more than 16384 (request: 32186)
mar 01 11:57:11 DietPi mysqld[5265]: 2021-03-01 11:57:11 0 [Warning] Can't creat
e test file /var/lib/mysql/DietPi.lower-test
mar 01 11:57:13 DietPi systemd[1]: mariadb.service: Main
 process exited, code=exited, status=1/FAILURE
mar 01 11:57:13 DietPi systemd[1]: mariadb.service: Fail
ed with result 'exit-code'.
mar 01 11:57:13 DietPi systemd[1]: Failed to start Maria
DB 10.3.27 database server.
mar 01 11:59:10 DietPi systemd[1]: Starting MariaDB 10.3.27 database server...
mar 01 11:59:10 DietPi mysqld[6391]: 2021-03-01 11:59:10 0 [Note] /usr/sbin/mysq
ld (mysqld 10.3.27-MariaDB-0+deb10u1) starting as process 6391 ...
mar 01 11:59:10 DietPi mysqld[6391]: 2021-03-01 11:59:10 0 [Warning] Could not i
ncrease number of max_open_files to more than 16384 (request: 32186)
mar 01 11:59:10 DietPi mysqld[6391]: 2021-03-01 11:59:10 0 [Warning] Can't creat
e test file /var/lib/mysql/DietPi.lower-test
mar 01 11:59:12 DietPi systemd[1]: mariadb.service: Main
 process exited, code=exited, status=1/FAILURE
mar 01 11:59:12 DietPi systemd[1]: mariadb.service: Fail
ed with result 'exit-code'.
mar 01 11:59:12 DietPi systemd[1]: Failed to start Maria
DB 10.3.27 database server.
mar 01 12:02:28 DietPi systemd[1]: Starting MariaDB 10.3.27 database server...
mar 01 12:02:28 DietPi mysqld[6531]: 2021-03-01 12:02:28 0 [Note] /usr/sbin/mysq
ld (mysqld 10.3.27-MariaDB-0+deb10u1) starting as process 6531 ...
mar 01 12:02:28 DietPi mysqld[6531]: 2021-03-01 12:02:28 0 [Warning] Could not i
ncrease number of max_open_files to more than 16384 (request: 32186)
mar 01 12:02:28 DietPi mysqld[6531]: 2021-03-01 12:02:28 0 [Warning] Can't creat
e test file /var/lib/mysql/DietPi.lower-test
mar 01 12:02:30 DietPi systemd[1]: mariadb.service: Main
 process exited, code=exited, status=1/FAILURE
mar 01 12:02:30 DietPi systemd[1]: mariadb.service: Fail
ed with result 'exit-code'.
mar 01 12:02:30 DietPi systemd[1]: Failed to start Maria
DB 10.3.27 database server.
root@DietPi:~# cat /var/log/mysql/error.log
2021-03-01 11:57:11 0 [ERROR] mysqld: Can't create/write to file '/var/lib/mysql/aria_log_control' (Errcode: 13 "Permission denied")
2021-03-01 11:57:11 0 [ERROR] mysqld: Got error 'Can't create file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2021-03-01 11:57:11 0 [ERROR] Plugin 'Aria' init function returned error.
2021-03-01 11:57:11 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2021-03-01 11:57:11 0 [Note] InnoDB: Using Linux native AIO
2021-03-01 11:57:11 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!
2021-03-01 11:57:11 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-03-01 11:57:11 0 [Note] InnoDB: Uses event mutexes
2021-03-01 11:57:11 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-03-01 11:57:11 0 [Note] InnoDB: Number of pools: 1
2021-03-01 11:57:11 0 [Note] InnoDB: Using generic crc32 instructions
2021-03-01 11:57:11 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-03-01 11:57:11 0 [Note] InnoDB: Completed initialization of buffer pool
2021-03-01 11:57:11 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-03-01 11:57:11 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-03-01 11:57:11 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-03-01 11:57:11 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-03-01 11:57:11 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-03-01 11:57:11 0 [ERROR] InnoDB: Cannot open datafile './ibdata1'
2021-03-01 11:57:11 0 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2021-03-01 11:57:11 0 [ERROR] InnoDB: Database creation was aborted with error Cannot open a file. You may need to delete the ibdata1 file before trying to start up again.
2021-03-01 11:57:11 0 [Note] InnoDB: Starting shutdown...
2021-03-01 11:57:13 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-03-01 11:57:13 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-03-01 11:57:13 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-03-01 11:57:13 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2021-03-01 11:57:13 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2021-03-01 11:57:13 0 [ERROR] Aborting

Warning: Memory not freed: 392
2021-03-01 11:59:10 0 [ERROR] mysqld: Can't create/write to file '/var/lib/mysql/aria_log_control' (Errcode: 13 "Permission denied")
2021-03-01 11:59:10 0 [ERROR] mysqld: Got error 'Can't create file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2021-03-01 11:59:10 0 [ERROR] Plugin 'Aria' init function returned error.
2021-03-01 11:59:10 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2021-03-01 11:59:10 0 [Note] InnoDB: Using Linux native AIO
2021-03-01 11:59:10 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!
2021-03-01 11:59:10 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-03-01 11:59:10 0 [Note] InnoDB: Uses event mutexes
2021-03-01 11:59:10 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-03-01 11:59:10 0 [Note] InnoDB: Number of pools: 1
2021-03-01 11:59:10 0 [Note] InnoDB: Using generic crc32 instructions
2021-03-01 11:59:10 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-03-01 11:59:10 0 [Note] InnoDB: Completed initialization of buffer pool
2021-03-01 11:59:10 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-03-01 11:59:10 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-03-01 11:59:10 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-03-01 11:59:10 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-03-01 11:59:10 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-03-01 11:59:10 0 [ERROR] InnoDB: Cannot open datafile './ibdata1'
2021-03-01 11:59:10 0 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2021-03-01 11:59:10 0 [ERROR] InnoDB: Database creation was aborted with error Cannot open a file. You may need to delete the ibdata1 file before trying to start up again.
2021-03-01 11:59:11 0 [Note] InnoDB: Starting shutdown...
2021-03-01 11:59:12 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-03-01 11:59:12 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-03-01 11:59:12 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-03-01 11:59:12 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2021-03-01 11:59:12 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2021-03-01 11:59:12 0 [ERROR] Aborting

Warning: Memory not freed: 392
2021-03-01 12:02:28 0 [ERROR] mysqld: Can't create/write to file '/var/lib/mysql/aria_log_control' (Errcode: 13 "Permission denied")
2021-03-01 12:02:28 0 [ERROR] mysqld: Got error 'Can't create file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2021-03-01 12:02:28 0 [ERROR] Plugin 'Aria' init function returned error.
2021-03-01 12:02:28 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2021-03-01 12:02:28 0 [Note] InnoDB: Using Linux native AIO
2021-03-01 12:02:28 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!
2021-03-01 12:02:28 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-03-01 12:02:28 0 [Note] InnoDB: Uses event mutexes
2021-03-01 12:02:28 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-03-01 12:02:28 0 [Note] InnoDB: Number of pools: 1
2021-03-01 12:02:28 0 [Note] InnoDB: Using generic crc32 instructions
2021-03-01 12:02:28 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-03-01 12:02:28 0 [Note] InnoDB: Completed initialization of buffer pool
2021-03-01 12:02:28 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-03-01 12:02:28 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-03-01 12:02:28 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-03-01 12:02:28 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2021-03-01 12:02:28 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2021-03-01 12:02:28 0 [ERROR] InnoDB: Cannot open datafile './ibdata1'
2021-03-01 12:02:28 0 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2021-03-01 12:02:28 0 [ERROR] InnoDB: Database creation was aborted with error Cannot open a file. You may need to delete the ibdata1 file before trying to start up again.
2021-03-01 12:02:29 0 [Note] InnoDB: Starting shutdown...
2021-03-01 12:02:30 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-03-01 12:02:30 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-03-01 12:02:30 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-03-01 12:02:30 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2021-03-01 12:02:30 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2021-03-01 12:02:30 0 [ERROR] Aborting

Warning: Memory not freed: 392
root@DietPi:~# readlink /var/lib/mysql
/mnt/dietpi_userdata/mysql
root@DietPi:~# readlink -f /var/lib/mysql
/mnt/dietpi_userdata/mysql

Before that I even try to uninstall Nextcloud but uninstall process was very fast, that was strange.

Hi,

as you have a different issue, I split your topic into an own one.

Looks like your file system permissions are incorrect as you have (Errcode: 13 “Permission denied”)

can you check ls -la /var/lib/mysql/

Oh, for a second I thought that I didn’t apply my post and everything was deleted :stuck_out_tongue: After that I realise that You have split my problem to different topic :rofl: thanks
This is what I got

root@DietPi:~# ls -la /var/lib/mysql/
razem 8
drwxr-xr-x  2 root root 4096 mar  1 11:56 .
drwxr-xr-x 11 root root 4096 mar  1 11:56 ..

there seems to be something wrong. You are missing the entire content of the directory. Do you moved dietpi userdata to a different place like an external disk?

Ye this looks very strange. I didn’t touch anything or move userdata, I was just installing/uninstalling few softs from dietpi optimised section and thats all. Maybe I did something during those few months, but as I remember MariaDB was working fine. Maybe few times I saw Failed status but after restart it worked fine again. Can i somehow repair MariaDB? I tried dietpi-software reinstall 88 command but didnt help, still not working.

last think to verify /mnt/dietpi_userdata/mysql is empty as well?

If yes, you should remove MariaDB as well as Nextcloud form your system and start a new installation

Yes, /mnt/dietpi_userdata/mysql is empty.
I have already uninstalled Nextcloud, should I somehow remove some leftovers from system?
To uninstall and install MariaDB i just use commands dietpi-software uninstall 88 and dietpi-software install 88?
Previously I used command dietpi-software reinstall 88 and it didn’t help :frowning:

PS. Can I somehow reinstall whole DietPi and not loose software configurations (especially Sonarr/Radarr/Plex/HA) if nothing help?
PS2. I just saw that I also have some problem with Docker and containers not starting on reboot system :frowning: I have put HA in Docker and everything was working fine, but now is not. After reboot only 2/9 start and rest I have to start manually ;/ I think I have to make separate topic for it :frowning:

I’m sorry for so many questions and problems, still learning all of this stuff.

dietpi-software reinstall will simply try to install packages again. If the system “believe” the package is already available, it will be skipped. So best would be to really do a deinstallation and a new installation.

DietPi is not saving specific config files. This would need to be done manually.

Regarding Docker container failing, in Portainer you have possibility to check the log for each container. Usually it should give an indication why it is failing.

This is what I got when I run uninstall command

root@DietPi:~# dietpi-software uninstall 88
[  OK  ] DietPi-Software | Initialised database
[  OK  ] DietPi-Software | Reading database

 DietPi-Software
─────────────────────────────────────────────────────
 Mode: Automated uninstall

[  OK  ] DietPi-Software | Uninstalling MariaDB: database

And after it I run install command and got this :frowning:

root@DietPi:~# dietpi-software install 88
[  OK  ] DietPi-Software | Initialised database
[  OK  ] DietPi-Software | Reading database

 DietPi-Software
─────────────────────────────────────────────────────
 Mode: Automated install

[ INFO ] DietPi-Software | 88: MariaDB is already installed
[ INFO ] DietPi-Software | Use "dietpi-software reinstall 88" to force rerun of installation and configuration steps for MariaDB.
[  OK  ] DietPi-Software | No changes applied for: MariaDB

Nothing happens, mysql folder is still empty :frowning:

Pls can you try to run uninstall from inside the dietpi-software menu and not using the command. Just to see if uninstall will behave same.

Running uninstaller from inside dietpi-software gave me this error:

 DietPi-Software
─────────────────────────────────────────────────────
 Mode: Uninstalling MariaDB: database

[FAILED] DietPi-Software | systemctl start mariadb
[FAILED] DietPi-Software | systemctl start mariadb



│  - Command: systemctl start mariadb                                          │
│  - Exit code: 1                                                              │
│  - DietPi version: v7.0.2 (MichaIng/master) | HW_MODEL: 4 | HW_ARCH: 2 |     │
│ DISTRO: 5                                                                    │
│  - Image creator: DietPi Core Team                                           │
│  - Pre-image: Raspbian Lite                                                  │
│  - Error log:                                                                │
│ Job for mariadb.service failed because the control process exited with error │
│ code.                                                                        │
│ See "systemctl status mariadb.service" and "journalctl -xe" for details.     │
│                                                                              │
│     Retry          : Re-run the last command that failed                     │
│     DietPi-Config  : Edit network, APT/NTP mirror settings etc               │
│     Open subshell  : Open a subshell to investigate or solve the issue       │
│     Send report    : Uploads bugreport containing system info to DietPi      │
│                    ●─ Devs only ──────────────────────────────────────●      │
│     Change command : Adjust and rerun the command

And systemctl status mariadb.service gave me:

root@DietPi:~# systemctl status mariadb.service
● mariadb.service - MariaDB 10.3.27 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─dietpi-services_edit.conf
   Active: failed (Result: exit-code) since Wed 2021-03-03 09:52:56 CET; 2min 25s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 20412 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
  Process: 20413 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 20415 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status
=0/SUCCESS)
  Process: 20472 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
 Main PID: 20472 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"

mar 03 09:52:54 DietPi systemd[1]: Starting MariaDB 10.3.27 database server...
mar 03 09:52:54 DietPi mysqld[20472]: 2021-03-03  9:52:54 0 [Note] /usr/sbin/mysqld (mysqld 10.3.27-MariaDB-0+deb10u1) starting as process 20472 ...
mar 03 09:52:54 DietPi mysqld[20472]: 2021-03-03  9:52:54 0 [Warning] Could not increase number of max_open_files to more than 16384 (request: 32186)
mar 03 09:52:54 DietPi mysqld[20472]: 2021-03-03  9:52:54 0 [Warning] Can't create test file /var/lib/mysql/DietPi.lower-test
mar 03 09:52:56 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
mar 03 09:52:56 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
mar 03 09:52:56 DietPi systemd[1]: Failed to start MariaDB 10.3.27 database server.

I don’t know if this is important but I have system installed on external SSD, but I never moved manually any userdata files, folders etc. Just installed system on SSD with uasp enabled without any problems and is working on it for months.

ah yes, sorry, DietPi is trying to start MariaDB before it goes to remove the packages

let’s try it manually

G_AGP mariadb-server
rm -Rf /{mnt/dietpi_userdata,var/lib,var/log,etc}/mysql

this should clean the installation of MariaDB. If this was working, you would need to set aSOFTWARE_INSTALL_STATE[88]=0 inside /boot/dietpi/.installed to clear the installation status. Now, you should be able to install MariaDB again.

The CLI issue was fixed with: https://github.com/MichaIng/DietPi/commit/6449f910b6f4f7397dbf99fd16a02410eb912271
Changelog: https://github.com/MichaIng/DietPi/commit/2fef0dcfe0f16408e99d6ed360d6c8ba4a407530

Many thanks for reporting the issue.

Yeah uninstalling MariaDB is not possible as long as the service cannot start, since it does a database dump. Theoretically we could skip this step, but database content usually is the very most sensible and important data for any software title, so I’d like to keep this step as a measure against accidents. One alternative could be, if the service start fails, to leave the raw database directory in place instead. It is not as good as a database dump, since it cannot easily be imported into any other database server, but with a proper warning it should be fine?

But since you don’t use the MariaDB server anymore, the commands suggested by Joulinar are pretty fine to purge it.

Strange think is after that commands MariaDB service still exist, dietpi-services shows it on list as ‘failed’ service. Rebooting system doesn’t help.
Or maybe MariaDB and MariaDB Service are two different things? :face_with_raised_eyebrow:

Pushing dietpi-software install 88 give me:

[  OK  ] DietPi-Software | Initialised database
[  OK  ] DietPi-Software | Reading database

 DietPi-Software
─────────────────────────────────────────────────────
 Mode: Automated install

[  OK  ] DietPi-Software | Installing MariaDB: database
[  OK  ] DietPi-Software | Free space check: path=/ | available=76757 MiB | required=500 MiB
[  OK  ] DietPi-Software | DietPi-Userdata validation: /mnt/dietpi_userdata
[  OK  ] DietPi-Software | Checking network connectivity
[  OK  ] DietPi-Software | Checking DNS resolver
[  OK  ] Network time sync | Completed
[ SUB1 ] DietPi-Services > unmask
[  OK  ] DietPi-Services | unmask : proftpd
[  OK  ] DietPi-Services | unmask : redis-server
[  OK  ] DietPi-Services | unmask : mariadb
[  OK  ] DietPi-Services | unmask : php7.3-fpm
[  OK  ] DietPi-Services | unmask : lighttpd
[  OK  ] DietPi-Services | unmask : transmission-daemon
[  OK  ] DietPi-Services | unmask : plexmediaserver
[  OK  ] DietPi-Services | unmask : jackett
[  OK  ] DietPi-Services | unmask : sonarr
[  OK  ] DietPi-Services | unmask : radarr
[  OK  ] DietPi-Services | unmask : bazarr
[  OK  ] DietPi-Services | unmask : docker
[  OK  ] DietPi-Services | unmask : cron
[ SUB1 ] DietPi-Services > stop
[  OK  ] DietPi-Services | stop : cron
[  OK  ] DietPi-Services | stop : docker
[  OK  ] DietPi-Services | stop : bazarr
[  OK  ] DietPi-Services | stop : radarr
[  OK  ] DietPi-Services | stop : sonarr
[  OK  ] DietPi-Services | stop : jackett
[  OK  ] DietPi-Services | stop : plexmediaserver
[  OK  ] DietPi-Services | stop : transmission-daemon
[  OK  ] DietPi-Services | stop : lighttpd
[  OK  ] DietPi-Services | stop : php7.3-fpm
[  OK  ] DietPi-Services | stop : mariadb
[  OK  ] DietPi-Services | stop : redis-server
[  OK  ] DietPi-Services | stop : proftpd
[  OK  ] DietPi-Software | mkdir -p /mnt/dietpi_userdata/Music /mnt/dietpi_userdata/Pictures /mnt/dietpi_userdata/Video /mnt/dietpi_userdata/downloads /var/www /opt
[  OK  ] DietPi-Software | chown dietpi:dietpi /mnt/dietpi_userdata/Music /mnt/dietpi_userdata/Pictures /mnt/dietpi_userdata/Video /mnt/dietpi_userdata/downloads
[  OK  ] DietPi-Software | chmod 775 /mnt/dietpi_userdata/Music /mnt/dietpi_userdata/Pictures /mnt/dietpi_userdata/Video /mnt/dietpi_userdata/downloads
[ INFO ] DietPi-Software | APT update, please wait...
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:2 https://download.docker.com/linux/raspbian buster InRelease
Hit:3 https://downloads.plex.tv/repo/deb public InRelease
Hit:4 https://download.mono-project.com/repo/debian stable-buster InRelease
Hit:5 https://download.mono-project.com/repo/debian raspbianbuster InRelease
Ign:6 https://mediaarea.net/repo/deb/raspbian buster InRelease
Hit:7 https://mediaarea.net/repo/deb/raspbian buster Release
Hit:8 https://archive.raspberrypi.org/debian buster InRelease
Hit:9 https://apt.sonarr.tv/debian buster InRelease
Reading package lists...
[  OK  ] DietPi-Software | APT update

 DietPi-Software
─────────────────────────────────────────────────────
 Mode: Checking for prerequisite software

[ SUB1 ] DietPi-Services > stop
[  OK  ] DietPi-Services | stop : cron
[  OK  ] DietPi-Services | stop : docker
[  OK  ] DietPi-Services | stop : bazarr
[  OK  ] DietPi-Services | stop : radarr
[  OK  ] DietPi-Services | stop : sonarr
[  OK  ] DietPi-Services | stop : jackett
[  OK  ] DietPi-Services | stop : plexmediaserver
[  OK  ] DietPi-Services | stop : transmission-daemon
[  OK  ] DietPi-Services | stop : lighttpd
[  OK  ] DietPi-Services | stop : php7.3-fpm
[  OK  ] DietPi-Services | stop : mariadb
[  OK  ] DietPi-Services | stop : redis-server
[  OK  ] DietPi-Services | stop : proftpd

 DietPi-Software
─────────────────────────────────────────────────────
 Mode: Installing MariaDB: database

[ INFO ] DietPi-Software | Preparing database directory at: /mnt/dietpi_userdata/mysql
[  OK  ] DietPi-Software | rm -f /mnt/dietpi_userdata/mysql
[  OK  ] DietPi-Software | mkdir -p /mnt/dietpi_userdata/mysql
[  OK  ] DietPi-Software | rm -Rf /var/lib/mysql
[  OK  ] DietPi-Software | ln -s /mnt/dietpi_userdata/mysql /var/lib/mysql
[ INFO ] DietPi-Software | APT install for: mariadb-server php7.3-mysql, please wait...
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package mariadb-server.
(Reading database ... 64322 files and directories currently installed.)
Preparing to unpack .../mariadb-server_1%3a10.3.27-0+deb10u1_all.deb ...
Unpacking mariadb-server (1:10.3.27-0+deb10u1) ...
Setting up mariadb-server (1:10.3.27-0+deb10u1) ...
[  OK  ] DietPi-Software | APT install for: mariadb-server php7.3-mysql
[ SUB1 ] DietPi-Services > stop
[  OK  ] DietPi-Services | stop : cron
[  OK  ] DietPi-Services | stop : docker
[  OK  ] DietPi-Services | stop : bazarr
[  OK  ] DietPi-Services | stop : radarr
[  OK  ] DietPi-Services | stop : sonarr
[  OK  ] DietPi-Services | stop : jackett
[  OK  ] DietPi-Services | stop : plexmediaserver
[  OK  ] DietPi-Services | stop : transmission-daemon
[  OK  ] DietPi-Services | stop : lighttpd
[  OK  ] DietPi-Services | stop : php7.3-fpm
[  OK  ] DietPi-Services | stop : mariadb
[  OK  ] DietPi-Services | stop : redis-server
[  OK  ] DietPi-Services | stop : proftpd

 DietPi-Software
─────────────────────────────────────────────────────
 Mode: Configuring MariaDB: database

[ INFO ] DietPi-Software | Assuring 4-byte support and InnoDB Barracuda file format with large prefix
/boot/dietpi/dietpi-software: line 7683: /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf: No such file or directory
sed: can't read /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf: No such file or directory
sed: can't read /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf: No such file or directory
[ SUB1 ] DietPi-Services > dietpi_controlled
[  OK  ] DietPi-Services | dietpi_controlled : proftpd
[  OK  ] DietPi-Services | dietpi_controlled : redis-server
[  OK  ] DietPi-Services | dietpi_controlled : mariadb
[  OK  ] DietPi-Services | dietpi_controlled : php7.3-fpm
[  OK  ] DietPi-Services | dietpi_controlled : lighttpd
[  OK  ] DietPi-Services | dietpi_controlled : transmission-daemon
[  OK  ] DietPi-Services | dietpi_controlled : plexmediaserver
[  OK  ] DietPi-Services | dietpi_controlled : jackett
[  OK  ] DietPi-Services | dietpi_controlled : sonarr
[  OK  ] DietPi-Services | dietpi_controlled : radarr
[  OK  ] DietPi-Services | dietpi_controlled : bazarr
[  OK  ] DietPi-Services | dietpi_controlled : docker
[  OK  ] DietPi-Services | dietpi_controlled : cron
[ SUB1 ] DietPi-Set_hardware > headless (disable)
[  OK  ] DietPi-Set_hardware | Desired setting in /boot/dietpi.txt was already set: AUTO_SETUP_HEADLESS=0
[  OK  ] headless disable | Completed
[  OK  ] DietPi-Survey | Sending survey data

 DietPi-Software
─────────────────────────────────────────────────────
 Mode: Installation completed

[ SUB1 ] DietPi-Services > restart
[  OK  ] DietPi-Services | restart : proftpd
[  OK  ] DietPi-Services | restart : redis-server
[FAILED] DietPi-Services | restart : mariadb
[  OK  ] DietPi-Services | restart : php7.3-fpm
[  OK  ] DietPi-Services | restart : lighttpd
[  OK  ] DietPi-Services | restart : transmission-daemon
[  OK  ] DietPi-Services | restart : plexmediaserver
[  OK  ] DietPi-Services | restart : jackett
[  OK  ] DietPi-Services | restart : sonarr
[  OK  ] DietPi-Services | restart : radarr
[  OK  ] DietPi-Services | restart : bazarr
[  OK  ] DietPi-Services | restart : docker
[  OK  ] DietPi-Services | restart : cron

Dietpi-Services still unmask and stop mariadb that shouldnt really exist. And after all I receive failed mariadb service :frowning:

Hi MichaIng, I’m glad that I could somehow help with finding this issue and thank you so much for mentioning me in changelog :open_mouth: :smiley: Still learning stuff so this is kind of new for me.
As you see I still have some problems and I’m not sure if I should maybe reinstall whole system and start from zero, because this looks like I messed up something and somehow at some point and now I’m wasting your time.
Could you tell me for what would I even need MariaDB? It is needed only for Nextcloud in my situation? Tbh I want to install in near future Nextcloud again after I finish setting up HA Supervisor in Docker.

looking to your services, it seems MariaDB is used on NextCloud only. Before going to kill you system and start from scratch, one last try to setup the database :slight_smile:

G_AGP mariadb-server
G_AGA
rm -Rf /{mnt/dietpi_userdata,var/lib,var/log,etc}/mysql
mkdir /mnt/dietpi_userdata/mysql
ln -s /mnt/dietpi_userdata/mysql /var/lib/mysql
apt install mariadb-server
systemctl status mariadb

Yes, like in the other issue, purging the actual MariaDB server packages was missing (hence the still active service). “mariadb-server” is just a dummy package that pulls in mariadb-server-10.3, the actual server package on Debian/Raspbian Buster.

But installing it again is not necessary if Nextcloud is not used anymore? Or just to do a clean uninstall of both?
Otherwise, to remove all traces manually, after the packages have been purged and autopurged (G_AGA):

rm -Rf /var/www/nextcloud /mnt/dietpi_userdata/nextcloud_data
rm -Rf /{mnt/dietpi_userdata,var/lib,var/log,etc}/mysql
sed -i '/aSOFTWARE_INSTALL_STATE\[88\]/c\aSOFTWARE_INSTALL_STATE\[88\]=0' /boot/dietpi/.installed
sed -i '/aSOFTWARE_INSTALL_STATE\[114\]/c\aSOFTWARE_INSTALL_STATE\[114\]=0' /boot/dietpi/.installed

Yesss, this finally helped me :slight_smile: I get rid of MariaDB and Failed service status. Now system is prepared for future clean Nextcloud install (I hope so haha :wink: ). Thank you very much MichaIng and Joulinar for help and sorry for late replay. Cheers!

ok perfect that it is working now