Bug 414407 - Can't load database (plugin)
Summary: Can't load database (plugin)
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: kf5
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-22 21:31 UTC by Lapineige
Modified: 2024-04-20 11:43 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
DEBIAN/control (3.74 KB, text/plain)
2020-01-07 09:27 UTC, Mark Fraser
Details
Dockerfile that set-up Amarok's build environment (1.52 KB, text/plain)
2020-02-14 15:53 UTC, Pedro de Carvalho Gomes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lapineige 2019-11-22 21:31:33 UTC
SUMMARY


STEPS TO REPRODUCE
1. On Kubuntu 19.10, install amarok-kde5 (from ppa) - as the previous amarok with qt4 is gone
2. Launch Amarok

OBSERVED RESULT
A pop-up appears:
> The Amarok database reported the following errors:
>The configured database plugin could not be loaded.
>In most cases you will need to resolve these errors before Amarok will run properly.

And I have no content in "Local music".

EXPECTED RESULT
Amarok just works fine, and can connect to my music library.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 19.10 (+backports)
KDE Plasma Version: 5.17
KDE Frameworks Version: 5.64.0
Qt Version: 5.12.4
Amarok : 2.9.70

ADDITIONAL INFORMATION
I had several MySQL errors in the system, crashing Akonadi for instance… I barely fixed them, now MySQL (MariaDB ?) seem to be accessible.

Removing ~.kde/share/apps/amarok/ doesn't trigger a recreation of that folder… it doesn't seem to use it at all…
Comment 1 Pedro de Carvalho Gomes 2019-12-06 15:21:57 UTC
The error happens because Kubuntu 19.10 is shipped with Mysql 8. This major Mysql version deprecated Mysql Embedded, which is the standard DB for Amarok. You can read more about it here:

https://mysqlserverteam.com/mysql-8-0-retiring-support-for-libmysqld/

I assume the package you installed is linked with libmysqlclient, whose API is almost exactly the same as libmysqld. If this is the case, Amarok will try to open a socket to a local mysql standalone instead of reading the old DB from ~/.local/share/amarok/mysqle. It seems that there's no such mysql (or you can't connect to it witout password), so you get the error.

The obvious workaround is to import the old DB to a stand-alobe mysql instance.

However, a permanent fix is harded. It depends on what Amarok team will decide to replace Mysql embedded. I assume it will be to run a standalone mysql, similar to Akonadi.
Comment 2 Lapineige 2019-12-06 17:05:56 UTC
Thank you for your detailed answer.

As a temporary workaround, do you know how I can create such a database, and import the old one ?
Comment 3 Pedro de Carvalho Gomes 2019-12-09 14:51:31 UTC
The following command starts a mysql server with your old Amarok DB that is accessible only via socket (notice that paths my vary):

/usr/sbin/mysqld --defaults-file=/home/your_user/.local/share/amarok/my.cnf --datadir=/home/your_user/.kde/share/apps/amarok/mysqle --socket=/run/user/1000/akonadi/default/mysql-amarok.socket --pid-file=/run/user/1000/akonadi/default/mysql-amarok.pid --skip-networking --skip_grant_tables

You may test connection with the command below:

mysql --socket=/run/user/1000/akonadi/default/mysql-amarok.socket


Add the following command to your .my.cnf file in your home directory (/home/your_user/.my.cnf in this example):

[client]
socket=/run/user/1000/akonadi/default/mysql-amarok.socket

Now Amarok should be able to connect to the old DB and run as before
Comment 4 Lapineige 2019-12-09 21:06:36 UTC
Thanks a lot for helping me with this :)

Yet I can execute the first command… I have:
> Could not open required defaults file: /home/MyUserName/.local/share/amarok/my.cnf

But the file exists and is readable.

>  Add the following command to your .my.cnf file in your home directory (/home/your_user/.my.cnf in this example)

I have not such file. Should I create it ? (Will it be enough ?)
Comment 5 Pedro de Carvalho Gomes 2019-12-10 11:24:01 UTC
Keep in mind that the command and parameters I write are mere suggestions. Everything is dependant on your local environment.

Some hints about your last question:

1) it's probably fine to remove the "--defaults-file=/home/your_user/.local/share/amarok/my.cnf" option. I guess that it only contains an "[embedded]" session, which is not used by Mysql 8

2) if you don't have the ~/.my.cnf, you have to create it. I can't tell if this is sufficient, but should be. All this file does is to define a default connection to mysqlclient library (which is also used by "mysql" command)

So, a good way to test if your connection to mysql server will work is to turn "mysql" without parameters. If your .my.cnf is correct, and your "mysqld" (server) is running, you should be able to connect
Comment 6 Lapineige 2019-12-10 17:09:36 UTC
I noted that, but I don't know how my local environment is configured for mysql, so I can't tell if it's the right parameters or not ^^

1) you're right, I does contain only an [embedded]. Removing that parameter change the result, now I have:
> [ERROR] mysqld: Can't create/write to file '/home/MyUserName/.kde/share/apps/amarok/mysqle/aria_log_control' (Errcode: 13 "Permission denied")
>[ERROR] mysqld: Got error 'Can't create file' when trying to use aria control file '/home/MyUserName/.kde/share/apps/amarok/mysqle/aria_log_control'
[…]
> InnoDB: Operating system error number 13 in a file operation.
>[ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
> [ERROR] InnoDB: Operating system error number 13 in a file operation.
>[ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
> [ERROR] InnoDB: Cannot open datafile './ibdata1'
>[ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!


2) I created the file, and rand the command mysql without any parameter. I have :
> ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/user/1000/akonadi/default/mysql-amarok.socket' (2)

Which means it takes my .my_cnf into accounts (that's a good point ^^), yet it doesn't work and I don't understand why…
Comment 7 Lapineige 2020-01-06 11:32:46 UTC
Up :)

Does someone know how I can fix these errors ?
Comment 8 Mark Fraser 2020-01-06 22:25:12 UTC
I have been able to get the packages built for 19.04 installed and running by making a couple of changes to the debian file.

1) change libmysqlclient20 to libmysqlclient21

2) change qtdeclarative-abi-5-12-2 to qtdeclarative-abi-5-12-4.

If you need help, I should be able to send you the modified file or at least instructions on how to do the changes.
Comment 9 Lapineige 2020-01-06 22:28:35 UTC
Thanks for your help.
I don't understand which file I should change.
Would that work on Ubuntu ? (and not Debian)
Is there any potential side effect ?
Comment 10 Mark Fraser 2020-01-07 08:07:22 UTC
(In reply to Lapineige from comment #9)
> Thanks for your help.
> I don't understand which file I should change.
> Would that work on Ubuntu ? (and not Debian)
> Is there any potential side effect ?

The idea was to decompress the .deb, alter the control file and then recompress the .deb. Unfortunately, the PPA has removed packages for Disco.
Comment 11 Mark Fraser 2020-01-07 09:27:19 UTC
Created attachment 124953 [details]
DEBIAN/control

DEBIAN control file with amendments to allow amarok from 19.04 ppa to be used in 19.10
Comment 12 Mark Fraser 2020-01-07 09:31:52 UTC
(In reply to Pedro de Carvalho Gomes from comment #1)
> The error happens because Kubuntu 19.10 is shipped with Mysql 8. This major
> Mysql version deprecated Mysql Embedded, which is the standard DB for
> Amarok. You can read more about it here:
> 
> https://mysqlserverteam.com/mysql-8-0-retiring-support-for-libmysqld/
> 
> I assume the package you installed is linked with libmysqlclient, whose API
> is almost exactly the same as libmysqld. If this is the case, Amarok will
> try to open a socket to a local mysql standalone instead of reading the old
> DB from ~/.local/share/amarok/mysqle. It seems that there's no such mysql
> (or you can't connect to it witout password), so you get the error.
> 
> The obvious workaround is to import the old DB to a stand-alobe mysql
> instance.
> 
> However, a permanent fix is harded. It depends on what Amarok team will
> decide to replace Mysql embedded. I assume it will be to run a standalone
> mysql, similar to Akonadi.

How come I have managed to install Amarok from 19.04 by just changing the dependencies of 2 packages in the DEBIAN/control file?
Comment 13 Pedro de Carvalho Gomes 2020-01-08 11:28:27 UTC
Hi, I need more information that what I have to be able to know what's going on.

But I suspect that you are not using Mysql. Rather you have MariaDB, which hasn't deprecated the embedded server.

By the way, this is a quick alternative for Lapineige to try to get it working. Replace all Mysql packages with MariaDB alternatives:

apt-get install libmariadbclient-dev libmariadbd-dev mariadb-client mariadb-common
Comment 14 Lapineige 2020-01-08 18:12:14 UTC
Just installing them changes nothing.
Should I change anything else ? (remove mysql ?)
Comment 15 Pedro de Carvalho Gomes 2020-01-09 15:59:35 UTC
I am also running Kubuntu 19.10 and I am able to compile Amarok/master and run with MariaDB. MariaDB is a complete replacement to Mysql. So it seems like a good idea to replace all Mysql packages with MariaDB ones. But especially  make sure that you have libmariadbd-dev and libmariadbd19.

But before you try MariaDB, let's make sure that the package that you're trying to run was correctly built. That is, it is linked to libmariadbd or libmysqld. And not to libmysqlclient. You can know it by running the following command. It lists the linkage of the amarok's Mysql embedded module:

ldd /usr/lib/x86_64-linux-gnu/qt5/plugins/amarok_storage-mysqlestorage.so
Comment 16 Lapineige 2020-01-09 17:13:09 UTC
By Amarok master, the mean the Qt5 version ?

I'll try that, thanks.
Comment 17 Lapineige 2020-02-02 15:48:28 UTC
>ldd /usr/lib/x86_64-linux-gnu/qt5/plugins/amarok_storage-mysqlserverstorage.so # not amarok_storage-mysqlestorage.so
>libmysqlclient.so.21

I guess I'll need to built it my-self ? :/
Comment 18 Pedro de Carvalho Gomes 2020-02-03 08:55:30 UTC
(In reply to Lapineige from comment #17)
> >ldd /usr/lib/x86_64-linux-gnu/qt5/plugins/amarok_storage-mysqlserverstorage.so # not amarok_storage-mysqlestorage.so
> >libmysqlclient.so.21
> 
> I guess I'll need to built it my-self ? :/

I have built it and I can pack it for you if you want. But I can also assist you to build your own package. What do you prefer?
Comment 19 Lapineige 2020-02-09 11:03:23 UTC
Well I don't even find its repository… so if you can pack it for me it would be nice :)
Comment 20 Lapineige 2020-02-09 11:18:46 UTC
I found the Github repo… can't build, the first step fails.
https://github.com/KDE/amarok
Comment 21 Pedro de Carvalho Gomes 2020-02-13 15:00:41 UTC
I have build the package, but it will take me a while to set-up my launchpad to public it  correctly. Do you want the .deb file? I could even send you by e-mail. The file is about 5 MB.
Comment 22 Lapineige 2020-02-13 17:22:12 UTC
Well a simple .deb file is enough for me :)
(you can use this privacy-friendly service to send it if you want to : https://framadrop.org/)
But if you intend to publish a launchpad anyway, I can wait.
Comment 23 Pedro de Carvalho Gomes 2020-02-14 10:01:57 UTC
I have uploaded the package amarok_2.9.70-0ubuntu1_amd64.deb. It is available until March 15 20202 at the link below

https://framadrop.org/r/kXFlmE3RFf#jxKU+8OyFxXOI+w6jHks9Rwcsa4xQt50+8wl/AlwQbk=

For your safety, here are the checksums:

SHA256: ae1d7aeb4256c1f9286240d036799b0f37e09c34d523f85ab5e2d4ccad5efbf3
MD5:    70ec336237dd51844cafbc93b9395dcb

I built the package from my Amarok repo in Github. The branch Kubuntu_19.10 is basically master/HEAD with few fixes I wrote to the Lyrics and Wikipedia applets.

https://github.com/pcgomes/amarok/tree/Kubuntu_19.10

Let me know if it worked for you
Comment 24 Lapineige 2020-02-14 11:38:22 UTC
Thanks a lot.
I can't install it :( (checksum is ok)

One dependency can't be installed, using 'sudo apt-get install -f' to install it gives that log (I translated it):
> dpkg: archive treatment error /var/cache/apt/archives/amarok-utils_2%3a2.9.80+p19.04+git20191004.1229-0+yasi4~19.10_amd64.deb (--unpack) : attempting to replace « /usr/bin/amarok_afttagger », also own by package amarok 2.9.70-0ubuntu1
>dpkg-deb: error: coller subprocess was killed by signal (broken pipe)
>Preparing to unpack .../amarok_2%3a2.9.80+p19.04+git20191004.1229-0+yasi4~19.10_amd64.deb ...
>Unpacking amarok (2:2.9.80+p19.04+git20191004.1229-0+yasi4~19.10) sur (2.9.70-0ubuntu1) ...
>Errors encountered during execution :
> /var/cache/apt/archives/amarok-utils_2%3a2.9.80+p19.04+git20191004.1229-0+yasi4~19.10_amd64.deb
>E: Sub-process /usr/bin/dpkg returned an error code (1)


Note: I still have Amarok QT5 PPA activated, but I uninstalled its Amarok version. Could this be the issue ?
Comment 25 Pedro de Carvalho Gomes 2020-02-14 15:52:55 UTC
Hard to say with this log. But it seems likely that it has to do with the old PPA. Especially because its versions is newer (2.9.80) than mine (2.9.70); thus apt may stick to the most recent.

In addition to trying to remove the other Amarok PPA, here are few more thoughts:

- you can unset the localization at command line with "unset LANG". This way you don't need to translate localized logs back to english

- I have attached a Dockerfile that downloads automatically Amarok for (K)Ubuntu 19.10 and run the configure. After, a simple "make" (which I omitted because it takes long) compiles Amarok.

If you're not familiar with docker, you still can use it as reference to prepare your own build environment
Comment 26 Pedro de Carvalho Gomes 2020-02-14 15:53:59 UTC
Created attachment 126019 [details]
Dockerfile that set-up Amarok's build environment
Comment 27 Christoph Feck 2020-02-14 16:39:25 UTC
The error message says you still have "amarok-utils" installed. Remove it.
Comment 28 Mark Fraser 2020-02-15 14:50:09 UTC
If it helps, I have successfully compiled Amarok 2.9.70 in Kubuntu 19.10 by installing
libmariadb-dev-compat
which includes /usr/bin/mysql_config required to compile Amarok.
Comment 29 Lapineige 2020-02-16 14:19:42 UTC
Yeah, it works ! :)
No error message about Mysql.
Dynamic playlist works again too.

Yet it doesn't seem to connect correctly/completely/? to the database: I don't have access to the local library, not I can see notes, scores and so on.

I don't really know how to debug that…
Comment 30 Mark Fraser 2020-02-16 14:48:14 UTC
That's one thing I can't get to work - dynamic playlists - tracks are never added or removed.
Comment 31 Lapineige 2020-02-16 14:57:44 UTC
Well in that case the end of the playlist is changed as configured, so I'm sure they do work. But I can't tell you more about it, sorry.
Comment 32 Lapineige 2020-02-16 15:25:49 UTC
After refreshing collection (Tools -> Update Collection), and a few restarts, my music collection suddenly pop-up… I can see in the track details that the old database is not read, as my music as no score, last played date and so on, so I suppose it created a new index ?
Comment 33 Leo 2020-03-02 08:03:01 UTC
I've just installed a 'clean' Kubuntu 19.10.

Tried to build as per Docker, but am getting


-- Found libgmock: /usr/include/gmock, /usr/lib/x86_64-linux-gnu/libgmock.a;/usr/lib/x86_64-linux-gnu/libgtest.a;/usr/lib/x86_64-linux-gnu/libpthread.so
CMake Error at CMakeLists.txt:170 (find_package):
  Could not find a package configuration file provided by "Phonon4Qt5"
  (requested version 4.6.60) with any of the following names:

    Phonon4Qt5Config.cmake
    phonon4qt5-config.cmake

  Add the installation prefix of "Phonon4Qt5" to CMAKE_PREFIX_PATH or set
  "Phonon4Qt5_DIR" to a directory containing one of the above files.  If
  "Phonon4Qt5" provides a separate development package or SDK, be sure it has
  been installed.


I've installed the package phonon4qt5

but the only files I get are

/usr/share/doc/phonon4qt5/changelog.Debian.gz
/usr/share/doc/phonon4qt5/copyright



-- Configuring incomplete, errors occurred!
See also "/home/llist/kdedev/build/amarokGomes/CMakeFiles/CMakeOutput.log".
See also "/home/llist/kdedev/build/amarokGomes/CMakeFiles/CMakeError.log".

Thanks
Comment 34 Mark Fraser 2020-03-02 08:15:08 UTC
(In reply to thelists@optusnet.com.au from comment #33)
> I've just installed a 'clean' Kubuntu 19.10.
> 
> Tried to build as per Docker, but am getting
> 
> 
> -- Found libgmock: /usr/include/gmock,
> /usr/lib/x86_64-linux-gnu/libgmock.a;/usr/lib/x86_64-linux-gnu/libgtest.a;/
> usr/lib/x86_64-linux-gnu/libpthread.so
> CMake Error at CMakeLists.txt:170 (find_package):
>   Could not find a package configuration file provided by "Phonon4Qt5"
>   (requested version 4.6.60) with any of the following names:
> 
>     Phonon4Qt5Config.cmake
>     phonon4qt5-config.cmake
> 
>   Add the installation prefix of "Phonon4Qt5" to CMAKE_PREFIX_PATH or set
>   "Phonon4Qt5_DIR" to a directory containing one of the above files.  If
>   "Phonon4Qt5" provides a separate development package or SDK, be sure it has
>   been installed.
> 
> 
> I've installed the package phonon4qt5

You need the package with -dev at the end, with Ubuntu it is libphonon4qt5-dev.
Comment 35 Leo 2020-03-02 08:27:15 UTC
Doohh
Comment 36 Pedro de Carvalho Gomes 2020-04-11 09:24:10 UTC
I finally set my launchpad. There I am publishing builds from my personal repository. There I publish the patches that I send upstream, but are still under revision. Also, I rebase from the official repository before every new snapshot. Comments are welcome

https://launchpad.net/~pgomes/+archive/ubuntu/amarok
Comment 37 Tuomas Nurmi 2024-04-20 11:43:24 UTC
Closing this as db dependency related questions are somewhat under control at the moment and packages for 2.9.82 and nightly git builds are somewhat widely available.