Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MariaDB not starting with ampache:5.6.2 #102

Open
theTendo opened this issue Jul 17, 2023 · 11 comments
Open

MariaDB not starting with ampache:5.6.2 #102

theTendo opened this issue Jul 17, 2023 · 11 comments

Comments

@theTendo
Copy link

theTendo commented Jul 17, 2023

Hello, today I pulled the latest updates to the ampache:latest image and recreated the container (from 5.6.1 to 5.6.2).

With the update, Ampache says it can't connect to the database.

image

So I entered the container with docker exec -it ampache /bin/bash to try to troubleshoot the issue. After realizing that the mariadb was unable to connect to the database socket as well, I impersonated the mysql user and run the daemon mariadbd manually.

I got the following error trace:

mysql@e77fde1f84a0:/$ mariadbd
2023-07-17 19:16:02 0 [Note] Starting MariaDB 10.11.3-MariaDB-1 source revision  as process 1534
2023-07-17 19:16:02 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
2023-07-17 19:16:02 0 [Note] InnoDB: Number of transaction pools: 1
2023-07-17 19:16:02 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2023-07-17 19:16:02 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
2023-07-17 19:16:02 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2023-07-17 19:16:02 0 [Note] InnoDB: Completed initialization of buffer pool
2023-07-17 19:16:02 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
**2023-07-17 19:16:02 0 [ERROR] InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 10.5.15. You must start up and shut down MariaDB 10.7 or earlier.
2023-07-17 19:16:02 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error**
2023-07-17 19:16:02 0 [Note] InnoDB: Starting shutdown...
**2023-07-17 19:16:02 0 [ERROR] Plugin 'InnoDB' init function returned error.
2023-07-17 19:16:02 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.**
2023-07-17 19:16:02 0 [Note] Plugin 'FEEDBACK' is disabled.
**2023-07-17 19:16:02 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2023-07-17 19:16:02 0 [ERROR] Aborting**

Apparently "Upgrade after a crash is not supported. The redo log was created with MariaDB 10.5.15. You must start up and shut down MariaDB 10.7 or earlier.". So I've gone back to ampache:5.6.1 and everything works again.

I don't know if this issue affects only my setup or if it's a bug with new changes, but I wanted to bring attention to it to shed some light.

@lachlan-00
Copy link
Member

not sure. i've set it up on a new container to test and it boots/reboots okay so we'll have to work out why.

@theTendo
Copy link
Author

Today I was able to update the docker instance from 5.6.1 to 5.6.2. The issue was that database migration from mariadbd 10.7 (used in Ampache 5.6.1) to mariadbd 10.11 (used in 5.6.2) was not being performed gracefully.

The steps to reproduce the bug should be:

  1. Stop the Ampache 5.6.1 Docker container with docker container stop ampache.
  2. Update the image version in docker-compose.yml from 5.6.1 to 5.6.2.
  3. Start the Docker container with the new image.

The steps to update from 5.6.1 to 5.6.2 successfully are:

  1. Spawn a shell inside the container with docker exec -it ampache /bin/bash.
  2. Inside the container, execute service mariadb stop.
  3. Update the image version in docker-compose.yml from 5.6.1 to 5.6.2.
  4. Start the Docker container with the new image.

I guess this should only affect version updates but not new setups from scratch.

@lachlan-00
Copy link
Member

oh, debian upgrade!

yeah that's not great i didn't think that would cause issues but i'll put that in the readme

@lachlan-00
Copy link
Member

are there any mariadb commands we should execute on launch to pre-check for this kind of stuff?

like does it have a pre-start upgrade command?

@djotaku
Copy link

djotaku commented Jul 20, 2023

confirming that theTendo's instructions work for me. I use podman, so it was:

podman exec -it ampache /bin/bash

And then the same.

Cheers!

@lachlan-00
Copy link
Member

should mariadb-upgrade be added into the startup? maybe in the run.sh file for existing databases

image

@lachlan-00
Copy link
Member

Would it be helpful to put messages/news in the logs for things like this?

Docker can print info easily enough right?

I could put a check in referencing a wiki page of mysql fails to start?

@theTendo
Copy link
Author

theTendo commented Aug 3, 2023

I tried running mariadb-upgrade as a way to fix the issue but it didn't work. When ampache:5.6.2 boots up the newer version of MariaDB is incapable of running mariadb-upgrade from 5.6.1 to 5.6.2 because the db is corrupted and the newer version of mariadb can't restore the db from the older version.

The proper solution would be to add a mechanism that automatically executes service mariadb stop when stopping the Ampache Docker container, but I'm unsure if it is possible to do this in Docker.

As a workaround, something that could potentially fix the issue could be:

  1. Installing the mariadb 10.7 binaries to the Ampache 5.6.2 image (alongside the current mariadb 10.11 binaries).
  2. Restoring the db from Ampache 5.6.1 using the mariadb 10.7 binaries.
  3. Once restored, running Ampache with the mariadb 10.11 version.

Regarding noticing the endusers about this. I think adding a comment or linking this issue in the "Database Connection" section of the page test.php could be useful. Something like "This attempts to connect to your database using the values read from your configuration file (note: if you are having issues upgrading from Ampache 5.6.1 to 5.6.2 using Docker check this issue)."

@lachlan-00
Copy link
Member

i merged #104 which looks to shutdown mysql correctly in my testing so i'm going to rebuild master and develop now

@dalton-baker
Copy link

@theTendo's fix worked for me, just for the record

@ZombaL85
Copy link

ZombaL85 commented Sep 4, 2023

This fix worked for me to but needs to be gracefully shutdown database:

docker exec -it ampache /bin/bash
mysqladmin shutdown

after that shutdown container and then bump version to 5.6.2 and docker-compose up -d

PS. without mysqladmin shutdown maridadb leaves a redo log with old version of mariadb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants