Syed Jahanzaib – Personal Blog to Share Knowledge !

November 21, 2014

Kannel auto startup problem with System error 13 Permission Denied

Filed under: Linux Related — Tags: , — Syed Jahanzaib / Pinochio~:) @ 12:04 PM

[with reference to following

DMASOFTLAB Radius Manager 4.0.4/4.1.x SMS Notification Configuration


https://aacable.wordpress.com/2012/11/26/howto-configure-your-local-http-gateway-using-kannel-on-ubuntu/ ]

Recently I configured KANNEL (again) for a client in KARBALA/IRAQ. The OS was UBUNTU 12.04.When we run the Bearerbox and SMSBOX manually in terminal, KANNEL HTTP API works fine. But when the box is restarted, SMS goes in QUEUE.

Result for manually executed bearerbox and smsbox in terminal (separate terminal for each command) like

bearerbox -v 0 /etc/kannel/kannel.conf

smsbox -v 0 /etc/kannel/kannel.conf

Sms via web works fine.

accept
But when the system is rebooted ,  and I tried to send SMS , all messages were going in QUEUE and following message appear on browser.


3: Queued for later delivery


All kannel related services were starting properly, like bearerbox, smsbox etc. As showed below …

root@rm:~# ps aux |grep kannel
kannel    2964  0.0  0.0   7424   720 ?        Ss   09:47   0:00 /usr/sbin/run_kannel_box --pidfile /var/run/kannel/kannel_bearerbox.pid --no-extra-args /usr/sbin/bearerbox -v 4 -- /etc/kannel/kannel.conf
kannel    2966  0.0  0.2  82652  2784 ?        Sl   09:47   0:00 /usr/sbin/bearerbox -v 4 -- /etc/kannel/kannel.conf
kannel    2975  0.0  0.0   7424   720 ?        Ss   09:47   0:00 /usr/sbin/run_kannel_box --pidfile /var/run/kannel/kannel_wapbox.pid --no-extra-args /usr/sbin/wapbox -v 4 -- /etc/kannel/kannel.conf
kannel    2978  0.0  0.0   7424   724 ?        Ss   09:47   0:00 /usr/sbin/run_kannel_box --pidfile /var/run/kannel/kannel_smsbox.pid --no-extra-args /usr/sbin/smsbox -v 4 -- /etc/kannel/kannel.conf
kannel    2980  0.0  0.2  65948  2644 ?        Sl   09:47   0:00 /usr/sbin/smsbox -v 4 -- /etc/kannel/kannel.conf
root      2993  0.0  0.0   3328   876 pts/2    S+   09:47   0:00 grep --color=auto kannel

After checking the bearerbox.log, I saw following error

tail -f /var/log/kannel/bearerbox.log
***************************************************************************************
2014-11-21 10:41:55 [1912] [6] INFO: AT2[/dev/ttyACM0]: opening device
2014-11-21 10:41:55 [1912] [6] ERROR: AT2[/dev/ttyACM0]: open failed! ERRNO=13
2014-11-21 10:41:55 [1912] [6] ERROR: System error 13: Permission denied
2014-11-21 10:41:55 [1912] [6] ERROR: AT2[/dev/ttyACM0]: at2_device_thread: open_at2_device failed.
2014-11-21 10:41:55 [1912] [6] ERROR: System error 13: Permission denied
2014-11-21 10:41:55 [1912] [6] ERROR: AT2[/dev/ttyACM0]: Couldn't connect (retrying in 10 seconds).
***************************************************************************************

ttyacm.


With the help of kannel users mailing list, I found that KANNEL user must be allowed to write access /dev/ttyACM0 (or your modem device name).

For ubuntu, simply add the user KANNEL to DIALOUT group.

usermod -a -G dialout kannel
chown  kannel  /dev/ttyACM0

Also remove the comment sign from START_SMSBOX in /etc/default/kannel so that smsbox may also start on system boot.


Alhamdolillah Problem Solved!

2014-11-21 11.38.05

I am sharing this info because it took around 1 days of head banging with the wall, and I surely dont want anyone else to stuck in the same situation (if the issue is same)

Sample of config files

root@rm:/etc/kannel# cat /etc/default/kannel
START_WAPBOX=1
START_SMSBOX=1

my /etc/kannel/kannel.conf FILE

cat /etc/kannel/kannel.conf

# Syed Jahanzaib
# https://aacable.wordpress.com
# aacable [at] hotmail.com

group = core
admin-port = 13000
smsbox-port = 13001
admin-password = zaibadmin
status-password = zaibstatus
log-file = "/var/log/kannel/bearerbox.log"
log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"

group = smsc
smsc = at
modemtype = teltonika
device = /dev/ttyACM0
# Change above port to match your port, it could ACM1 or USB0, if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)
speed = 19200
my-number = 0333302100000 # (put your sim number, not necessary)

# for teltonkia only, if you are using other brand you may need to get there INIT strings
group = modems
id = teltonika
name = "Teltonika E12"
detect-string = "Undefined"
enable-mms = true
init-string = "AT+CNMI=2,2,0,1,1"
speed = 115200

# for Huawei USB/GSM modem e155 i guess, remove hashes from below lines if u r using this model.
#group = modems
#id = huawei
#name = "Huawei"
#detect-string = "huawei"
#enable-mms = true
#init-string = "ATZ"
#init-string = "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

group = smsbox
bearerbox-host = localhost
sendsms-port = 13013
global-sender = 13013
sendsms-chars = "0123456789 +-"
log-file = "/var/log/kannel/smsbox.log"
log-level = 0
access-log = "/var/log/kannel/access.log"

group = sendsms-user
username = kannel
password = kannel
concatenation = true
max-messages = 3

group = sms-service
keyword = default
get-url = "http://localhost/kannel/receivesms.php?sender=%p&text=%b"
accept-x-kannel-headers = true
max-messages = 3
concatenation = true
catch-all = true

🙂

Regard’s
Syed Jahanzaib

14 Comments »

  1. Thanks Jahanzeb for this Tip – Again : i’ll use this tip somewhere else, usually i use your solutions in different problems like the MikroTik Rule (i modified them).

    Like

    Comment by dxman — November 21, 2014 @ 12:21 PM

  2. One More Question : Which Modem you use how did you setup this ? how can we configure SMS Tx/Rx with the minimal hardware or using mobile.
    thanks.

    Like

    Comment by dxman — November 21, 2014 @ 12:22 PM

  3. Hi Syed Jahanzaib,

    Thanks for sharing, i have same problem with autostart in kannel. oh ya, can you share with me your init.d file kannel? because my file init.d have removed 😦

    thanks

    Like

    Comment by jayadianto — December 8, 2014 @ 5:17 AM

  4. Hi Syed Jahanzaib

    I have solved my problem, thank for your sharing. this is helpfully

    Jazakumullah khairan katsiran 🙂

    Like

    Comment by jayadianto — December 8, 2014 @ 7:46 AM

  5. Zaib bhai! Have you any USB GSM modem for sale. I want to purchase for radius manager. or help me….

    Like

    Comment by Nadeem — December 10, 2014 @ 7:18 AM

    • @Nadeem, I dont deal in hardware brother, but you can get cheap usb gsm devices in market which is flooded with such items. But I recommend you to go with quality to avoid compatibility issues, Try starting with TELTONIKA USB GSM Modems or huawei modems.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — December 11, 2014 @ 3:02 PM

    • dude,,,u saved me alot, thanks

      Like

      Comment by Benedict — September 6, 2015 @ 5:01 PM

  6. I have a problem with my modem modem Huawei E800 HSPA with the following message:
    root@ubuntu:~# tail -f /var/log/kannel/bearerbox.log
    2016-06-16 12:11:52 [3118] [6] ERROR: AT2[Huawei-E800]: CMS ERROR: +CMS ERROR: 3 21
    2016-06-16 12:11:52 [3118] [6] ERROR: AT2[Huawei-E800]: CMS ERROR: Invalid memor y index -> don’t worry, just memory fragmentation. (321)
    2016-06-16 12:12:07 [3118] [6] ERROR: AT2[Huawei-E800]: CMS ERROR: +CMS ERROR: 3 21
    2016-06-16 12:12:07 [3118] [6] ERROR: AT2[Huawei-E800]: CMS ERROR: Invalid memor y index -> don’t worry, just memory fragmentation. (321)
    2016-06-16 12:12:22 [3118] [6] ERROR: AT2[Huawei-E800]: CMS ERROR: +CMS ERROR: 3 21
    2016-06-16 12:12:22 [3118] [6] ERROR: AT2[Huawei-E800]: CMS ERROR: Invalid memor y index -> don’t worry, just memory fragmentation. (321)

    Can someone help me on this?

    Like

    Comment by yndinga — June 16, 2016 @ 4:33 PM

  7. can you please tell me how to resolve system error 2 no device or file found error when bearerbox is started?

    Like

    Comment by shining star — August 15, 2017 @ 3:22 PM

  8. 2018-06-22 13:03:23 [9337] [6] DEBUG: AT2[zaibgsmid]: device opened
    2018-06-22 13:03:23 [9337] [6] INFO: AT2[zaibgsmid]: speed set to 9600
    2018-06-22 13:03:23 [9337] [6] DEBUG: AT2[zaibgsmid]: –> ATZ^M
    2018-06-22 13:03:29 [9337] [6] ERROR: AT2[zaibgsmid]: Wrong or no answer to ATZ
    2018-06-22 13:03:29 [9337] [6] INFO: AT2[zaibgsmid]: Closing device
    2018-06-22 13:03:29 [9337] [6] ERROR: AT2[zaibgsmid]: Couldn’t connect (retrying in 10 seconds).

    Please help me anyone. How to resolve this problem.

    Like

    Comment by Mainul Islam — June 22, 2018 @ 10:04 PM

  9. thank you bro you just ruled me after two days of panic, eeeh kannel it’s not good

    Like

    Comment by Veron — February 25, 2021 @ 1:53 PM


RSS feed for comments on this post. TrackBack URI

Leave a comment