NC28.0.5.1 "Internal Server Error" and MariaDB 10.6.18 doesn't start

Hi guys.

I have a problem with my MariaDB 10.6.18 in Nextcloud 28.0.5.1 and hope that somebody can solve it.
My Ubuntu 22.04.4 LTS (Jammy) is in a LXD-Container (bridged network) on my QNAP TS-230 (1x8TB-Disc (df -h → Avail: 221G, Use%: 97%, Mounted on: / ), 1.2GB RAM (~400MB free), 64-Bit ARM-Processor)
I also use a Nginx-Reverse-Proxy (2.10.4) on a docker container on my QNAP-NAS.
My NC28 runs on an Apache2 (2.4.52) server with PHP 8.1.2-1ubuntu2.18 (cli) (built: Jun 14 2024 15:52:55).

When I try to open the website of my Nextcloud I get this:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

I found out that my mysql database is not working.

When I try mysql -u root -p I get this:
ERROR 2002 (HY000): Can’t connect to local server through socket ‘/run/mysqld/mysqld.sock’ (2)

mysqld_safe --skip-grant-tables & seems not to stay running.

240621 17:46:21 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql

But I can’t find a process (ps xa) of mysql or mariadb running.

Various (test) changes in the following files have unfortunately not led to any success, but there I am not sure, if here all possible was tested:

/etc/mysql/my.cnf
/etc/mysql/mariadb.cnf
/etc/mysql/conf.d/.cnf
/etc/mysql/mariadb.conf.d/
.cnf
~/.my.cnf

After a systemctl restart mariadb, systemctl restart mariadb.service or systemctl restart mysql I get this:

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

systemctl status mariadb.service gets messages as follows:

× mariadb.service - MariaDB 10.6.18 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /run/systemd/system/service.d
└─zzz-lxc-service.conf
Active: failed (Result: exit-code) since Fri 2024-06-21 17:28:11 UTC; 8min ago
Docs: man:mariadbd(8)
systemd - MariaDB Knowledge Base
Process: 4876 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 4877 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 4879 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: 4911 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=218/CAPABILITIES)
Main PID: 4911 (code=exited, status=218/CAPABILITIES)

Jun 21 17:28:11 Nextcloud systemd[1]: Starting MariaDB 10.6.18 database server…
Jun 21 17:28:11 Nextcloud systemd[4911]: mariadb.service: Failed to apply ambient capabilities (before UID change): Operation not supported
Jun 21 17:28:11 Nextcloud systemd[4911]: mariadb.service: Failed at step CAPABILITIES spawning /usr/sbin/mariadbd: Operation not supported
Jun 21 17:28:11 Nextcloud systemd[1]: mariadb.service: Main process exited, code=exited, status=218/CAPABILITIES
Jun 21 17:28:11 Nextcloud systemd[1]: mariadb.service: Failed with result ‘exit-code’.
Jun 21 17:28:11 Nextcloud systemd[1]: Failed to start MariaDB 10.6.18 database server.

journalctl -xeu mariadb.service says:

░░ Defined-By: systemd
░░ Support: Enterprise open source support | Ubuntu
░░
░░ An ExecStart= process belonging to unit mariadb.service has exited.
░░
░░ The process’ exit code is ‘exited’ and its exit status is 218.
Jun 21 17:27:13 Nextcloud systemd[1]: mariadb.service: Failed with result ‘exit-code’.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: Enterprise open source support | Ubuntu
░░
░░ The unit mariadb.service has entered the ‘failed’ state with result ‘exit-code’.
Jun 21 17:27:13 Nextcloud systemd[1]: Failed to start MariaDB 10.6.18 database server.
░░ Subject: A start job for unit mariadb.service has failed
░░ Defined-By: systemd
░░ Support: Enterprise open source support | Ubuntu
░░
░░ A start job for unit mariadb.service has finished with a failure.
░░
░░ The job identifier is 2834 and the job result is failed.
Jun 21 17:28:11 Nextcloud systemd[1]: Starting MariaDB 10.6.18 database server…
░░ Subject: A start job for unit mariadb.service has begun execution
░░ Defined-By: systemd
░░ Support: Enterprise open source support | Ubuntu
░░
░░ A start job for unit mariadb.service has begun execution.
░░
░░ The job identifier is 2881.
Jun 21 17:28:11 Nextcloud systemd[4911]: mariadb.service: Failed to apply ambient capabilities (before UID change): Operation not supported
Jun 21 17:28:11 Nextcloud systemd[4911]: mariadb.service: Failed at step CAPABILITIES spawning /usr/sbin/mariadbd: Operation not supported
░░ Subject: Process /usr/sbin/mariadbd could not be executed
░░ Defined-By: systemd
░░ Support: Enterprise open source support | Ubuntu
░░
░░ The process /usr/sbin/mariadbd could not be executed and failed.
░░
░░ The error number returned by this process is ERRNO.
Jun 21 17:28:11 Nextcloud systemd[1]: mariadb.service: Main process exited, code=exited, status=218/CAPABILITIES
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: Enterprise open source support | Ubuntu
░░
░░ An ExecStart= process belonging to unit mariadb.service has exited.
░░
░░ The process’ exit code is ‘exited’ and its exit status is 218.
Jun 21 17:28:11 Nextcloud systemd[1]: mariadb.service: Failed with result ‘exit-code’.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: Enterprise open source support | Ubuntu
░░
░░ The unit mariadb.service has entered the ‘failed’ state with result ‘exit-code’.
Jun 21 17:28:11 Nextcloud systemd[1]: Failed to start MariaDB 10.6.18 database server.
░░ Subject: A start job for unit mariadb.service has failed
░░ Defined-By: systemd
░░ Support: Enterprise open source support | Ubuntu
░░
░░ A start job for unit mariadb.service has finished with a failure.
░░
░░ The job identifier is 2881 and the job result is failed.

If it’s possible, I would like to keep my database. Maybe there are files (or the user’s data) I could take over if mysql needs to be reinstalled.

Many thanks in advance.

Greetings Bodo08

Ok guys.
I found a solution by myself… with a little help by chatgpt… very sad…
I hoped for help in this forum.

In file /lib/systemd/system/mariadb.service had been set an option AmbientCapabilities=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE which causes the mysql-service to crash.

I commented this option so that it is disabled.
(I also could set AmbientCapabilities= with the same result)

From that point my nextcloud worked fine again in all ways.
But I am not really sure, what this option does and if I maybe need it.

Is anybody here who can explain if I need that option and for what app or system it is used?
Also I don’t know why and how this option was set.

An answer here would be great.

Thanks in advance.
Greetings Bodo08.