2974 pid files didnt created by port [Archive] - The FreeBSD Forums

PDA

View Full Version : pid files didnt created by port


sugar
December 15th, 2008, 04:31
Hello, I installed the Kannel port on my FreeBSD box, and it seems like a bug or somethig, I had to manually create the kannel user, and it seems like have to create the pid files as well... this is the error that now I am getting when trying to start Kannel:
radius# /usr/local/etc/rc.d/kannel start
Starting kannel_bearerbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_bearerbox.pid: No such file or directory
Starting kannel_smsbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_smsbox.pid: No such file or directory
Starting kannel_wapbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_wapbox.pid: No such file or directory

Well... I decided to create manually the pid files, and after trying to start the kannel daemon again I got these errors:

radius# /usr/local/etc/rc.d/kannel start
Starting kannel_bearerbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_bearerbox.pid: Permission denied
Starting kannel_smsbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_smsbox.pid: Permission denied
Starting kannel_wapbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_wapbox.pid: Permission denied

Then I chowned the pid files to kannel user and finally the kannel services were started:
radius# chown kannel *.*
radius# /usr/local/etc/rc.d/kannel start
Starting kannel_bearerbox.
Starting kannel_smsbox.
Starting kannel_wapbox.

The thing now is that each time I restart the box, I get the same "Permission denied" error with the pid files, how can I permanently fix this?

Thanks in advance.

graudeejs
December 15th, 2008, 05:34
pid files? what (exactly) is that? ([i guess it's like serverauth.xxx, when X starts)
Does that process have write permission on directory it uses pid-files?

sugar
December 15th, 2008, 05:41
Thanks for the response, as I am new on this I had to look on google that a PID file is and according to PidFile (http://daemons.rubyforge.org/classes/Daemons/PidFile.html) this is a pid file:
A Pid-File is a file containing the process identification number (pid) that is stored in a well-defined location of the filesystem thus allowing other programs to find out the pid of a running script.

Daemons needs the pid of the scripts that are currently running in the background to send them so called signals. Daemons uses the TERM signal to tell the script to exit when you issue a stop command.

I have installed many port files before, but this is the first time that I had to create manually the process user and the PID files, maybe that's why the process can't access the PID file, because I did something wrong, or because the bug in the port make file or bad port setup...

How can I have that process to have permanently permissions to its PID files?

graudeejs
December 15th, 2008, 05:48
why did you need to create new user for deamon?


anyway
man chmod (http://www.freebsd.org/cgi/man.cgi?query=chmod&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html)


chmod u+rwx /directory/with_pid_file
chmod u+rw /directory/with_pid_file/pid_file_itself

or if you need to change group permission use "o" instead of "u".
you can use bough..... read man i gave you

also if you haven't already change pid-files and/or pid-files directory owner/group
man chown (http://www.freebsd.org/cgi/man.cgi?query=chown&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html)

sugar
December 15th, 2008, 05:55
oh, I forgot to chmod the /var/run/kannel with the -R option to make the command recursive...

Thanks!
And I created manually the user kannel because the port setup didn't create it...

graudeejs
December 15th, 2008, 05:56
well, probably if it didn't create it you didn't need it...
anyway, does it work now?

sugar
December 15th, 2008, 06:05
The reason I started this post is because just after installed the kannel from the ports distribution, I got this error:
radius# /usr/local/etc/rc.d/kannel start
Starting kannel_bearerbox.
su: unknown login: kannel
Starting kannel_smsbox.
su: unknown login: kannel
Starting kannel_wapbox.
su: unknown login: kannel

Then I created the kannel user, and then the error was this:
radius# /usr/local/etc/rc.d/kannel start
Starting kannel_bearerbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_bearerbox.pid: No such file or directory
Starting kannel_smsbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_smsbox.pid: No such file or directory
Starting kannel_wapbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_wapbox.pid: No such file or directory
Then I created the /var/run/kannel directory and its pid files, in my try to solve the problem, after that I got this error:

radius# /usr/local/etc/rc.d/kannel start
Starting kannel_bearerbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_bearerbox.pid: Permission denied
Starting kannel_smsbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_smsbox.pid: Permission denied
Starting kannel_wapbox.
/usr/local/sbin/run_kannel_box: open: /var/run/kannel/kannel_wapbox.pid: Permission denied

Now, I chowned the /var/run/kannel folder and its pid files to kannel user and finally the kannel services were started:
radius# /usr/local/etc/rc.d/kannel start
Starting kannel_bearerbox.
Starting kannel_smsbox.
Starting kannel_wapbox.

Now I realized that there are something that can be a potential issue:
In the top command it display all the services running as root, and the kannel services are running as kannel... look:

last pid: 889; load averages: 0.00, 0.03, 0.05 up 0+00:11:21 21:20:40
76 processes: 1 running, 75 sleeping
CPU states: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle
Mem: 40M Active, 24M Inact, 30M Wired, 36K Cache, 24M Buf, 145M Free
Swap: 478M Total, 478M Free

PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND
842 root 1 96 0 3488K 1772K CPU0 0 0:00 0.00% top
747 root 1 96 0 26956K 14056K select 0 0:00 0.00% httpd
737 mysql 10 96 0 62148K 20828K ucond 1 0:00 0.00% mysqld
644 kannel 13 96 0 16916K 3860K ucond 0 0:00 0.00% bearerbox
688 root 1 96 0 5896K 2348K select 0 0:00 0.00% nmbd
834 aldo 1 96 0 8384K 3804K select 1 0:00 0.00% sshd
831 root 1 4 0 8384K 3824K sbwait 0 0:00 0.00% sshd
666 kannel 9 96 0 16404K 3816K select 1 0:00 0.00% wapbox
699 root 1 96 0 7680K 5728K select 0 0:00 0.00% perl5.8.8
838 root 1 20 0 4452K 2428K pause 0 0:00 0.00% csh
692 root 1 96 0 8088K 3748K select 0 0:00 0.00% smbd
532 root 1 96 0 3156K 1196K select 1 0:00 0.00% syslogd
766 root 1 96 0 5848K 3188K select 0 0:00 0.00% sendmail
882 root 1 96 0 3448K 2568K select 0 0:00 0.00% proftpd
654 kannel 1 8 0 7188K 2204K nanslp 0 0:00 0.00% run_kannel_bo
837 aldo 1 8 0 3592K 1560K wait 1 0:00 0.00% su
712 mysql 1 8 0 3456K 1432K wait 1 0:00 0.00% sh

Can be that a potential issue?

Thanks again.

graudeejs
December 15th, 2008, 07:02
i don't think so, probably more like a security measurement
but i'm not security expert

0