1

I managed to setup freeradius server on Centos 7 using compiled source at ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-3.0.18.tar.gz

Everything works perfectly fine except, the service can't run every time after reboot. I have to issue command...

sudo systemctl start radiusd

The service run successfully. Below are the logs

● radiusd.service - FreeRADIUS config by ME.
  Loaded: loaded (/usr/lib/systemd/system/radiusd.service; enabled; vendor preset: disabled)
  Active: active (running) since Sat 2022-01-22 00:10:50 +08; 7s ago
  Process: 2036 ExecStart=/opt/freeradius/sbin/radiusd -d /opt/freeradius/etc/raddb (code=exited, status=0/SUCCESS)
  Process: 2028 ExecStartPre=/opt/freeradius/sbin/radiusd (code=exited, status=0/SUCCESS)
  Process: 2023 ExecStartPre=/opt/freeradius/sbin/radiusd -C (code=exited, status=0/SUCCESS)
  Process: 2020 ExecStartPre=/bin/chown -R radiusd.radiusd /var/run/radiusd (code=exited, status=0/SUCCESS)
  Main PID: 2039 (radiusd)
  CGroup: /system.slice/radiusd.service
       └─2039 /opt/freeradius/sbin/radiusd -d /opt/freeradius/etc/raddb

Here is my systemd content for radiusd.service

[Unit]
 Description=FreeRADIUS config by ME.
 After=syslog.target network.target ipa.service dirsrv.target krb5kdc.service smb.service nmb.service

[Service]
 Type=forking
 #PIDFile=/var/run/radiusd/radiusd.pid

 ExecStartPre=-/bin/chown -R radiusd.radiusd /var/run/radiusd
 ExecStartPre=/opt/freeradius/sbin/radiusd -C
 ExecStart=/opt/freeradius/sbin/radiusd -d /opt/freeradius/etc/raddb
 ExecReload=/opt/freeradius/sbin/radiusd
 ExecReload=/bin/kill -HUP $MAINPID

[Install]
 WantedBy=multi-user.target

This is system log after the reboot

● radiusd.service - FreeRADIUS config by ME.
  Loaded: loaded (/usr/lib/systemd/system/radiusd.service; enabled; vendor preset: disabled)
  Active: failed (Result: exit-code) since Sat 2022-01-22 00:32:31 +08; 48s ago
  Process: 1320 ExecStartPre=/opt/freeradius/sbin/radiusd -C (code=exited, status=1/FAILURE)
  Process: 1284 ExecStartPre=/bin/chown -R radiusd.radiusd /var/run/radiusd (code=exited, status=0/SUCCESS)

 Jan 22 00:32:22 myhost systemd[1]: Starting FreeRADIUS config by ME....
 Jan 22 00:32:31 myhost systemd[1]: radiusd.service: control process exited, code=exited status=1
 Jan 22 00:32:31 myhost systemd[1]: Failed to start FreeRADIUS config by ME..
 Jan 22 00:32:31 myhost systemd[1]: Unit radiusd.service entered failed state.
 Jan 22 00:32:31 myhost systemd[1]: radiusd.service failed.

I just don't know where else to look because this is the only log that i found.

  • Seems that there is a separate log file configured by default: https://wiki.freeradius.org/config/Logging . Should be `/var/log/radius/radius.log`. – Haxiel Jan 22 '22 at 04:29
  • that one is for default freeradius log if installed from package. mine is at /opt/freeradius/var/log/radius/radius.log – luca ditrimma Jan 22 '22 at 04:44

1 Answers1

0

From the man page...

The server can return a zero status code when run with -C, but may still exit with an error when run normally.

I think I would just get rid of ExecStartPre=/opt/freeradius/sbin/radiusd -C.

If you have not made any changes then there would seem to be no point in running the check.

Bib
  • 2,056
  • 1
  • 4
  • 10
  • you mean remove -C option from the line? I already tried that. But still the same error. Process: 1320 ExecStartPre=/opt/freeradius/sbin/radiusd (code=exited, status=1/FAILURE) – luca ditrimma Jan 23 '22 at 03:10
  • No, remove the entire line. It;s that which is exiting. – Bib Jan 23 '22 at 11:22
  • just tried that. no luck. after reboot, it came out with this error: Process: 1290 ExecStart=/opt/freeradius/sbin/radiusd -d /opt/freeradius/etc/raddb (code=exited, status=1/FAILURE) Manual command can start successfully. – luca ditrimma Jan 23 '22 at 17:53
  • Then change it to `ExecStart=/opt/freeradius/sbin/radiusd -X -d /opt/freeradius/etc/raddb`, and look at the debugging info. The `-X` does that. – Bib Jan 23 '22 at 18:12
  • after using -X option, I can see error "Failed resolving "xxx1.xxxxxx.com" to IPv4 address: Name or service not known", which is my home_server {} setting in /opt/freeradius/etc/raddb/proxy.conf. When I run the service manually, this error didn't occur. And I can confirm that the server is running from ping request. – luca ditrimma Jan 23 '22 at 18:49
  • In that case, either change it to an IP address or ensure DNS is up and running properly, and reinstate the removed line. – Bib Jan 23 '22 at 20:54