Discussion:
freeradius3 couldnt connect to mysql-server
Lukas Nuth
2018-10-22 07:07:14 UTC
Permalink
Hi,
FreeRADIUS starts with my virtual machine. Therefore Ubuntu created the
file "radiusd.service" itself. I activated "radius.service" with
"systemctl enable radiusd.service" so that FR starts with the virtual
machine.
Now the problem when FR starts with the virtual machine is that the
following error message can be found in the log file:

Mon Oct 22 08:45:40 2018 : Info: Debugger not attached
Mon Oct 22 08:45:41 2018 : Info: rlm_sql (sql): Driver rlm_sql_mysql
(module rlm_sql_mysql) loaded and linked
Mon Oct 22 08:45:42 2018 : Info: rlm_sql_mysql: libmysql version: 5.7.23
Mon Oct 22 08:45:42 2018 : Info: rlm_sql (sql): Attempting to connect to
database "radius"
Mon Oct 22 08:45:42 2018 : Info: rlm_sql (sql): Opening additional
connection (0), 1 of 32 pending slots used
Mon Oct 22 08:45:42 2018 : Error: rlm_sql_mysql: Couldn't connect to
MySQL server ***@localhost:radius
Mon Oct 22 08:45:42 2018 : Error: rlm_sql_mysql: MySQL error: Can't
connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)
Mon Oct 22 08:45:42 2018 : Error: rlm_sql (sql): Opening connection
failed (0)
Mon Oct 22 08:45:42 2018 : Error: /etc/raddb/mods-enabled/sql[20]:
Instantiation failed for module "sql"

If I restart FR with "systemctl restart radiusd.service" this error does
not occur.

Can anyone help me?

regards
Lukas
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/us
Lukas Nuth
2018-10-22 07:18:12 UTC
Permalink
problem solved..
mysql-server has to starts before radius...
Post by Lukas Nuth
Hi,
FreeRADIUS starts with my virtual machine. Therefore Ubuntu created
the file "radiusd.service" itself. I activated "radius.service" with
"systemctl enable radiusd.service" so that FR starts with the virtual
machine.
Now the problem when FR starts with the virtual machine is that the
Mon Oct 22 08:45:40 2018 : Info: Debugger not attached
Mon Oct 22 08:45:41 2018 : Info: rlm_sql (sql): Driver rlm_sql_mysql
(module rlm_sql_mysql) loaded and linked
Mon Oct 22 08:45:42 2018 : Info: rlm_sql_mysql: libmysql version: 5.7.23
Mon Oct 22 08:45:42 2018 : Info: rlm_sql (sql): Attempting to connect
to database "radius"
Mon Oct 22 08:45:42 2018 : Info: rlm_sql (sql): Opening additional
connection (0), 1 of 32 pending slots used
Mon Oct 22 08:45:42 2018 : Error: rlm_sql_mysql: Couldn't connect to
Mon Oct 22 08:45:42 2018 : Error: rlm_sql_mysql: MySQL error: Can't
connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)
Mon Oct 22 08:45:42 2018 : Error: rlm_sql (sql): Opening connection
failed (0)
Instantiation failed for module "sql"
If I restart FR with "systemctl restart radiusd.service" this error
does not occur.
Can anyone help me?
regards
Lukas
-
List info/subscribe/unsubscribe? See
http://www.freeradius.org/list/users.html
--
Mit freundlichen Gruessen

Lukas Nuth
Rechenzentrum

Ostfalia Hochschule für angewandte Wissenschaften
- Hochschule Braunschweig/Wolfenbuettel -
Rechenzentrum
Herbert-Meyer-Straße 7
29556 Suderburg
Tel. : +49 5826 988-19390
Fax : +49 5826 988-19392
E-Mail : ***@ostfalia.de
URL : www.ostfalia.de/rz

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list
Ibrahim AKSIT
2018-10-22 07:18:32 UTC
Permalink
Hi there all,
it seems that your MySQL server is not running or the credentials for
connection mysql radius database is not correct. Could you please check the
file /etc/raddb/mods-enabled/sql at line 20?
That will give you glue to solve the problem.

Good lucks

İbrahim AKŞİT

Best Regards and Wishes
Yours Sincerely.
Post by Lukas Nuth
Hi,
FreeRADIUS starts with my virtual machine. Therefore Ubuntu created the
file "radiusd.service" itself. I activated "radius.service" with
"systemctl enable radiusd.service" so that FR starts with the virtual
machine.
Now the problem when FR starts with the virtual machine is that the
Mon Oct 22 08:45:40 2018 : Info: Debugger not attached
Mon Oct 22 08:45:41 2018 : Info: rlm_sql (sql): Driver rlm_sql_mysql
(module rlm_sql_mysql) loaded and linked
Mon Oct 22 08:45:42 2018 : Info: rlm_sql_mysql: libmysql version: 5.7.23
Mon Oct 22 08:45:42 2018 : Info: rlm_sql (sql): Attempting to connect to
database "radius"
Mon Oct 22 08:45:42 2018 : Info: rlm_sql (sql): Opening additional
connection (0), 1 of 32 pending slots used
Mon Oct 22 08:45:42 2018 : Error: rlm_sql_mysql: Couldn't connect to
Mon Oct 22 08:45:42 2018 : Error: rlm_sql_mysql: MySQL error: Can't
connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)
Mon Oct 22 08:45:42 2018 : Error: rlm_sql (sql): Opening connection
failed (0)
Instantiation failed for module "sql"
If I restart FR with "systemctl restart radiusd.service" this error does
not occur.
Can anyone help me?
regards
Lukas
-
List info/subscribe/unsubscribe? See
http://www.freeradius.org/list/users.html
-
List info/subscribe/unsubscribe? See http://www.f
Lukas Nuth
2018-10-22 07:32:08 UTC
Permalink
Sounds like in your current setup the system tries to start FreeRADIUS before the MySQL daemon has finished starting up, so when FR attempts to connect to the database, the database isn't ready for connections yet and the startup fails.
Yes, FR has started before the MySQL deamon.
When you launch it manually later on, MySQL has started and things connect fine.
I'm honestly not sure how to handle this elegantly - the "obvious" answer of making the service file wait until the database is running is distinctly non-trivial because the service file has no way of knowing /which/ type of database server it needs to wait on, or whether the database server it needs to connect to is even on the same system (mine aren't, for example).
Now I've configured the MySQL daemon so that it start before FR.
--Rens.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-
List info/subscribe/unsubscribe? See http://www.freeradius.o

Loading...