title: Mariadb loads, but crashes after a couple of minutes. Happened after server was restored from a "snapshot"
body: <p>I have a VPS (Ubuntu Server 18.04) hosted with OVH. They offer snapshots, that are supposed to be able to rollback a VPS to a previous state. I have never used this feature before. But I made a snapshot last night before I started messing with BTCpay. I royally borked that install so <strong>I decided to roll back to the snapshot</strong>.</p>
  
  <p>Now my Mariadb install isn't working properly. The only thing hosted on the server is Wordpress multisite. If I reboot the server (or start Mariadb with systemctl) it loads and I can access all my wordpress sites, and admin panel. But after a couple of minutes, Mariadb crashes.</p>
  
  <p>Running <strong>mysqld_safe --skip-grant-tables</strong> outputs:</p>
  
  <pre><code>190308 15:10:20 mysqld_safe Logging to syslog.
  190308 15:10:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
  </code></pre>
  
  <p>This gets Wordpress up and running, but obviously isn't a secure solution.</p>
  
  <p>These are the only errors that show up in <strong>/var/log/mysql/error.log</strong> but there's only the one entry and they do not repeat each time Mariadb crashes:</p>
  
  <pre><code>2019-03-08 13:08:24 139897840925824 [ERROR] mysqld: Table './mysql/db' is marked as crashed and should be repaired
  2019-03-08 13:08:24 139897840925824 [ERROR] mysql.db: 1 client is using or hasn't closed the table properly
  </code></pre>
  
  <p>and <strong>CHECK TABLE mysql.db;</strong> outputs:</p>
  
  <pre><code>+----------+-------+----------+----------+
  | Table    | Op    | Msg_type | Msg_text |
  +----------+-------+----------+----------+
  | mysql.db | check | status   | OK       |
  +----------+-------+----------+----------+
  1 row in set (0.00 sec)
  </code></pre>
  
  <p>So far the steps I have taken are: </p>
  
  <ul>
  <li><p>To use <strong>mysqldump</strong> for the 'wordpress' database, which is the one I
  setup for my Wordpress multisite install.</p></li>
  <li><p>Run <strong># mysqlcheck --all-databases</strong> which came back all with 'OK'</p></li>
  <li><p>Tried the fix listed here
  <a href="https://stackoverflow.com/questions/226172/how-do-i-repair-an-innodb-table">https://stackoverflow.com/a/3322930/8644833</a> after starting Mariadb with <strong>mysqld_safe --skip-grant-tables</strong></p></li>
  </ul>
  
  <p>I am not great with mysql, so I'm just looking for a solution to get me up and running again without losing too much data. <strong>I wouldn't mind performing a clean install of Mariadb and setting up a new Wordpress database, but I'm not exactly sure how to back up all of my data so I wouldn't have to rebuild all my sites.</strong> Seems like this should be possible as the sites all work fine until Mariadb crashes.</p>
  
  <p>Here is all the other relevant info I have:</p>
  
  <p>dmesg:</p>
  
  <pre><code>[  108.430534] audit: type=1400 audit(1552073977.631:19): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=939 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=111 ouid=0
  [  108.534100] audit: type=1400 audit(1552073977.739:20): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=939 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=111 ouid=0
  [  108.634399] audit: type=1400 audit(1552073977.839:21): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=939 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=111 ouid=0
  [  108.734779] audit: type=1400 audit(1552073977.939:22): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=939 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=111 ouid=0
  [  108.835027] audit: type=1400 audit(1552073978.039:23): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=939 comm="mysqld" requested_mask="w"denied_mask="w" fsuid=111 ouid=0
  [  108.935311] audit: type=1400 audit(1552073978.139:24): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=939 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=111 ouid=0
  [  109.035562] audit: type=1400 audit(1552073978.235:25): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=939 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=111 ouid=0
  [  109.136162] audit: type=1400 audit(1552073978.339:26): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=939 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=111 ouid=0
  [  110.038191] audit: type=1400 audit(1552073979.243:27): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=939 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=111 ouid=0
  [  110.040919] audit: type=1400 audit(1552073979.243:28): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify" pid=939 comm="mysqld" requested_mask="w" denied_mask="w" fsuid=111 ouid=0
  </code></pre>
  
  <p>systemctl status mariadb.service:</p>
  
  <pre><code>    ● mariadb.service - MariaDB 10.1.38 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: failed (Result: timeout) since Fri 2019-03-08 14:39:39 EST; 14min ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 939 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 839 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] &amp;&amp; VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   &amp;&amp; systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
    Process: 809 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 770 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
   Main PID: 939 (code=exited, status=0/SUCCESS)
  
  Mar 08 14:38:08 mydomain.com systemd[1]: Starting MariaDB 10.1.38 database server...
  Mar 08 14:38:09 mydomain.com mysqld[939]: 2019-03-08 14:38:09 140251492867200 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB-0ubuntu0.18.04.1) starting as process 939 ...
  Mar 08 14:39:37 mydomain.com systemd[1]: mariadb.service: Start operation timed out. Terminating.
  Mar 08 14:39:39 mydomain.com systemd[1]: mariadb.service: Failed with result 'timeout'.
  Mar 08 14:39:39 mydomain.com systemd[1]: Failed to start MariaDB 10.1.38 database server.
  </code></pre>
  
  <p>mysql log:</p>
  
  <pre><code>2019-03-08 14:59:39 140597857991808 [Note] InnoDB: innodb_empty_free_list_algor
  ithm has been changed to legacy because of small buffer pool size. In order to 
  use backoff, increase buffer pool at least up to 20MB.
  
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: Using mutexes to ref count b
  uffer pool pages
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: The InnoDB memory heap is disabled
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: Compressed tables use zlib 1.2.11
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: Using Linux native AIO
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: Using SSE crc32 instructions
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: Completed initialization of buffer pool
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: Highest supported file format is Barracuda.
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: 128 rollback segment(s) are active.
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB: Waiting for purge to start
  2019-03-08 14:59:39 140597857991808 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.42-84.2 started; log sequence number 446057526
  2019-03-08 14:59:39 140597857991808 [Note] Plugin 'FEEDBACK' is disabled.
  2019-03-08 14:59:39 140597201463040 [Note] InnoDB: Dumping buffer pool(s) not yet started
  2019-03-08 14:59:39 140597857991808 [Note] Server socket created on IP: '127.0.0.1'.
  2019-03-08 14:59:39 140597857991808 [Note] /usr/sbin/mysqld: ready for connections.
  Version: '10.1.38-MariaDB-0ubuntu0.18.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Ubuntu 18.04
  2019-03-08 15:01:09 140597856737024 [Note] /usr/sbin/mysqld: Normal shutdown
  2019-03-08 15:01:09 140597856737024 [Note] Event Scheduler: Purging the queue. 0 events
  2019-03-08 15:01:09 140597251774208 [Note] InnoDB: FTS optimize thread exiting.
  2019-03-08 15:01:09 140597856737024 [Note] InnoDB: Starting shutdown...
  2019-03-08 15:01:09 140597856737024 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
  2019-03-08 15:01:11 140597856737024 [Note] InnoDB: Shutdown completed; log sequence number 446281568
  2019-03-08 15:01:11 140597856737024 [Note] /usr/sbin/mysqld: Shutdown complete
  </code></pre>