signalwire / freeswitch

FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device.
https://freeswitch.com/#getting-started
Other
3.57k stars 1.42k forks source link

Cant start freeswitch .:. ERROR: Failed to set SCHED_FIFO scheduler (Operation not permitted) #758

Closed Svenchenchen closed 3 years ago

Svenchenchen commented 4 years ago

I have installed freeswitch on a fresh centos7.8 and I always get the error message. freeswitch was installed from the rpm package according to the instructions.

ERROR: Failed to set SCHED_FIFO scheduler (Operation not permitted)
ERROR: Could not set nice level

Sometimes there is an entry: Cannot Initialize [[error near line 8161]: unexpected closing tag </condition>] in the journal

mjerris commented 4 years ago

this is a permissions issue of some sort. how are you starting freeswitch?

Svenchenchen commented 4 years ago

Hello I'm starting Freeswitch as a service. I started it in the foreground and always get the same error message.

systemctl status freeswitch
● freeswitch.service - FreeSWITCH
   Loaded: loaded (/usr/lib/systemd/system/freeswitch.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mo 2020-07-27 22:54:19 CEST; 9s ago
  Process: 70301 ExecStart=/usr/bin/freeswitch -nc -nf $FREESWITCH_PARAMS (code=exited, status=255)
 Main PID: 70301 (code=exited, status=255)

Jul 27 22:54:19 localhost systemd[1]: Started FreeSWITCH.
Jul 27 22:54:19 localhost freeswitch[70301]: ERROR: Failed to set SCHED_FIFO scheduler (Operation not permitted)
Jul 27 22:54:19 localhost freeswitch[70301]: ERROR: Could not set nice level
Jul 27 22:54:19 localhost systemd[1]: freeswitch.service: main process exited, code=exited, status=255/n/a
Jul 27 22:54:19 localhost systemd[1]: Unit freeswitch.service entered failed state.
Jul 27 22:54:19 localhost systemd[1]: freeswitch.service failed.
mjerris commented 4 years ago

under what user? you probably need to start as root and drop perms for that to work. the xml config error is unrelated to the op not permitted.

Svenchenchen commented 4 years ago

under root

freeswitch -nc
result: 71265 Backgrounding

freeswitch -nc -nf
result: Cannot Initialize [[error near line 8161]: unexpected closing tag </condition>]
ontur00 commented 4 years ago

Hi that someone did with that problem or maybe have advice what to do ?

`[root@localhost ~]# fs_cli [ERROR] fs_cli.c:1691 main() Error Connecting []

[root@localhost ~]# service freeswitch status Redirecting to /bin/systemctl status freeswitch.service ● freeswitch.service - FreeSWITCH Loaded: loaded (/usr/lib/systemd/system/freeswitch.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since pon 2020-08-24 12:20:04 CEST; 1h 46min ago Main PID: 11988 (code=exited, status=255)

sie 24 12:20:03 localhost systemd[1]: Started FreeSWITCH. sie 24 12:20:04 localhost freeswitch[11988]: ERROR: Failed to set SCHED_FIFO scheduler (Operation not permitted) sie 24 12:20:04 localhost freeswitch[11988]: ERROR: Could not set nice level sie 24 12:20:04 localhost freeswitch[11988]: Cannot Initialize [[error near line 8810]: unexpected closing tag ] sie 24 12:20:04 localhost systemd[1]: freeswitch.service: main process exited, code=exited, status=255/n/a sie 24 12:20:04 localhost systemd[1]: Unit freeswitch.service entered failed state. sie 24 12:20:04 localhost systemd[1]: freeswitch.service failed.`

dragos-oancea commented 4 years ago

Solve the xml config issue first: "Cannot Initialize [[error near line 8810]: unexpected closing tag ]"

ontur00 commented 4 years ago

Solve the xml config issue first: "Cannot Initialize [[error near line 8810]: unexpected closing tag ]" Where i can find config ? /etc/freeswitch/*.xml ? The name of this file and which directory ?

boteman commented 4 years ago

The error line number refers to the master configuration file freeswitch.xml.fsxml which is a concatenation of all the configuration files. Search for that file, find the line number mentioned above, and determine which configuration file contains the error. Edit the individual configuration file, not the freeswitch.xml.fsxml which changes every time FS starts.

ontur00 commented 4 years ago

Ok i find freeswitch.xml.fsxml at directory /var/log/freeswitch/freeswitch.xml.fsxml I find line 8810 with string "!-- inbound calls / DID --" After try find string at "!-- inbound calls / DID --" at some dir.

grep -rnw '/usr/src/freeswitch/' -e '!-- inbound calls / DID --' I found this line at /usr/ictcore/etc/freeswitch/dialplan/ictcore.xml xml look like https://ctxt.io/2/AADAt5IhFA

or ictcore.txt

But i did not see any problem with [[error near line x]: unexpected closing tag ]"

ontur00 commented 4 years ago

Ok i solved the problem But now i have new one after type on root [root@localhost ~]# service freeswitch status

Redirecting to /bin/systemctl status freeswitch.service ● freeswitch.service - FreeSWITCH Loaded: loaded (/usr/lib/systemd/system/freeswitch.service; enabled; vendor preset: disabled) Active: active (running) since czw 2020-08-20 14:34:16 CEST; 21h ago Main PID: 2037 (freeswitch) CGroup: /system.slice/freeswitch.service └─2037 /usr/bin/freeswitch -nc -nf

sie 20 14:34:16 localhost.localdomain systemd[1]: Started FreeSWITCH. sie 20 14:34:16 localhost.localdomain freeswitch[2037]: ERROR: Failed to set SCHED_FIFO scheduler (Operation not permitted) sie 20 14:34:16 localhost.localdomain freeswitch[2037]: ERROR: Could not set nice level

What can i do with this errors ?

yuyujulin commented 3 years ago

same error。 run freeswitch by ‘systemctl start freeswitch’ under root. it gives me:

[root@localhost freeswitch]# systemctl status freeswitch
● freeswitch.service - FreeSWITCH
   Loaded: loaded (/usr/lib/systemd/system/freeswitch.service; enabled; vendor preset: disabled)
   Active: active (running) since 三 2020-12-02 23:11:54 CST; 23min ago
 Main PID: 57658 (freeswitch)
   CGroup: /system.slice/freeswitch.service
           └─57658 /usr/bin/freeswitch -nc -nf

12月 02 23:11:54 localhost.localdomain systemd[1]: Started FreeSWITCH.
12月 02 23:11:54 localhost.localdomain freeswitch[57658]: ERROR: Failed to set SCHED_FIFO scheduler (Operation not permitted)
12月 02 23:11:54 localhost.localdomain freeswitch[57658]: ERROR: Could not set nice level
thechonta commented 3 years ago

@ontur00 How culd you solv the Problem with the xml and the /condition tag? I try to run the ictfax centos7 arcording to the officiel documentation but the system does not work at all. No fax can be send becaus freeswitch does not work.....

ChrisZhangJin commented 3 years ago

hi all, i added non-root user freeswitch:freeswitch in centos, and run freeswitch with user/group freeswitch:freeswitch. the same issue happened.

Does it mean that it must use root to run freeswitch??

I just use the command 'freeswitch -nonat' to run.

mjerris commented 3 years ago

you can use command line params to drop permissions to a diff user

whosgonna commented 3 years ago

The issue looks to arise from the .rpm for Freeswitch. After following these instructions to install, I have the following systemd unit file for the service. The user is set here (User=Freeswitch). This should probably be done more like the the debian systemd unit file, setting Environment="USER=freeswitch", and then passing ${USER} to freeswitch as a parameter in the ExecStart.

[root@freeswitch01 ben]# cat /usr/lib/systemd/system/freeswitch.service
[Unit]
Description=FreeSWITCH
After=syslog.target network.target
After=postgresql.service postgresql-9.3.service postgresql-9.4.service mysqld.service httpd.service

[Service]
User=freeswitch
EnvironmentFile=-/etc/sysconfig/freeswitch
# RuntimeDirectory is not yet supported in CentOS 7. A workaround is to use /etc/tmpfiles.d/freeswitch.conf
#RuntimeDirectory=/run/freeswitch
#RuntimeDirectoryMode=0750
WorkingDirectory=/run/freeswitch
ExecStart=/usr/bin/freeswitch -nc -nf $FREESWITCH_PARAMS
ExecReload=/usr/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

It looks like this is setup from [build/freeswitch.service](It looks like this is setup from freeswitch/build/freeswitch.service. Thoughts on this change?). Thoughts on this change?

[Unit]
Description=FreeSWITCH
After=syslog.target network.target
After=postgresql.service postgresql-9.3.service postgresql-9.4.service mysqld.service httpd.service

[Service]
EnvironmentFile=-/etc/sysconfig/freeswitch
Environment="USER=freeswitch"
# RuntimeDirectory is not yet supported in CentOS 7. A workaround is to use /etc/tmpfiles.d/freeswitch.conf
#RuntimeDirectory=/run/freeswitch
#RuntimeDirectoryMode=0750
WorkingDirectory=/run/freeswitch
ExecStart=/usr/bin/freeswitch -nc -nf -u ${USER} $FREESWITCH_PARAMS
ExecReload=/usr/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
whosgonna commented 3 years ago

There's also a bit of misunderstanding in the initial issue report. The failure to start freeswitch appears to be due to misconfiguration.

The following lines:

ERROR: Failed to set SCHED_FIFO scheduler (Operation not permitted)
ERROR: Could not set nice level

Are caused by the issue with the systemd unit file.

bbslucky commented 2 weeks ago

i meet same question,and i deal it in freeswitch.service EnvironmentFile=-/etc/sysconfig/freeswitch must point to your path ,if build from souce,change it to -/usr/local/freeswitch/etc/freeswitch,that's ok