Asterisk CLI And Database Problem
Hello,
I have a problem related to the Asterisk CLI, when I enter “asterisk -rv”, it cannot display the Asterisk CLI and instaed, I have this message “Unable to connect to remote asterisk (does /var/run/asterisk.ctl exist?).”
When I check with “locate asterisk.ctl”, it is indeed in the repertory “/var/run/”.
So after searching I have found we can enter “ps -A | grep asterisk” in order to find an asterisk “ghost” running and then kill it, and I have found:
1474 ? 00:00:14 asterisk
1615 pts/3 00:00:13 asterisk
31411 ? 00:00:00 safe_asterisk
31414 ? 01:08:53 asterisk
I don’t know if it’s the case and which one of these I should kill?
Furthermore, I can access to the CLI with “asterisk -cv” but I often got the following warning : “db.c:288 db_execute_sql: Error executing SQL (COMMIT): database is locked”. Otherwise, is there another way to fix my problem?
Thank you in advance!
2 thoughts on - Asterisk CLI And Database Problem
I would suspect that you have installed Asterisk in such a fashion that a particular user or user with certain permissions is required to access the
/var/run directory, as well as other directories Asterisk uses (such as where it stores the AstDB).
You are then probably running the safe_asterisk script under a user without sufficient permissions, and/or running/invoking the Asterisk CLI (via
“asterisk -rv”) as a user with insufficient permissions.
I would double check:
(1) What user/groups own the various Asterisk directories (specified in your asterisk.conf)
(2) What user/group you are running the safe_asterisk script under
(3) What user/group you are running as when you attempt to connect to Asterisk
SGVsbG8sDQoNCkFmdGVyIEnigJl2ZSBjaGVja2VkLCBpdCB3YXMgaW4gZmFjdCBteSBmaWxlc3lz dGVtIOKAnHZhcuKAnSBmdWxsIG9mIGlub2Rlc+KApg0KDQpUaGFuayB5b3Ugc28gbXVjaCBmb3Ig dHlpbmcgdG8gaGVscCBtZS4NCg0KSGF2ZSBhIG5pY2UgZGF5LA0KUmVnYXJkcywNCg0KUGllcnJl DQoNCg0KDQoNCg0KDQpEZSA6IGFzdGVyaXNrLXVzZXJzLWJvdW5jZXNAbGlzdHMuZGlnaXVtLmNv bSBbbWFpbHRvOmFzdGVyaXNrLXVzZXJzLWJvdW5jZXNAbGlzdHMuZGlnaXVtLmNvbV0gRGUgbGEg cGFydCBkZSBN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