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)
    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
  • What does ls -l /lib/x86_64-linux-gnu/liblz4.so.1 show? it should be a symbolic link. Is it broken? Aug 13, 2021 at 14:13
  • It shows that it's a symlink to liblz4.so.1.9.2 in the same directory. I don't see any errors there.
    – psaniac
    Aug 13, 2021 at 15:18
  • Please run find / -name "liblz4.so*" -type f | xargs sha256sum and add result to the question body. On fresh 20.04 LTS VM with all updates I have d6574e34006e27cfb5d00dc75018cc06832d0bbc9e1b35316b9c03148355f0a0 /usr/lib/x86_64-linux-gnu/liblz4.so.1.9.2 .
    – N0rbert
    Aug 13, 2021 at 19:12
  • I've edited my post, but the checksum is the same as the one you posted. I think if the library was corrupted, it wouldn't give a "No such file or directory" error.
    – psaniac
    Aug 13, 2021 at 19:28

2 Answers 2


It's AppArmor, annoyingly it says "No such file or directory". This answer fixed it for me on Ubuntu 20.04 LTS (Server): https://stackoverflow.com/a/60423057/539198

This worked for me :-

sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/

sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld

It also disables the AppArmor for MySQL on the system though.

Got from this issue


To remove mariadb from app armor, this is what worked for me

To resolve look for mysqld on the app armor status output:

$ sudo aa-status

Then follow the steps below to remove mysqld from the app armor:

$ echo "/usr/sbin/mysqld { }" | sudo tee /etc/apparmor.d/usr.sbin.mysqld
$ sudo apparmor_parser -v -R /etc/apparmor.d/usr.sbin.mysqld
$ sudo systemctl restart mariadb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.