Description

After installing kamailio on Ubuntu (20.04 and 22.04) using normal kamailio.org instructions, things work fine. However, a developer is working on a large project as root, and occasionally restarts kamailio with the command "kamctl <start|stop|restart>", rather than the OS command "systemctl <stop|start|restart> kamailio". After that, any attempt to restart or check status using systmectl fails, and rebooting the server occasionally fails to restart kamailio.

Troubleshooting

Reproduction

Install ubuntu 22.04 or 20.04. When up and running, try this:
systemctl status kamailio (everything looks good)
ps -C kamailio -o comm,uid,euid,pid,ppid (all happy, Kamailio running as user kamailio)
kamctl restart
ps -C kamailio -o comm,uid,euid,pid,ppid (Yes it's running, but as root, not kamailio)
systemctl status kamailio (FAILS, 20.04 reports "Failed to start", 22.04 reports "kamailio.service: Deactivated successfully")
systemctl restart kamailio (FAILS - same reports as preceding "status" command)

Debugging Data

Log Messages

After command systemctl restart kamailio:

Feb  9 18:30:02 usdc2-lab-drproxy02 kamailio: INFO: <core> [core/sctp_core.c:74]: sctp_core_check_support(): SCTP API not enabled - if you want to use it, load sctp module
Feb  9 18:30:02 usdc2-lab-drproxy02 kamailio: INFO: <core> [core/tcp_main.c:5042]: init_tcp(): using epoll_lt as the io watch method (auto detected)
Feb  9 18:30:02 usdc2-lab-drproxy02 /usr/sbin/kamailio[2388]: INFO: rr [../outbound/api.h:52]: ob_load_api(): unable to import bind_ob - maybe module is not loaded
Feb  9 18:30:02 usdc2-lab-drproxy02 /usr/sbin/kamailio[2388]: INFO: rr [rr_mod.c:177]: mod_init(): outbound module not available
Feb  9 18:30:02 usdc2-lab-drproxy02 /usr/sbin/kamailio[2388]: INFO: auth [auth_mod.c:345]: mod_init(): qop set, but nonce-count (nc_enabled) support disabled
Feb  9 18:30:02 usdc2-lab-drproxy02 /usr/sbin/kamailio[2388]: INFO: <core> [main.c:2779]: main(): processes (at least): 32 - shm size: 67108864 - pkg size: 8388608
Feb  9 18:30:02 usdc2-lab-drproxy02 /usr/sbin/kamailio[2388]: INFO: <core> [core/udp_server.c:154]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992
Feb  9 18:30:02 usdc2-lab-drproxy02 /usr/sbin/kamailio[2388]: INFO: <core> [core/udp_server.c:206]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984
Feb  9 18:30:02 usdc2-lab-drproxy02 /usr/sbin/kamailio[2388]: INFO: <core> [core/udp_server.c:154]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992
Feb  9 18:30:02 usdc2-lab-drproxy02 /usr/sbin/kamailio[2388]: INFO: <core> [core/udp_server.c:206]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984
Feb  9 18:30:02 usdc2-lab-drproxy02 /usr/sbin/kamailio[2388]: ERROR: <core> [core/tcp_main.c:3162]: tcp_init(): bind(c, 0x7f49b0475c74, 16) on 127.0.0.1:5060 : Address already in use
Feb  9 18:30:02 usdc2-lab-drproxy02 /usr/sbin/kamailio[2388]: INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized

SIP Traffic

(paste your sip traffic here)

Possible Solutions

Modify kamctl et. al. to call systemctl for start, stop, restart commands. Alternatively have kamctl call setuid() before start, restart, stop commands.

Additional Information

version: kamailio 5.3.2 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 9.2.1 

For ubuntu 22.04:

version: kamailio 5.6.5 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 11.4.0

For ubuntu 22.04:

root@my_22.04_ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy
root@my_22.04_ubuntu:~# uname -a
Linux my_22.04_ubuntu 5.15.0-94-generic #104-Ubuntu SMP Tue Jan 9 15:25:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
root@my_22.04_ubuntu:~#

For ubuntu 20.04

root@my_20.04_ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.6 LTS
Release:	20.04
Codename:	focal
root@my_20.04_ubuntu:~# uname -a
Linux my_20.04_ubuntu 5.4.0-171-generic #189-Ubuntu SMP Fri Jan 5 14:23:02 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
root@my_20.04_ubuntu:~#


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3752@github.com>