Debian 8 openSIPS starts before MySQL on boot end exits with MySQL error

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I installed and configured openSIPS 2.3 with MySQL on a Debian 8.10 but on boot openSIPS wont start because it starts before MySQL and can't connect to the database. After the system booted up can start opensips without error.
I found what it looked like a solution on an openSIPS mailing list, but I still get the same error.
What I did so far is editing /etc/init.d/opensisp and cahanged init info to this
### BEGIN INIT INFO
# Provides: opensips
# Required-Start: $syslog $network $local_fs $time
# Required-Stop: $syslog $network $local_fs
# Should-Start: mysql #added this
# Should-Stop: mysql #and this
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the OpenSIPS SIP server
# Description: Start the OpenSIPS SIP server
### END INIT INFO
than I run insserv -v opensips and rebooted, but its the same opensisp fails with couldn't connect to db error
ERROR:db_mysql:db_mysql_connect: driver error(2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ERROR:db_mysql:db_mysql_new_connection: initial connect failed
according to /ÃÂtc/rc?.d mysql should start before opensips but its not what happens or mysql isn't fully started when opensips starts.
here is a dump of rc for mysql and opensips
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc0.d/K02mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc1.d/K02mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc2.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc3.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc4.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc5.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc6.d/K02mysql -> ../init.d/mysql
############
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc0.d/K01opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc1.d/K01opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc2.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc3.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc4.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc5.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc6.d/K01opensips -> ../init.d/opensips
How can I force openSIPS to wait for mysql?
debian services
 |Â
show 1 more comment
up vote
0
down vote
favorite
I installed and configured openSIPS 2.3 with MySQL on a Debian 8.10 but on boot openSIPS wont start because it starts before MySQL and can't connect to the database. After the system booted up can start opensips without error.
I found what it looked like a solution on an openSIPS mailing list, but I still get the same error.
What I did so far is editing /etc/init.d/opensisp and cahanged init info to this
### BEGIN INIT INFO
# Provides: opensips
# Required-Start: $syslog $network $local_fs $time
# Required-Stop: $syslog $network $local_fs
# Should-Start: mysql #added this
# Should-Stop: mysql #and this
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the OpenSIPS SIP server
# Description: Start the OpenSIPS SIP server
### END INIT INFO
than I run insserv -v opensips and rebooted, but its the same opensisp fails with couldn't connect to db error
ERROR:db_mysql:db_mysql_connect: driver error(2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ERROR:db_mysql:db_mysql_new_connection: initial connect failed
according to /ÃÂtc/rc?.d mysql should start before opensips but its not what happens or mysql isn't fully started when opensips starts.
here is a dump of rc for mysql and opensips
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc0.d/K02mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc1.d/K02mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc2.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc3.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc4.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc5.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc6.d/K02mysql -> ../init.d/mysql
############
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc0.d/K01opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc1.d/K01opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc2.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc3.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc4.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc5.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc6.d/K01opensips -> ../init.d/opensips
How can I force openSIPS to wait for mysql?
debian services
Debian 8 does not use sysvinit by default; it uses systemd. Have you configured it to use sysv?
â Rui F Ribeiro
Feb 27 at 11:05
No, I have not. But if I'm not mistaken insserv should have taken care of the order when I specifiedshould-startin the LSB
â Laci K
Feb 27 at 11:16
Ok, have edited the sysV out from your question, it is misleading. You are using systemd then. I am not so used to systemd, we will wait someone else to answer you.
â Rui F Ribeiro
Feb 27 at 11:17
Ok thanks. I probably clicked on it by accident.
â Laci K
Feb 27 at 11:22
I'd guess mysql will listen last, once started. So what you can do is add somewhere (end of mysql or start of opensips) a loop that doesfuser /var/run/mysqld/mysqld.sock. Once it gets a result (and thus a 0 exit status) that means mysql is listening and probably ready to serve requests. Don't make the loop infinite
â A.B
Feb 27 at 11:53
 |Â
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I installed and configured openSIPS 2.3 with MySQL on a Debian 8.10 but on boot openSIPS wont start because it starts before MySQL and can't connect to the database. After the system booted up can start opensips without error.
I found what it looked like a solution on an openSIPS mailing list, but I still get the same error.
What I did so far is editing /etc/init.d/opensisp and cahanged init info to this
### BEGIN INIT INFO
# Provides: opensips
# Required-Start: $syslog $network $local_fs $time
# Required-Stop: $syslog $network $local_fs
# Should-Start: mysql #added this
# Should-Stop: mysql #and this
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the OpenSIPS SIP server
# Description: Start the OpenSIPS SIP server
### END INIT INFO
than I run insserv -v opensips and rebooted, but its the same opensisp fails with couldn't connect to db error
ERROR:db_mysql:db_mysql_connect: driver error(2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ERROR:db_mysql:db_mysql_new_connection: initial connect failed
according to /ÃÂtc/rc?.d mysql should start before opensips but its not what happens or mysql isn't fully started when opensips starts.
here is a dump of rc for mysql and opensips
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc0.d/K02mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc1.d/K02mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc2.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc3.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc4.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc5.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc6.d/K02mysql -> ../init.d/mysql
############
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc0.d/K01opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc1.d/K01opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc2.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc3.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc4.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc5.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc6.d/K01opensips -> ../init.d/opensips
How can I force openSIPS to wait for mysql?
debian services
I installed and configured openSIPS 2.3 with MySQL on a Debian 8.10 but on boot openSIPS wont start because it starts before MySQL and can't connect to the database. After the system booted up can start opensips without error.
I found what it looked like a solution on an openSIPS mailing list, but I still get the same error.
What I did so far is editing /etc/init.d/opensisp and cahanged init info to this
### BEGIN INIT INFO
# Provides: opensips
# Required-Start: $syslog $network $local_fs $time
# Required-Stop: $syslog $network $local_fs
# Should-Start: mysql #added this
# Should-Stop: mysql #and this
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the OpenSIPS SIP server
# Description: Start the OpenSIPS SIP server
### END INIT INFO
than I run insserv -v opensips and rebooted, but its the same opensisp fails with couldn't connect to db error
ERROR:db_mysql:db_mysql_connect: driver error(2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
ERROR:db_mysql:db_mysql_new_connection: initial connect failed
according to /ÃÂtc/rc?.d mysql should start before opensips but its not what happens or mysql isn't fully started when opensips starts.
here is a dump of rc for mysql and opensips
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc0.d/K02mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc1.d/K02mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc2.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc3.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc4.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc5.d/S03mysql -> ../init.d/mysql
lrwxrwxrwx 1 root root 15 febr 23 21:56 /etc/rc6.d/K02mysql -> ../init.d/mysql
############
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc0.d/K01opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc1.d/K01opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc2.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc3.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc4.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 27 10:40 /etc/rc5.d/S04opensips -> ../init.d/opensips
lrwxrwxrwx 1 root root 18 febr 25 01:17 /etc/rc6.d/K01opensips -> ../init.d/opensips
How can I force openSIPS to wait for mysql?
debian services
edited Feb 27 at 11:16
Rui F Ribeiro
34.9k1269113
34.9k1269113
asked Feb 27 at 10:36
Laci K
1061
1061
Debian 8 does not use sysvinit by default; it uses systemd. Have you configured it to use sysv?
â Rui F Ribeiro
Feb 27 at 11:05
No, I have not. But if I'm not mistaken insserv should have taken care of the order when I specifiedshould-startin the LSB
â Laci K
Feb 27 at 11:16
Ok, have edited the sysV out from your question, it is misleading. You are using systemd then. I am not so used to systemd, we will wait someone else to answer you.
â Rui F Ribeiro
Feb 27 at 11:17
Ok thanks. I probably clicked on it by accident.
â Laci K
Feb 27 at 11:22
I'd guess mysql will listen last, once started. So what you can do is add somewhere (end of mysql or start of opensips) a loop that doesfuser /var/run/mysqld/mysqld.sock. Once it gets a result (and thus a 0 exit status) that means mysql is listening and probably ready to serve requests. Don't make the loop infinite
â A.B
Feb 27 at 11:53
 |Â
show 1 more comment
Debian 8 does not use sysvinit by default; it uses systemd. Have you configured it to use sysv?
â Rui F Ribeiro
Feb 27 at 11:05
No, I have not. But if I'm not mistaken insserv should have taken care of the order when I specifiedshould-startin the LSB
â Laci K
Feb 27 at 11:16
Ok, have edited the sysV out from your question, it is misleading. You are using systemd then. I am not so used to systemd, we will wait someone else to answer you.
â Rui F Ribeiro
Feb 27 at 11:17
Ok thanks. I probably clicked on it by accident.
â Laci K
Feb 27 at 11:22
I'd guess mysql will listen last, once started. So what you can do is add somewhere (end of mysql or start of opensips) a loop that doesfuser /var/run/mysqld/mysqld.sock. Once it gets a result (and thus a 0 exit status) that means mysql is listening and probably ready to serve requests. Don't make the loop infinite
â A.B
Feb 27 at 11:53
Debian 8 does not use sysvinit by default; it uses systemd. Have you configured it to use sysv?
â Rui F Ribeiro
Feb 27 at 11:05
Debian 8 does not use sysvinit by default; it uses systemd. Have you configured it to use sysv?
â Rui F Ribeiro
Feb 27 at 11:05
No, I have not. But if I'm not mistaken insserv should have taken care of the order when I specified
should-start in the LSBâ Laci K
Feb 27 at 11:16
No, I have not. But if I'm not mistaken insserv should have taken care of the order when I specified
should-start in the LSBâ Laci K
Feb 27 at 11:16
Ok, have edited the sysV out from your question, it is misleading. You are using systemd then. I am not so used to systemd, we will wait someone else to answer you.
â Rui F Ribeiro
Feb 27 at 11:17
Ok, have edited the sysV out from your question, it is misleading. You are using systemd then. I am not so used to systemd, we will wait someone else to answer you.
â Rui F Ribeiro
Feb 27 at 11:17
Ok thanks. I probably clicked on it by accident.
â Laci K
Feb 27 at 11:22
Ok thanks. I probably clicked on it by accident.
â Laci K
Feb 27 at 11:22
I'd guess mysql will listen last, once started. So what you can do is add somewhere (end of mysql or start of opensips) a loop that does
fuser /var/run/mysqld/mysqld.sock . Once it gets a result (and thus a 0 exit status) that means mysql is listening and probably ready to serve requests. Don't make the loop infiniteâ A.B
Feb 27 at 11:53
I'd guess mysql will listen last, once started. So what you can do is add somewhere (end of mysql or start of opensips) a loop that does
fuser /var/run/mysqld/mysqld.sock . Once it gets a result (and thus a 0 exit status) that means mysql is listening and probably ready to serve requests. Don't make the loop infiniteâ A.B
Feb 27 at 11:53
 |Â
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f426903%2fdebian-8-opensips-starts-before-mysql-on-boot-end-exits-with-mysql-error%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Debian 8 does not use sysvinit by default; it uses systemd. Have you configured it to use sysv?
â Rui F Ribeiro
Feb 27 at 11:05
No, I have not. But if I'm not mistaken insserv should have taken care of the order when I specified
should-startin the LSBâ Laci K
Feb 27 at 11:16
Ok, have edited the sysV out from your question, it is misleading. You are using systemd then. I am not so used to systemd, we will wait someone else to answer you.
â Rui F Ribeiro
Feb 27 at 11:17
Ok thanks. I probably clicked on it by accident.
â Laci K
Feb 27 at 11:22
I'd guess mysql will listen last, once started. So what you can do is add somewhere (end of mysql or start of opensips) a loop that does
fuser /var/run/mysqld/mysqld.sock. Once it gets a result (and thus a 0 exit status) that means mysql is listening and probably ready to serve requests. Don't make the loop infiniteâ A.B
Feb 27 at 11:53