It‘s difficult to repeat, I tried different things. Mainly I uninstalled and re-installed mariadb but as said the problem remains unfortunately.
root@DietPi:~# systemctl cat mariadb.service
# /lib/systemd/system/mariadb.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/mariadb.service",
# containing
# .include /usr/lib/systemd/system/mariadb.service
# ...make your changes here...
# or create a file "/etc/systemd/system/mariadb.service.d/foo.conf",
# which doesn't need to include ".include" call and which will be parsed
# after the file mariadb.service itself is parsed.
#
# For more info about custom unit files, see systemd.unit(5) or
# https://mariadb.com/kb/en/mariadb/systemd/
#
# Copyright notice:
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=MariaDB 10.5.26 database server
Documentation=man:mariadbd(8)
Documentation=https://mariadb.com/kb/en/library/systemd/
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
##############################################################################
## Core requirements
##
Type=notify
# Setting this to true can break replication and the Type=notify settings
# See also bind-address mariadbd option.
PrivateNetwork=false
##############################################################################
## Package maintainers
##
User=mysql
Group=mysql
# CAP_IPC_LOCK To allow memlock to be used as non-root user
# CAP_DAC_OVERRIDE To allow auth_pam_tool (which is SUID root) to read /etc/shadow when it's chmod 0
# does nothing for non-root, not needed if /etc/shadow is u+r
# CAP_AUDIT_WRITE auth_pam_tool needs it on Debian for whatever reason
AmbientCapabilities=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
# PrivateDevices=true implies NoNewPrivileges=true and
# SUID auth_pam_tool suddenly doesn't do setuid anymore
PrivateDevices=false
# Prevent writes to /usr, /boot, and /etc
ProtectSystem=full
# Doesn't yet work properly with SELinux enabled
# NoNewPrivileges=true
# Prevent accessing /home, /root and /run/user
ProtectHome=true
# Execute pre and post scripts as root, otherwise it does it as User=
PermissionsStartOnly=true
ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld
# Perform automatic wsrep recovery. When server is started without wsrep,
# galera_recovery simply returns an empty string. In any case, however,
# the script is not expected to return with a non-zero status.
# It is always safe to unset _WSREP_START_POSITION environment variable.
# Do not panic if galera_recovery script is not available. (MDEV-10538)
ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
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"
# Needed to create system tables etc.
# ExecStartPre=/usr/bin/mysql_install_db -u mysql
# Start main service
# MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
# Use the [Service] section and Environment="MYSQLD_OPTS=...".
# This isn't a replacement for my.cnf.
# _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster
ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
# Unset _WSREP_START_POSITION environment variable.
ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
ExecStartPost=/etc/mysql/debian-start
KillSignal=SIGTERM
# Don't want to see an automated SIGKILL ever
SendSIGKILL=no
# Restart crashed server only, on-failure would also restart, for example, when
# my.cnf contains unknown option
Restart=on-abort
RestartSec=5s
UMask=007
##############################################################################
## USERs can override
##
##
## by creating a file in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
## and adding/setting the following under [Service] will override this file's
## settings.
# Useful options not previously available in [mysqld_safe]
# Kernels like killing mariadbd when out of memory because its big.
# Lets temper that preference a little.
# OOMScoreAdjust=-600
# Explicitly start with high IO priority
# BlockIOWeight=1000
# If you don't use the /tmp directory for SELECT ... OUTFILE and
# LOAD DATA INFILE you can enable PrivateTmp=true for a little more security.
PrivateTmp=false
# Set an explicit Start and Stop timeout of 900 seconds (15 minutes!)
# this is the same value as used in SysV init scripts in the past
# Galera might need a longer timeout, check the KB if you want to change this:
# https://mariadb.com/kb/en/library/systemd/#configuring-the-systemd-service-timeout
TimeoutStartSec=900
TimeoutStopSec=900
# Set the maximium number of tasks (threads) to 99% of what the system can
# handle as set by the kernel, reserve the 1% for a remote ssh connection,
# some monitoring, or that backup cron job. Without the directive this would
# be 15% (see DefaultTasksMax in systemd man pages).
TasksMax=99%
##
## Options previously available to be set via [mysqld_safe]
## that now needs to be set by systemd config files as mysqld_safe
## isn't executed.
##
# Number of files limit. previously [mysqld_safe] open-files-limit
LimitNOFILE=32768
# Maximium core size. previously [mysqld_safe] core-file-size
# LimitCore=
# Nice priority. previously [mysqld_safe] nice
# Nice=-5
# Timezone. previously [mysqld_safe] timezone
# Environment="TZ=UTC"
# Library substitutions. previously [mysqld_safe] malloc-lib with explicit paths
# (in LD_LIBRARY_PATH) and library name (in LD_PRELOAD).
# Environment="LD_LIBRARY_PATH=/path1 /path2" "LD_PRELOAD=
# Flush caches. previously [mysqld_safe] flush-caches=1
# ExecStartPre=sync
# ExecStartPre=sysctl -q -w vm.drop_caches=3
# numa-interleave=1 equalivant
# Change ExecStart=numactl --interleave=all /usr/sbin/mariadbd......
# crash-script equalivent
# FailureAction=
# /etc/systemd/system/mariadb.service.d/dietpi.conf
[Unit]
Before=cron.service
root@DietPi:~#
As a workaround you can try to comment out this line within /lib/systemd/system/mariadb.service. That should at least allow MariaDB to start again. But I’m not sure about the side effects.
The database is now starting, but has a different problem now.
Usually this error occurs when MariaDB server is attempting to create or modify files in a directory where it does not have sufficient permissions or if the database directory is mounted as read-only.
Can you check for kernel error messages
dmesg -l 0,1,2,3
and some more information on your file system
readlink /var/lib/mysql
readlink -f /var/lib/mysql
ls -la /mnt/dietpi_userdata/mysql
root@DietPi:~# dmesg -l 0,1,2,3
[ 0.363155] i2c i2c-2: of_i2c: invalid reg on /i2c@b0178000/mpu6515@68
[ 0.384019] atc260x_i2c 0-0065: icm_ohm not config, use default value
[ 0.408483] atc260x-switch-ldo atc2603c-switch1.1: pmic_ver=0
[ 0.413136] atc260x-pm atc2603c-pm.0: _set_s2_mode() can not get of_property s2_mode
[ 0.916716] owl_dss DSI: error!dsihw_parse_params, fail to get lcd reset gpio
[ 0.965995] no blk dev
[ 0.966008] read MiscInfoHeader failed
[ 0.966017] read Head failed
[ 0.966026] OWL_HDMI_ERR: failed to read hdcp key from secure storage
[ 0.966609] Bluetooth: HCI Realtek H5 protocol registration failed
[ 0.978309] pcm512x 2-004c: Failed to reset device: -6
[ 0.978888] pcm512x 2-004d: Failed to reset device: -6
[ 0.983358] [SNDRV]:[atc2603a_get_cfg] Fail to get device_node
[ 0.983370] [SNDRV]:[atc2603a_init] audio get cfg failed!
[ 0.983720] [SNDRV]:[atc2603c_platform_probe] atc2603c_platform_probe
[ 0.983746] [SNDRV]:[atc2603c_platform_probe] what's my lucky draw 220
[ 0.984199] [SNDRV]:[atm7059_dai_probe] it's ok 0
[ 0.984952] [SNDRV]:[atm7059_link_init] atm7059_link_init
[ 0.985000] [SNDRV]:[atm7059_audio_gpio_init] find i2s_switch_gpio property fail
[ 0.985014] [SNDRV]:[atm7059_audio_gpio_init] find earphone_detect_gpios property fail
[ 0.985038] [SNDRV]:[atm7059_audio_gpio_init] GPIO[126] request failed
[ 0.985049] [SNDRV]:[atm7059_link_init] maybe using irq
[ 1.130137] atc2603c-audio atc260x-audio: ASoC: Failed to add route AOUT FL FR Mixer -> AOUT MIXER -> ADC0 Mux
[ 1.142994] train_Msize:1024, train_ces:1
[ 1.164735] start:0xc0008000, end:0xc0bff2d8, checksum:0xf0b02035
[ 2.967256] read_mi_head, line 429, magic 0x0, length 0, item num 0
[ 2.967288] read Head null
[ 2.967310] OWL_HDMI_ERR: failed to read hdcp key from secure storage
[ 5.872336] FAT-fs (mmcblk0p1): codepage cp437 not found
[ 5.874146] FAT-fs (mmcblk0p1): codepage cp437 not found
[ 5.876809] EXFAT: Codepage cp437 not found
[ 8.438388] EXT3-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (240)
[ 8.438819] EXT2-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (240)
[ 11.737691] set port reset!80
[ 11.818074] found sparky chip 80e46316d0d4997 provisioned
[ 11.818250] idx 389 newmac 17f7010186
[ 11.862094] set port reset!80
[ 11.971416] atc260x-irkeypad atc2603c-irkeypad.0: Get ir_ch failed ret = -22
[ 12.157735] set port reset!80
[ 12.277941] set port reset!80
[ 13.038473] proc: unrecognized mount option "hidepid=invisible" or missing value
[ 20.123082] proc: unrecognized mount option "hidepid=invisible" or missing value
root@DietPi:~#
root@DietPi:~# readlink /var/lib/mysql
readlink -f /var/lib/mysql
ls -la /mnt/dietpi_userdata/mysql
/mnt/dietpi_userdata/mysql
/mnt/dietpi_userdata/mysql
total 12396
drwxr-xr-x 5 mysql mysql 4096 Jan 1 21:29 .
drwxrwxr-x 9 dietpi dietpi 4096 Dec 18 2021 ..
drwx------ 2 mysql mysql 4096 Mar 20 2022 allo
-rw-rw---- 1 mysql mysql 73728 Jan 1 21:29 aria_log.00000001
-rw-rw---- 1 mysql mysql 52 Jan 1 21:29 aria_log_control
-rw-r--r-- 1 root root 0 Jan 1 15:06 debian-10.5.flag
-rw-rw---- 1 mysql mysql 1590 Jan 1 15:01 ib_buffer_pool
-rw-rw---- 1 mysql mysql 12582912 Jan 1 15:01 ibdata1
-rw-rw---- 1 mysql mysql 0 Dec 18 2021 multi-master.info
drwx------ 2 mysql mysql 4096 Dec 18 2021 mysql
-rw-rw---- 1 root mysql 16 Dec 18 2021 mysql_upgrade_info
drwx------ 2 mysql mysql 4096 Dec 18 2021 performance_schema
root@DietPi:~#
The crazy thing is I didn‘t change anything but just performing the dietpi update and the problem started.
I don’t think it has anything to do with the DietPi update directly. It is more likely that other apt packages were also updated or the error was triggered by the restart and was already present.
At least with the directory and the permissions everything seems to be correct.
What about the available disk space?
df -h
BTW: if you have backup done beforehand, you could try to restore this to get your service back