Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34439

Unable to start mariadbd from commandline: Permission denied error

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Not a Bug
    • 11.4.2
    • N/A
    • Server
    • Endeavour OS (Arch Linux based)
      `mariadb`, `mariadb-clients` packages from the Arch Linux official package repository (extra)
      BTRFS Filesystem
      Linux Kernel: `6.9.5-arch1-1`
      systemd: 256.1-1

    Description

      Upon installing the mariadb and mariadb-clients packages from the Arch Linux Official (extra) package repository, and then running mariadbd in a terminal, the process errors out.

      $ mariadbd
      2024-06-21 14:06:09 0 [Warning] Can't create test file '/var/lib/mysql/hostname.lower-test' (Errcode: 13 "Permission denied")
      mariadbd: Can't change dir to '/var/lib/mysql/' (Errcode: 13 "Permission denied")
      2024-06-21 14:06:09 0 [ERROR] Aborting

      Running sudo mariadbd shows the following error and quits:

      $ sudo mariadbd
      [sudo] password for user:
      mariadbd: Please consult the Knowledge Base to find out how to run mysqld as root!
      2024-06-21 14:10:01 0 [ERROR] Aborting

      The current octal permissions of /var/lib/mysql seems to be:

      $ stat -c %a /var/lib/mysql
      700

      The user user is part of the group mysql.

      Then, when attempting to sudo as the mysql user and run the program:

      $ sudo -u mysql mariadbd
      [sudo] password for user:
      2024-06-21 14:26:05 0 [Note] Starting MariaDB 11.4.2-MariaDB source revision 3fca5ed772fb75e3e57c507edef2985f8eba5b12 as process 193142
      2024-06-21 14:26:05 0 [ERROR] mariadbd: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")
      2024-06-21 14:26:05 0 [ERROR] mariadbd: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
      2024-06-21 14:26:05 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
      2024-06-21 14:26:05 0 [Note] InnoDB: Compressed tables use zlib 1.3.1
      2024-06-21 14:26:05 0 [Note] InnoDB: Number of transaction pools: 1
      2024-06-21 14:26:05 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
      2024-06-21 14:26:05 0 [Note] InnoDB: Using liburing
      2024-06-21 14:26:05 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
      2024-06-21 14:26:05 0 [Note] InnoDB: Completed initialization of buffer pool
      2024-06-21 14:26:05 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
      2024-06-21 14:26:05 0 [ERROR] InnoDB: The error means mariadbd does not have the access rights to the directory.
      2024-06-21 14:26:05 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
      2024-06-21 14:26:05 0 [Note] InnoDB: Starting shutdown...
      2024-06-21 14:26:05 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
      2024-06-21 14:26:05 0 [Note] Plugin 'wsrep-provider' is disabled.
      2024-06-21 14:26:05 0 [ERROR] Could not open mysql.plugin table: "Unknown storage engine 'Aria'". Some plugins may be not loaded
      2024-06-21 14:26:05 0 [ERROR] Failed to initialize plugins.
      2024-06-21 14:26:05 0 [ERROR] Aborting

      A similar error to this occurs when attempting to start Mariadb from it's systemd service:

      $ systemctl enable --now mariadb
      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.
      $ journalctl -xeu mariadb.service
      ░░ The job identifier is 6090 and the job result is failed.
      Jun 21 14:30:00 hostname systemd[1]: Starting MariaDB 11.4.2 database server...
      ░░ Subject: A start job for unit mariadb.service has begun execution
      ░░ Defined-By: systemd
      ░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
      ░░
      ░░ A start job for unit mariadb.service has begun execution.
      ░░
      ░░ The job identifier is 6265.
      Jun 21 14:30:00 hostname (mariadbd)[194090]: mariadb.service: Referenced but unset environment variable evaluates to an empty string: MYSQLD_OPTS, _WSREP_NEW_CLUSTER
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [Note] Starting MariaDB 11.4.2-MariaDB source revision 3fca5ed772fb75e3e57c507edef2985f8eba5b12 as process 194090
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [Note] InnoDB: Compressed tables use zlib 1.3.1
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [Note] InnoDB: Number of transaction pools: 1
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [Note] InnoDB: Using liburing
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [Note] InnoDB: Initialized memory pressure event listener
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [Note] InnoDB: Completed initialization of buffer pool
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [ERROR] InnoDB: ib_logfile0 is empty, and LSN is unknown.
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [Note] InnoDB: Starting shutdown...
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [Note] Plugin 'wsrep-provider' is disabled.
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [ERROR] Unknown/unsupported storage engine: InnoDB
      Jun 21 14:30:00 hostname mariadbd[194090]: 2024-06-21 14:30:00 0 [ERROR] Aborting
      Jun 21 14:30:00 hostname systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
      ░░ Subject: Unit process exited
      ░░ Defined-By: systemd
      ░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
      ░░
      ░░ An ExecStart= process belonging to unit mariadb.service has exited.
      ░░
      ░░ The process' exit code is 'exited' and its exit status is 1.
      Jun 21 14:30:00 hostname systemd[1]: mariadb.service: Failed with result 'exit-code'.
      ░░ Subject: Unit failed
      ░░ Defined-By: systemd
      ░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
      ░░
      ░░ The unit mariadb.service has entered the 'failed' state with result 'exit-code'.
      Jun 21 14:30:00 hostname systemd[1]: Failed to start MariaDB 11.4.2 database server.
      ░░ Subject: A start job for unit mariadb.service has failed
      ░░ Defined-By: systemd
      ░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
      ░░
      ░░ A start job for unit mariadb.service has finished with a failure.
      ░░
      ░░ The job identifier is 6265 and the job result is failed.

      Upon changing the permissions of /var/lib/mysql to 755 or 777, running the following command still fails:

      $ sudo -u mysql mariadbd
      2024-06-21 14:33:10 0 [Note] Starting MariaDB 11.4.2-MariaDB source revision 3fca5ed772fb75e3e57c507edef2985f8eba5b12 as process 194492
      2024-06-21 14:33:10 0 [ERROR] mariadbd: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")
      2024-06-21 14:33:10 0 [ERROR] mariadbd: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
      2024-06-21 14:33:10 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
      2024-06-21 14:33:10 0 [Note] InnoDB: Compressed tables use zlib 1.3.1
      2024-06-21 14:33:10 0 [Note] InnoDB: Number of transaction pools: 1
      2024-06-21 14:33:10 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
      2024-06-21 14:33:10 0 [Note] InnoDB: Using liburing
      2024-06-21 14:33:10 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
      2024-06-21 14:33:10 0 [Note] InnoDB: Completed initialization of buffer pool
      2024-06-21 14:33:10 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
      2024-06-21 14:33:10 0 [ERROR] InnoDB: The error means mariadbd does not have the access rights to the directory.
      2024-06-21 14:33:10 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
      2024-06-21 14:33:10 0 [Note] InnoDB: Starting shutdown...
      2024-06-21 14:33:10 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
      2024-06-21 14:33:10 0 [Note] Plugin 'wsrep-provider' is disabled.
      2024-06-21 14:33:10 0 [ERROR] Could not open mysql.plugin table: "Unknown storage engine 'Aria'". Some plugins may be not loaded
      2024-06-21 14:33:10 0 [ERROR] Failed to initialize plugins.
      2024-06-21 14:33:10 0 [ERROR] Aborting

      However, running bare mariadbd as the local user seems to give a different error, as compared to before:

      $ mariadbd
      2024-06-21 14:38:03 0 [Note] Starting MariaDB 11.4.2-MariaDB source revision 3fca5ed772fb75e3e57c507edef2985f8eba5b12 as process 195559
      2024-06-21 14:38:03 0 [Note] InnoDB: The first data file './ibdata1' did not exist. A new tablespace will be created!
      2024-06-21 14:38:03 0 [Note] InnoDB: Compressed tables use zlib 1.3.1
      2024-06-21 14:38:03 0 [Note] InnoDB: Number of transaction pools: 1
      2024-06-21 14:38:03 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
      2024-06-21 14:38:03 0 [Note] InnoDB: Using liburing
      2024-06-21 14:38:03 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
      2024-06-21 14:38:03 0 [Note] InnoDB: Initialized memory pressure event listener
      2024-06-21 14:38:03 0 [Note] InnoDB: Completed initialization of buffer pool
      2024-06-21 14:38:03 0 [ERROR] InnoDB: undo tablespace './/undo001' exists. Creating system tablespace with existing undo tablespaces is not supported. Please delete all undo tablespaces before creating new system tablespace.
      2024-06-21 14:38:03 0 [ERROR] InnoDB: Database creation was aborted with error Generic error. You may need to delete the ibdata1 file before trying to start up again.
      2024-06-21 14:38:03 0 [Note] InnoDB: Starting shutdown...
      2024-06-21 14:38:04 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
      2024-06-21 14:38:04 0 [Note] Plugin 'wsrep-provider' is disabled.
      2024-06-21 14:38:04 0 [ERROR] Unknown/unsupported storage engine: InnoDB
      2024-06-21 14:38:04 0 [ERROR] Aborting

      The bug is not solved by uninstalling and reinstalling the mariadb and mariadb-clients packages.
      The bug is not solved by deleting the files/directories ibdata1, ib_logfile0

      Attachments

        Activity

          People

            serg Sergei Golubchik
            AadhithyaNM Aadhithya Narayanan Madhusudhanan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.