Summary: | ASTERISK-15069: [patch] "make config" creates really wrong runlevels in Debian (includes patch) | ||
Reporter: | Iñaki Baz Castillo (ibc) | Labels: | patch |
Date Opened: | 2009-11-03 10:37:41.000-0600 | Date Closed: | |
Priority: | Minor | Regression? | No |
Status: | Open/New | Components: | General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) Makefile.patch.2 | |
Description: | When running "make config" under Debian, it creates wrong runlevels: /etc# ls -l rc*/*asterisk* rc2.d/K91asterisk -> ../init.d/asterisk rc2.d/S50asterisk -> ../init.d/asterisk rc3.d/K91asterisk -> ../init.d/asterisk rc3.d/S50asterisk -> ../init.d/asterisk rc4.d/K91asterisk -> ../init.d/asterisk rc4.d/S50asterisk -> ../init.d/asterisk rc5.d/K91asterisk -> ../init.d/asterisk rc5.d/S50asterisk -> ../init.d/asterisk* These runleves are really annoying and make no sense at all. Why are there "K" entries in runleves 2, 3, 4 and 5? "K" means "stop" action and the system never invoke "/etc/init.d/SERVIC_NAME stop" in runleves 2, 3, 4 and 5. Instead, "stop" action is just invoked in runleves 0 ("stop") and 6 ("reboot"). Also note that there is no "K" (stop) actions in runleves 0 and 6, so asterisk is not terminated by the system when shuting down or rebooting. For example, I show correct runlevels Kamailio creates when installing it as Deb package: /etc# ls -l rc*/*kamailio* rc0.d/K23kamailio -> ../init.d/kamailio rc1.d/K23kamailio -> ../init.d/kamailio rc2.d/S23kamailio -> ../init.d/kamailio rc3.d/S23kamailio -> ../init.d/kamailio rc4.d/S23kamailio -> ../init.d/kamailio rc5.d/S23kamailio -> ../init.d/kamailio rc6.d/K23kamailio -> ../init.d/kamailio This does make sense since "S" (start) actions exist for runlevels 1, 2, 3, 4 and 5 while "K" (stop) actions exist for 0 and 6. In order to fix it I attach a patch for Asterisk Makefile (note that it's based on Asterisk 1.4.26-rc4) which does the following: - Creates "S" (start) actions in 1,2,3,4,5. - Creates "K" (stop) actions in 0,6. - The start actions have priority 50 (as now). - The stop actions have priority 20. This is important in order Asterisk to be shutdown before the system tries to shutdown dahdi, wanpipe and so (in fact there is a bug with dahdi/wanpipe and the server crashes if dahdi is shutdown before ending Asterisk). | ||
Comments: | By: Jason Parker (jparker) 2009-11-03 11:47:03.000-0600 Shouldn't it be 2,3,4,5 and 0,1,6? By: Iñaki Baz Castillo (ibc) 2009-11-03 11:56:03.000-0600 I don't think so. Runlevel 1 is "single user" in most systems. In Debian it's as follows: * 0 System Halt * 1 Single user * 2 Full multi-user mode (Default) * 3-5 Same as 2 * 6 System Reboot http://www.debian-administration.org/article/An_introduction_to_run-levels http://en.wikipedia.org/wiki/Runlevel#Typical_Linux_runlevels By: Jason Parker (jparker) 2009-11-03 11:56:52.000-0600 Then your kamailio example is in error. :) By: Jason Parker (jparker) 2009-11-03 12:01:09.000-0600 If you look on a Debian system, you'll see that there are many services that stop in runlevel 1. 2,3,4,5 and 0,1,6 would be appropriate. Please adjust the patch to reflect that. By: Iñaki Baz Castillo (ibc) 2009-11-03 12:04:07.000-0600 ok, it seems that runlevel 1 is not commonly used to start services. I will change the patch and re-upload it. By: Iñaki Baz Castillo (ibc) 2009-11-03 12:19:55.000-0600 Done. "Makefile.patch.2" has 2,3,4,5 and 0,1,6 runlevels. I forgot to set the attachmet as "code", hope it's not a problem. By: Tzafrir Cohen (tzafrir) 2009-11-07 11:14:57.000-0600 No runlevels should explicitly be used: update-rc.d asterisk defaults NN NN And I figure it might make sense to use a number higher than 20, to make sure asterisk is stopped after e.g. mysql. By: Iñaki Baz Castillo (ibc) 2009-11-09 10:38:43.000-0600 > @tzafrir: No runlevels should explicitly be used: update-rc.d asterisk defaults NN NN tzafrir, please read mi entire report in which I clearly explain that: - The start actions have priority 50 (as now). - The stop actions have priority 20. This is important in order Asterisk to be shutdown before the system tries to shutdown dahdi, wanpipe and so (in fact there is a bug with dahdi/wanpipe and the server crashes if dahdi is shutdown before ending Asterisk). But start action must have a high value (50) to start before common system services as iptables, nfs, ssh and so. By: Tzafrir Cohen (tzafrir) 2009-11-09 11:06:45.000-0600 asterisk should start after mysql, postgresql, openldap, and such. I don't see any point in Asterisk starting before iptables, NFS or ssh. It should probably start after them (surely after NFS: $local_fs). But my remark was that you don't need to explicitly state the runlevels. The 'defaults' syntax allows defining the priority and using the standard runlevels. I don't see any point in deviating from that. By: Iñaki Baz Castillo (ibc) 2009-11-09 11:30:23.000-0600 @tzafrir, it was my fault in my last comment, but I don't mean say that asterisk should start BEFORE mysql, postgresql, openldap, and such. Instead I say that it must start AFTER them. So 50 is a good value for the start action. However it must stop before dahdi, wanpipe and so, so a 20 value for "stop" action is good. Using rc-update.d with "default" will configure Asterisk to stop after dahdi and wanpipe so it's not valid. I don't see why we must use "default" value instead of setting start and stop values manually in the way we know it will work. |