freeradius3 couldnt connect to mysql-server
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 radius@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
problem solved.. mysql-server has to starts before radius... Am 22.10.2018 um 09:07 schrieb 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 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 radius@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/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 : l.nuth@ostfalia.de URL : www.ostfalia.de/rz
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. On Mon, Oct 22, 2018 at 10:07 AM Lukas Nuth <l.nuth@ostfalia.de> wrote:
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 radius@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/users.html
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. 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). Doesn't the FR daemon regard "can't connect to the database server" as a "temporary problem, keep running and try again later" type of error rather than "everything is terrible, terminate right away" error? --Rens.
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
participants (3)
-
Ibrahim AKSIT -
Lukas Nuth -
Rens Houben