Unable to create control socket

email.me at kevp.com email.me at kevp.com
Mon Apr 27 00:06:37 CEST 2020


Thanks for the reply Matthew.
You got me thinking... and I worked out what's happening.

The runtime directory does get correctly created (and then freeradius starts correctly) when run as a service with:
sudo systemctl start freeradius.service

But if you stop the service and then run sudo freeradius -X you get the error because systemd isn't being invoked and doesn't create the directory.

Creating the directory manually is a workaround but if you ever start and then stop the service with systemctl the directory is deleted on stop by default and sudo freeradius -X fails again.

The workaround I'm going to use, so I can still use sudo freeradius -x for troubleshooting, is to add the following line to freeradius.service:
RuntimeDirectoryPreserve=yes

[ You also need to run this after this change to reload the service config: sudo systemctl daemon-reload ]

This prevents the run directory from being deleted when the service is stopped.
Given the service tries to start on boot, stopping it and then running sudo freeradius -X will then work.

I'm not suggesting that the preserve line needs to be added to the source code but sudo freeradius -X won't work without this directory if the control socket is enabled on Ubuntu.

Cheers

Kev/.


-----Original Message-----
From: Freeradius-Users <freeradius-users-bounces+email.me=kevp.com at lists.freeradius.org> On Behalf Of Matthew Newton
Sent: 26 April 2020 16:17
To: freeradius-users at lists.freeradius.org
Subject: Re: Unable to create control socket



On 26/04/2020 14:31, email.me at kevp.com wrote:
> I then add a symlink to turn on the control-socket and sudo freeradius 
> -X gives the error:

Which symlink? sites-enabled, or something else?

> Failed creating control socket "/var/run/freeradius/freeradius.sock": 
> Failed creating control socket directory: Permission denied
> 
> I know the service startup has comments about the directory creation 
> not working on Ubuntu Bionic (18.04).

Yes, but the lines above it do work. Or at least they did.

> So I've tried creating /usr/lib/tmpfiles.d/freeradius.conf containing: 
> 'd /var/run/freeradius 0755 freerad freerad -'
> 
> Ran sudo systemd-tmpfiles --create but no /var/run/freeradius

That shouldn't be necessary.

> Anyone know how to get the control-socket to start correctly on Bionic?

I'm pretty sure it was working, we went through a load of testing to get unit file settings that worked on multiple systems, hence the comments and (essentially) duplicated solution. Maybe Ubuntu changed something.

--
Matthew
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html




More information about the Freeradius-Users mailing list