New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kamailio.service: fixed RunTimeDir Permission Error #1754
Conversation
systemd service file: fixed runtime folder permission error. When starting Kamailio on Centos 7 with systemctl , it gives "/var/run/kamailio Permission denied error" to create kamailio.pid file. - RuntimeDirectory defines folder name in /var/run - RuntimeDirectoryMode creates folder in path /var/run/ as given User:Group with permission - PermissionsStartOnly applies on ExecStart for permission-related execution options
@@ -7,9 +7,13 @@ After=network-online.target | |||
Type=simple | |||
User=kamailio | |||
Group=daemon | |||
PermissionsStartOnly=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need change PermissionsStartOnly=true
?
What is error you try fix?
Environment='CFGFILE=/etc/kamailio/kamailio.cfg' | ||
Environment='SHM_MEMORY=64' | ||
Environment='PKG_MEMORY=4' | ||
RuntimeDirectory=kamailio | ||
RuntimeDirectoryMode=0755 | ||
PIDFile=/var/run/kamailio/kamailio.pid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PIDFile
is optional put may be accepted.
Could you also describe how RuntimeDirectory
and RuntimeDirectoryMode
help you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also look https://www.freedesktop.org/software/systemd/man/systemd.service.html
.
If set to forking, it is expected that the process configured with ExecStart= will call fork() as
part of its start-up. The parent process is expected to exit when start-up is complete and all
communication channels are set up. The child continues to run as the main daemon
process. This is the behavior of traditional UNIX daemons. If this setting is used, it is
recommended to also use the PIDFile= option, so that systemd can identify the main
process of the daemon. systemd will proceed with starting follow-up units as soon as the
parent process exits.
PIDFile
is used when process started as forking process. Now Kamailio is starts as simple
process with -DD
options. Main process is still alive and not need to use PIDFile
.
About your description |
Please check content of |
I tested on 5.2.0 release and not see any issues with
I can see error
But this not related to systemd unit file. |
warning is fixed in PR #1756
|
Hello @sergey-safarov Mykamailios were installed from git so as you said that i create kamailio-run directory file with wrong permission so kamailio never starts for my config. My addition to service file that helps to create kamailio-run directory with given user:group with permission on start and and deletes it on stop. i thought it is easy way to create run-dir. i found my mistake , thanks for your review. |
I have made same decision when i start write my first systemd units. Late I found systemd special tools for |
Pre-Submission Checklist
in
doc/
subfolder, the README file is autogenerated)Type Of Change
Checklist:
Description
kamailo.service file: fixed RunTime Dir Permission Error
When starting Kamailio on Centos 7 with systemctl , it gives "/var/run/kamailio Permission denied error" to create kamailio.pid file.