Discussion:
Lua doesn't load the MySQL driver
(too old to reply)
Bjoern Schiessle
2019-12-04 19:20:01 UTC
Permalink
Hi,

I run the XMPP server Prosody on a Debian server which I recently
updated to Buster. Since the update the Prosody server refuses to
connect to the MariaDB database. The log shows following error:

Nov 30 22:09:15 sql debug Connecting to [MySQL] prosody...
Nov 30 22:09:15 sql debug Database connection was closed. Will
reconnect and retry.
Nov 30 22:09:15 sql debug Retrying SQL transaction
[function(mod_storage_sql.lua:137)]
Nov 30 22:09:15 sql debug Connecting to [MySQL] prosody...
Nov 30 22:09:15 sql debug SQL transaction retry failed
Nov 30 22:09:15 sql error Error in SQL transaction:
/usr/local/share/lua/5.2/DBI.lua:53: Cannot load driver MySQL.
Available drivers are: SQLite3

It looks like the MySQL driver is not installed. But both packages,
"lua-dbi-mysql/stable,now 0.7.1-2 amd64" and "lua-sql-mysql/stable,now
2.3.4-1+b1 amd64" are installed.

If I install additionally "lua-dbi-postgresql" the last error message
changes to:

Nov 30 22:09:15 sql error Error in SQL transaction:
/usr/local/share/lua/5.2/DBI.lua:53: Cannot load driver MySQL.
Available drivers are: SQLite3, PostgreSQL

Therefore I assume that the lua-dbi-* packages are the right one. But
for some reasons the MySQL driver is not detected/installed correctly.

I don't think it is a Prosody issue as the error seems to happen in the
Lua code.

Do I have to install an additional package to make it work? Does anyone
here experienced a similar issue with Buster?

Lua Version is 5.2.4 and Prosody 0.11.2.

Thanks!
Bjoern
t***@tuxteam.de
2019-12-04 20:50:02 UTC
Permalink
Post by Bjoern Schiessle
Hi,
I run the XMPP server Prosody on a Debian server which I recently
updated to Buster. Since the update the Prosody server refuses to
Nov 30 22:09:15 sql debug Connecting to [MySQL] prosody...
Nov 30 22:09:15 sql debug Database connection was closed. Will
reconnect and retry.
Nov 30 22:09:15 sql debug Retrying SQL transaction
[function(mod_storage_sql.lua:137)]
Nov 30 22:09:15 sql debug Connecting to [MySQL] prosody...
Nov 30 22:09:15 sql debug SQL transaction retry failed
/usr/local/share/lua/5.2/DBI.lua:53: Cannot load driver MySQL.
^^^^^

Hm. This looks like a locally installed driver, not the
distribution's...
Post by Bjoern Schiessle
Available drivers are: SQLite3
It looks like the MySQL driver is not installed. But both packages,
"lua-dbi-mysql/stable,now 0.7.1-2 amd64" and "lua-sql-mysql/stable,now
2.3.4-1+b1 amd64" are installed.
Perhaps you can play around by setting the environment variables
LUA_PATH (and/or LUA_CPATH) to have /usr/share/lua before
/usr/local/share/lua?

Or, if you don't need the stuff in /usr/local/share/lua, perhaps
move it out of the way.

What's the version of Lua you're using (Buster has the whole
array from 5.0 to 5.3 on offer, it seems).
Post by Bjoern Schiessle
If I install additionally "lua-dbi-postgresql" the last error message
/usr/local/share/lua/5.2/DBI.lua:53: Cannot load driver MySQL.
Available drivers are: SQLite3, PostgreSQL
Therefore I assume that the lua-dbi-* packages are the right one. But
for some reasons the MySQL driver is not detected/installed correctly.
Yes, but most probably it's finding the wrong ones, in /usr/local

Cheers
-- tomás
Bjoern Schiessle
2019-12-05 11:10:01 UTC
Permalink
Post by t***@tuxteam.de
Post by Bjoern Schiessle
Hi,
I run the XMPP server Prosody on a Debian server which I recently
updated to Buster. Since the update the Prosody server refuses to
Nov 30 22:09:15 sql debug Connecting to [MySQL] prosody...
Nov 30 22:09:15 sql debug Database connection was closed. Will
reconnect and retry.
Nov 30 22:09:15 sql debug Retrying SQL transaction
[function(mod_storage_sql.lua:137)]
Nov 30 22:09:15 sql debug Connecting to [MySQL] prosody...
Nov 30 22:09:15 sql debug SQL transaction retry failed
/usr/local/share/lua/5.2/DBI.lua:53: Cannot load driver MySQL.
^^^^^
Hm. This looks like a locally installed driver, not the
distribution's...
That's interesting. I didn't noticed it. A apt-file search for this
file doesn't give me any result. Also no luarocks packages are
installed according to "loarocks list".

Maybe this come from another repository I no longer use. Is there a way
to find out from which package/source the file was originally installed
beside apt-file, which only works if the repository with the package is
still there?
Post by t***@tuxteam.de
Post by Bjoern Schiessle
Available drivers are: SQLite3
It looks like the MySQL driver is not installed. But both packages,
"lua-dbi-mysql/stable,now 0.7.1-2 amd64" and "lua-sql-
mysql/stable,now
2.3.4-1+b1 amd64" are installed.
Perhaps you can play around by setting the environment variables
LUA_PATH (and/or LUA_CPATH) to have /usr/share/lua before
/usr/local/share/lua?
Or, if you don't need the stuff in /usr/local/share/lua, perhaps
move it out of the way.
I tried to move the file /usr/local/share/lua/5.2/DBI.lua away, then
the error message changes to:

Dec 05 11:57:35 sql error Error in SQL transaction:
/usr/share/lua/5.2/DBI.lua:53: Cannot load driver MySQL. Available
drivers are: PostgreSQL

So now it tries to load the "official" source. But the mysql driver is
still not found. What still confuses me, that the Postgresql driver
installed from the Debian repository is recognized correctly. So it
seems to look at the right places but something seems to be different
if it comes to the mysql driver.
Post by t***@tuxteam.de
What's the version of Lua you're using (Buster has the whole
array from 5.0 to 5.3 on offer, it seems).
I'm using Lua 5.2.4

Cheers,
Bjoern
t***@tuxteam.de
2019-12-05 11:30:02 UTC
Permalink
Post by Bjoern Schiessle
Post by t***@tuxteam.de
Post by Bjoern Schiessle
Hi,
I run the XMPP server Prosody on a Debian server which I recently
updated to Buster. Since the update the Prosody server refuses to
Nov 30 22:09:15 sql debug Connecting to [MySQL] prosody...
Nov 30 22:09:15 sql debug Database connection was closed. Will
reconnect and retry.
Nov 30 22:09:15 sql debug Retrying SQL transaction
[function(mod_storage_sql.lua:137)]
Nov 30 22:09:15 sql debug Connecting to [MySQL] prosody...
Nov 30 22:09:15 sql debug SQL transaction retry failed
/usr/local/share/lua/5.2/DBI.lua:53: Cannot load driver MySQL.
^^^^^
Hm. This looks like a locally installed driver, not the
distribution's...
That's interesting. I didn't noticed it. A apt-file search for this
file doesn't give me any result. Also no luarocks packages are
installed according to "loarocks list".
As far as I know, Debian packages won't install to /usr/local. This
is the realm of the sysadmin to install non-Debian software locally.
Post by Bjoern Schiessle
Maybe this come from another repository I no longer use. Is there a way
to find out from which package/source the file was originally installed
beside apt-file, which only works if the repository with the package is
still there?
I don't think this comes from a Debian package at all: I'm pretty sure
this would be considered a packaging bug.

[...]
Post by Bjoern Schiessle
So now it tries to load the "official" source. But the mysql driver is
still not found. What still confuses me, that the Postgresql driver
installed from the Debian repository is recognized correctly. So it
seems to look at the right places but something seems to be different
if it comes to the mysql driver.
Post by t***@tuxteam.de
What's the version of Lua you're using [...]?
I'm using Lua 5.2.4
OK, thanks.

Searching for available Lua MySQL packages yields (on buster):

lua-dbi-mysql/stable 0.7.1-2 amd64
lua-sql-mysql/stable 2.3.4-1+b1 amd64

I see from your original post that you have both installed. Now I'm
out of my depth -- I'd try purging and re-installing lua-dbi-mysql,
perhaps its config got broken by something.

Sorry, I haven't a mysql installation around for testing...

Cheers
-- tomás
Andrei POPESCU
2019-12-05 11:30:02 UTC
Permalink
Post by Bjoern Schiessle
Post by t***@tuxteam.de
Post by Bjoern Schiessle
Hi,
I run the XMPP server Prosody on a Debian server which I recently
updated to Buster. Since the update the Prosody server refuses to
Nov 30 22:09:15 sql debug Connecting to [MySQL] prosody...
Nov 30 22:09:15 sql debug Database connection was closed. Will
reconnect and retry.
Nov 30 22:09:15 sql debug Retrying SQL transaction
[function(mod_storage_sql.lua:137)]
Nov 30 22:09:15 sql debug Connecting to [MySQL] prosody...
Nov 30 22:09:15 sql debug SQL transaction retry failed
/usr/local/share/lua/5.2/DBI.lua:53: Cannot load driver MySQL.
^^^^^
Hm. This looks like a locally installed driver, not the
distribution's...
That's interesting. I didn't noticed it. A apt-file search for this
file doesn't give me any result. Also no luarocks packages are
installed according to "loarocks list".
Maybe this come from another repository I no longer use. Is there a way
to find out from which package/source the file was originally installed
beside apt-file, which only works if the repository with the package is
still there?
If it comes from a .deb package dpkg should know about it, try
'dpkg -S'.

JFYI, according to Debian Policy 9.1.2 [link] official packages must not
install anything in /usr/local as this is the location reserved for
software installed from source (make; make install).

[link]
https://www.debian.org/doc/debian-policy/ch-opersys.html#site-specific-programs

Kind regards,
Andrei
--
http://wiki.debian.org/FAQsFromDebianUser
Mark Allums
2019-12-06 17:00:01 UTC
Permalink
Post by Bjoern Schiessle
I tried to move the file /usr/local/share/lua/5.2/DBI.lua away, then
/usr/share/lua/5.2/DBI.lua:53: Cannot load driver MySQL. Available
drivers are: PostgreSQL
So now it tries to load the "official" source. But the mysql driver is
still not found. What still confuses me, that the Postgresql driver
installed from the Debian repository is recognized correctly. So it
seems to look at the right places but something seems to be different
if it comes to the mysql driver.
Are you using MySQL or MariaDB?

Mark

Loading...