p2@P2:~$sudo systemctl restart mariadb
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
p2@P2:~$sudo systemctl status mariadb
mariadb.service - MariaDB 10.3.31 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
Active: failed (Result: exit-code) since Fri 2021-08-13 15:13:46 CEST; 5min ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 313918 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 313919 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 313921 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSRE>
Process: 313968 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=127)
Main PID: 313968 (code=exited, status=127)
srp 13 15:13:46 P2 systemd[1]: Starting MariaDB 10.3.31 database server...
srp 13 15:13:46 P2 mysqld[313968]: /usr/sbin/mysqld: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory
srp 13 15:13:46 P2 systemd[1]: mariadb.service: Main process exited, code=exited, status=127/n/a
srp 13 15:13:46 P2 systemd[1]: mariadb.service: Failed with result 'exit-code'.
srp 13 15:13:46 P2 systemd[1]: Failed to start MariaDB 10.3.31 database server.
srp 13 15:13:46 P2 mysqld[313968]: /usr/sbin/mysqld: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory
Okay, so mariaDB can't find the liblz4-1 library. However:
Package liblz4-1 is installed and up to date. liblz4.so.1 is installed at /lib/x86_64-linux-gnu/liblz4.so.1
If we run mariaDB by itself:
p2@P2:~$ /usr/sbin/mysqld
/usr/sbin/mysqld: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory
But if we run ldd on mariaDB to find the required libraries:
p2@P2:~$ ldd /usr/sbin/mysqld
linux-vdso.so.1 (0x00007ffe322c0000)
liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fa0406cd000)
libsnappy.so.1 => /lib/x86_64-linux-gnu/libsnappy.so.1 (0x00007fa0406c2000)
libaio.so.1 => /lib/x86_64-linux-gnu/libaio.so.1 (0x00007fa0406bd000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fa0406a1000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fa04062e000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fa0405f3000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fa040542000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa04053c000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fa04035a000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa04020b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa0401e8000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa03fff6000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa03ffd9000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa03ffce000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fa03ffa5000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fa03fe87000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa0423ec000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fa03fe64000)
ldd can find the library! (If it couldn't it would output liblz4.so.1 => not found)
Okay, so what causes this error and how do I get mariaDB to run?
Additional note: Some very deep diving on the internet revealed that this issue may be due to a missing/broken library loader. However, I suspect the advice given is outdated, since their issues are caused my multiple architectures, and the packages in my system are 64-bit. Also, the loaders they are referring to don't exist on my distribution.
Also, I'm using Ubuntu 20.04.2 LTS.
edit: library checksums
find / -name "liblz4.so*" -type f 2> /dev/null | xargs sha256sum
536ab2f5d4448fd1ff62d43b99ece092ec7824b083af7c7007bb0889353d2777 /snap/snap-store/542/usr/lib/x86_64-linux-gnu/liblz4.so.1.7.1
536ab2f5d4448fd1ff62d43b99ece092ec7824b083af7c7007bb0889353d2777 /snap/snap-store/547/usr/lib/x86_64-linux-gnu/liblz4.so.1.7.1
c619a6d991c87ec2967b2b0c417ae5a9b86a76f11396ff5492947b4f637369db /snap/snapd/12704/usr/lib/x86_64-linux-gnu/liblz4.so.1.7.1
c619a6d991c87ec2967b2b0c417ae5a9b86a76f11396ff5492947b4f637369db /snap/snapd/12398/usr/lib/x86_64-linux-gnu/liblz4.so.1.7.1
c619a6d991c87ec2967b2b0c417ae5a9b86a76f11396ff5492947b4f637369db /snap/core/11420/usr/lib/x86_64-linux-gnu/liblz4.so.1.7.1
c619a6d991c87ec2967b2b0c417ae5a9b86a76f11396ff5492947b4f637369db /snap/core/11316/usr/lib/x86_64-linux-gnu/liblz4.so.1.7.1
536ab2f5d4448fd1ff62d43b99ece092ec7824b083af7c7007bb0889353d2777 /snap/core18/2128/usr/lib/x86_64-linux-gnu/liblz4.so.1.7.1
536ab2f5d4448fd1ff62d43b99ece092ec7824b083af7c7007bb0889353d2777 /snap/core18/2074/usr/lib/x86_64-linux-gnu/liblz4.so.1.7.1
d6574e34006e27cfb5d00dc75018cc06832d0bbc9e1b35316b9c03148355f0a0 /usr/lib/x86_64-linux-gnu/liblz4.so.1.9.2