我在搞乱FreeRADIUS
,MySQL (MariaDB)
似乎 FreeRADIUS 服务在启动时无法正常启动。但它使用root
用户或调试模式 ( radiusd -X
) 可以正常启动并且工作正常!调试模式显示没有错误。
systemctl
命令显示 radiusd.service 无法启动。
/var/log/messages 输出:
Aug 21 15:52:29 nexus-test systemd: Starting The Apache HTTP Server...
Aug 21 15:52:29 nexus-test systemd: Starting MariaDB database server...
Aug 21 15:52:29 nexus-test systemd: Starting FreeRADIUS high performance RADIUS server....
Aug 21 15:52:29 nexus-test systemd: Started OpenSSH server daemon.
Aug 21 15:52:29 nexus-test mysqld_safe: 140821 15:52:29 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Aug 21 15:52:29 nexus-test mysqld_safe: 140821 15:52:29 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Aug 21 15:52:30 nexus-test systemd: Started Postfix Mail Transport Agent.
Aug 21 15:52:30 nexus-test avahi-daemon[604]: Registering new address record for fe80::250:56ff:fe85:e4af on eth0.*.
Aug 21 15:52:30 nexus-test systemd: radiusd.service: control process exited, code=exited status=1
Aug 21 15:52:30 nexus-test systemd: Failed to start FreeRADIUS high performance RADIUS server..
Aug 21 15:52:30 nexus-test systemd: Unit radiusd.service entered failed state.
Aug 21 15:52:31 nexus-test kdumpctl: kexec: loaded kdump kernel
Aug 21 15:52:31 nexus-test kdumpctl: Starting kdump: [OK]
Aug 21 15:52:31 nexus-test systemd: Started Crash recovery kernel arming.
Aug 21 15:52:31 nexus-test systemd: Started The Apache HTTP Server.
Aug 21 15:52:31 nexus-test systemd: Started MariaDB database server.
/var/log/radius/radius.log 输出:
Thu Aug 21 15:24:16 2014 : Info: rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
Thu Aug 21 15:24:16 2014 : Info: rlm_sql (sql): Attempting to connect to database "radius"
Thu Aug 21 15:24:16 2014 : Info: rlm_sql (sql): Opening additional connection (0)
Thu Aug 21 15:24:16 2014 : Error: rlm_sql_mysql: Couldn't connect socket to MySQL server radius@localhost:radius
Thu Aug 21 15:24:16 2014 : Error: rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Thu Aug 21 15:24:16 2014 : Error: rlm_sql (sql): Opening connection failed (0)
Thu Aug 21 15:24:16 2014 : Error: /etc/raddb/mods-enabled/sql[47]: Instantiation failed for module "sql"
看到这个后,我尝试复制问题,杀死mariadb.service
并再次开始运行调试模式。它吐出与radius.log
.
我尝试禁用iptables
并firewalld
重新启动,但没有运气:
systemctl disable iptables
systemctl disable firewalld
因此,问题可能出在进程启动顺序或某种延迟上。也许 FreeRADIUS 的 SQL 模块无法连接到尚未启动的 MariaDB?如果是,我该如何解决这个问题?
在早期版本的 RHEL/CENTOS 中,我知道你很容易看到服务启动顺序,比如 rc.d 或其他东西,现在是 IDK。我对 Centos 7 引入的这个花哨的“systemd”、“systemctl”、“firewalld”东西很陌生,很抱歉我有点困惑。还有这个新FreeRADIUS 3
结构...
PS。MariaDB 在启动时启用,FR DB 配置中的凭据正确
一点更新:
cat /etc/systemd/system/multi-user.target.wants/radiusd.service输出:
[Unit]
Description=FreeRADIUS high performance RADIUS server.
After=syslog.target network.target
[Service]
Type=forking
PIDFile=/var/run/radiusd/radiusd.pid
ExecStartPre=-/bin/chown -R radiusd.radiusd /var/run/radiusd
ExecStartPre=/usr/sbin/radiusd -C
ExecStart=/usr/sbin/radiusd -d /etc/raddb
ExecReload=/usr/sbin/radiusd -C
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target