Asterisk unable to find master config file - asterisk

I have strange problem after I've installed Asterisk on my CentOS server. So, I have used tutorial step-by-step and didn't get any error or warnings. Whole installation went successfully.
When I try to log into Asterisk CLI with asterisk -r I've got this error
[root#asterisk-14.6.1]# asterisk -r
Unable to open specified master config file '/usr/local/etc/asterisk/asterisk.conf', using built-in defaults
Unable to connect to remote asterisk (does /usr/local/var/run/asterisk/asterisk.ctl exist?)
[root#asterisk-14.6.1]#
What does this means? I can't find anything about master config file. My asterisk.conf file is in /etc/asterisk
-rw-r--r-- 1 asterisk asterisk 5332 18 sep 12,15 asterisk.conf
not in '/usr/local/etc/asterisk/asterisk.conf'
Asterisk is 100% running
[root#asterisk-14.6.1]# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
Loaded: loaded (/etc/rc.d/init.d/asterisk; bad; vendor preset: disabled)
Active: active (running) since mon 2017-09-18 12:36:16 EEST; 3s ago
Docs: man:systemd-sysv-generator(8)
Process: 33977 ExecStop=/etc/rc.d/init.d/asterisk stop (code=exited, status=0/SUCCESS)
Process: 34000 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
Main PID: 34025 (asterisk)
CGroup: /system.slice/asterisk.service
├─34023 /bin/sh /usr/sbin/safe_asterisk
└─34025 /usr/sbin/asterisk -f -vvvg -c
sep 18 12:36:16 systemd[1]: Starting LSB: Asterisk PBX...
sep 18 12:36:16 asterisk[34000]: Starting asterisk:
sep 18 12:36:16 systemd[1]: PID file /var/run/asterisk/asterisk.pid not readable (yet?) after start.
sep 18 12:36:16 systemd[1]: asterisk.service: Supervising process 34025 which is not our child. We'll most likely not notice when it exits.
sep 18 12:36:16 systemd[1]: Started LSB: Asterisk PBX.
I have changed also this permissions to asterisk user
[root#asterisk-14.6.1]# ls -l /var/run/asterisk/asterisk.ctl
srwxr-xr-x 1 asterisk asterisk 0 18 sep 12,36
/var/run/asterisk/asterisk.ctl
I was able to log into CLI with asterisk -vvvvc and I can see few errors
Unable to open specified master config file '/usr/local/etc/asterisk/asterisk.conf', using built-in defaults
[Sep 18 12:40:24] ERROR[34584]: logger.c:1823 init_logger: Errors detected in logger.conf. Default console logging is being used.
[Sep 18 12:40:24] WARNING[34584]: loader.c:1293 load_modules: No 'modules.conf' found, no modules will be loaded.
[Sep 18 12:40:24] WARNING[34584]: loader.c:1293 load_modules: No 'modules.conf' found, no modules will be loaded.

You did install with /usr/local/ prefix.
Now you have 2 choices
reinstall, do configure with --prefix=/
or do symlink
mkdir -p /usr/local/etc/
ln -s /etc/asterisk /usr/local/etc/

Running
make samples inside /usr/src/asterisk-<your version> resolved the issue for me

Related

installing asterisk on ubuntu 18.04

Assuming you are Database Root
Checking if SELinux is enabled...Its not (good)!
Reading /etc/asterisk/asterisk.conf...Done
Checking if Asterisk is running and we can talk to it as the 'asterisk' user...Error!
Error communicating with Asterisk. Ensure that Asterisk is properly installed and running as the asterisk user
Asterisk appears to be running as asterisk
Try starting Asterisk with the './start_asterisk start' command in this directory
tried ./start_asterisk start ./install -n
help help please, what's the problem, 3rd day I'm trying to solve the problem.
● asterisk.service - Asterisk PBX
Loaded: loaded (/lib/systemd/system/asterisk.service; enabled; vendor preset: enabled)
Active: failed (Result: core-dump) since Sat 2020-07-25 01:12:16 UTC; 32min ago
Docs: man:asterisk(8)
Process: 84496 ExecStart=/usr/sbin/asterisk -g -f -p -U asterisk (code=dumped, signal=SEGV)
Main PID: 84496 (code=dumped, signal=SEGV)
Jul 25 01:12:16 webserver systemd[1]: asterisk.service: Scheduled restart job, restart counter is at 91.
Jul 25 01:12:16 webserver systemd[1]: Stopped Asterisk PBX.
Jul 25 01:12:16 webserver systemd[1]: asterisk.service: Start request repeated too quickly.
Jul 25 01:12:16 webserver systemd[1]: asterisk.service: Failed with result 'core-dump'.
Jul 25 01:12:16 webserver systemd[1]: Failed to start Asterisk PBX.```
Selinux enabled - can be issue here.
For check what is really gooing try start asterisk manually and see verbose log
asterisk -vvvgc

mount encrypted loopback in suse/systemd: unknown filesystem type 'crypt'

This might be specific to openSUSE / systemd.
I'm having trouble mounting an encrypted loopback file using the procedure described on the SDB:Encrypted filesystems knowledge base. I get this behaviour:
[mjl#tesla:~]
[11:12] $ sudo systemctl start /home/mjl/key
Job for home-mjl-key.mount failed. See "systemctl status home-mjl-key.mount" and "journalctl -xe" for details.
[mjl#tesla:~]
[11:12] 1 $ sudo systemctl status home-mjl-key.mount
● home-mjl-key.mount - /home/mjl/key
Loaded: loaded (/etc/fstab; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2018-03-11 11:12:41 AEDT; 3s ago
Where: /home/mjl/key
What: /home/mjl/.tomb
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Process: 12949 ExecMount=/usr/bin/mount /home/mjl/.tomb /home/mjl/key -t crypt -o loop,user,acl,user_xattr (code=exited, status=32)
Mar 11 11:12:41 tesla systemd[1]: Mounting /home/mjl/key...
Mar 11 11:12:41 tesla mount[12949]: mount: unknown filesystem type 'crypt'
Mar 11 11:12:41 tesla systemd[1]: home-mjl-key.mount: Mount process exited, code=exited status=32
Mar 11 11:12:41 tesla systemd[1]: Failed to mount /home/mjl/key.
Mar 11 11:12:41 tesla systemd[1]: home-mjl-key.mount: Unit entered failed state.
[mjl#tesla:~]
[11:12] 3 $
The /home/mjl/.tomb loopback file was created using YaST Partitioner; I specified that I did not want it mounted at system start time, but that users should be allowed to mount it.
So it created the file, added an entry to /etc/cryptab and also this entry to /etc/fstab:
[mjl#tesla:~]
[11:12] 3 $ tail -n1 /etc/fstab
/home/mjl/.tomb /home/mjl/key crypt loop,user,noauto,acl,user_xattr,nofail 0 0
[mjl#tesla:~]
[11:15]$
There is the 'crypt' filesystem type.
My question is: how should I be mounting this as a user? Is systemd failing because of the filesystem type, or because I haven't told it the encryption key?
I've also tried mounting directly:
[mjl#tesla:~]
[11:16]$ sudo mount /home/mjl/key
mount: unknown filesystem type 'crypt'
[mjl#tesla:~]
The same error. So I guess I'm not mounting it correctly. Do I need to do something with cryptsetup

uWSGI, Nginx, Flask app service keeps failing

Going to my app produces a 502 gateway error. Found out that it was because my how_lit.service is failing. But I am having trouble finding out why.
Tried editing the application and the ini document. Cannot figure out whats wrong.
The Nginx and uWSGI services are up and running fine.
Service Status:
lit#digitalocean:~/howlit$ sudo service how_lit status
[sudo] password for lit:
● how_lit.service - uWSGI instance to serve how lit rest api
Loaded: loaded (/etc/systemd/system/how_lit.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2016-08-04 00:30:44 EDT; 5 days ago
Process: 14294 ExecStart=/home/lit/howlit/env/bin/uwsgi --ini /home/lit/howlit/howlit.ini (code=exited, status=1/FAILURE)
Main PID: 14294 (code=exited, status=1/FAILURE)
Aug 04 00:30:44 digitalocean systemd[1]: Started uWSGI instance to serve how lit rest api.
Aug 04 00:30:44 digitalocean uwsgi[14294]: [uWSGI] getting INI configuration from /home/lit/howlit/howlit.ini
Aug 04 00:30:44 digitalocean systemd[1]: how_lit.service: Main process exited, code=exited, status=1/FAILURE
Aug 04 00:30:44 digitalocean systemd[1]: how_lit.service: Unit entered failed state.
Aug 04 00:30:44 digitalocean systemd[1]: how_lit.service: Failed with result 'exit-code'.
Directory and Permissions:
lit#digitalocean:~/howlit$ ls -l .
total 16
drwx---r-x 6 lit www-data 4096 Jul 29 11:47 env
-rwx---r-x 1 lit www-data 202 Aug 3 23:29 howlit.ini
-rwx---r-x 1 lit www-data 1203 Aug 3 23:01 how_lit_restapi.py
-rwxr-xr-x 1 lit www-data 72 Aug 3 23:27 wsgi.py
/etc/systemd/system/how_lit.service:
lit#digitalocean:~/howlit$ cat /etc/systemd/system/how_lit.service
[Unit]
Description=uWSGI instance to serve how lit rest api
After=network.target
[Service]
User=lit
Group=www-data
WorkingDirectory=/home/lit/howlit/
Environment="PATH=/home/lit/howlit/env/bin"
ExecStart=/home/lit/howlit/env/bin/uwsgi --ini /home/lit/howlit/howlit.ini
[Install]
WantedBy=multi-user.target
howlit.ini file:
lit#digitalocean:~/howlit$ cat howlit.ini
[uwsgi]
module = wsgi:app
uid = lit
gid = www-data
master = true
processes = 5
socket = how_lit_restapi.sock
chmod-sock = 666
vacum = true
die-on-term = true
gto = /var/log/uwsgi/%n.log
Tried running it by hand:
lit#digitalocean:~/howlit$ /home/lit/howlit/env/bin/uwsgi --ini /home/lit/howlit/howlit.ini
[uWSGI] getting INI configuration from /home/lit/howlit/howlit.ini
*** Starting uWSGI 2.0.13.1 (64bit) on [Tue Aug 9 18:28:25 2016] ***
compiled with version: 5.4.0 20160609 on 29 July 2016 11:48:08
os: Linux-4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016
nodename: digitalocean
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /home/lit/howlit
detected binary path: /home/lit/howlit/env/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
your processes number limit is 1896
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
bind(): Permission denied [core/socket.c line 230]
permission error again?
SOLVED IT: By sending my socket into tmp, but still getting bad gateway error when I navigate to my site :(
Solved my own problem.
First I checked my services.
sudo service nginx status
sudo service uwsgi status
sudo service how_lit status
then I saw them all running and up but was still getting the bad gateway error. Well after checking the logs had no errors. I had to assume my configs.
Then I realized my mistake....I never restarted all of it, just certain parts at certain times. So I restarted every single one as such:
sudo service nginx restart
sudo service uwsgi restart
sudo service how_lit restart
now it works.
About the permission issue I tried it by putting the socket into the /tmp directory that way www-data group users can access it as well as root. I learned that you need to be able to create the socket and allow access to the system for it.
I moved it out of tmp btw later for production as I was told that was not best practice.

Rstudio-server unable to connect to service

While login to Rstudio Server with my user name and password, I received the following
Rstudio Initilization Error
unable to connect to service
I installed Rstudio Server in the following way:
apt-get install gdebi-core r-base r-base-dev
wget -c https://download2.rstudio.org/rstudio-server-0.99.489-amd64.deb
sudo gdebi rstudio-server-0.99.489-amd64.deb
sudo usermod -a -G rstudio lorencm
sudo service rstudio-server start
id lorencm
uid=1000(lorencm) gid=1000(lorencm) groups=1000(lorencm),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),111(sambashare),999(docker),1001(rstudio)
What did I do wrong?
In my experience this might happen because of permission to your home directory or you don't have any home directory. possibly created by defauly with no home directory.
to solve this, just create a home directory for the username that you are tryin to use or use an exisiting username with valide home directory
usermod -md /home/username username
or just create one
sudo mkdir /home/username
sudo chown -R username /home/username
Good luck
I am running a Fedora server with SELinux, I used cockpit to look at the SELinux logs and could see that the Rhistory file was being blocked for access. In adding in the policy SELinux advised, I was then able to login without any issues.
I was facing same issue & resolved by following:
disabling SELinux and rebooting the server.
The user with which you are logging in should be part of "rstudio-server" group.
rstudio-server:x:986:rconnect_admin
to add that user to rstudio-server group use usermod -a -G rstudio-server <username>
Here is the test process.
I refer to the web page here: disable SELINUX ,
I tested the hypothesis about SELinux.
[testuser#third-test ~]$ sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Memory protection checking: actual (secure)
Max kernel policy version: 31
I changed the directive SELinux=enforcing to SELinux=disabled
[testuser#third-test ~]$ sudo vi /etc/sysconfig/selinux
Then I reboot my system.
[testuser#third-test ~]$ sudo shutdown -r now
Now the SELinux is disabled.
[testuser#third-test ~]$ sestatus
SELinux status: disabled
Then the rstudio-server status looks good.
[testuser#third-test ~]$ sudo rstudio-server status
● rstudio-server.service - RStudio Server
Loaded: loaded (/etc/systemd/system/rstudio-server.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2019-12-12 21:42:54 UTC; 2min 0s ago
Process: 1091 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS)
Main PID: 1135 (rserver)
​ Tasks: 3 (limit: 22408)
Memory: 58.7M
CGroup: /system.slice/rstudio-server.service
​ └─1135 /usr/lib/rstudio-server/bin/rserver
Dec 12 21:42:54 third-test systemd[1]: Starting RStudio Server...
Dec 12 21:42:54 third-test systemd[1]: Started RStudio Server.
[testuser#third-test ~]$ sudo rstudio-server status
● rstudio-server.service - RStudio Server
Loaded: loaded (/etc/systemd/system/rstudio-server.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2019-12-12 21:42:54 UTC; 3min 37s ago
Process: 1091 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS)
Main PID: 1135 (rserver)
​ Tasks: 8 (limit: 22408)
Memory: 141.0M
CGroup: /system.slice/rstudio-server.service
​ ├─1135 /usr/lib/rstudio-server/bin/rserver
​ └─1662 /usr/lib/rstudio-server/bin/rsession -u testuser2 --launcher-token A8F380C6
Dec 12 21:42:54 third-test systemd[1]: Starting RStudio Server...
Dec 12 21:42:54 third-test systemd[1]: Started RStudio Server.
Another suggestion:
It's always prefer not to use local authentication for login & use LDAP, Googleauth etc for login to the server.
i experienced the same problem on fedora 32 and then i removed R packages & rstudio-server and reinstall them again and worked fine.

Plone and systemctl

I tried to integrate Plone with a systemctl based startup (on openSUSE 12.3)
As a first attempt I have a very simple plone.service file
[Unit]
Description=Plone content management system
After=network.target
[Service]
Type=simple
ExecStart=/srv/plone/zeocluster/bin/plonectl start
[Install]
WantedBy=multi-user.target
Checking with systemclt status plone I see that the processes get started, but they immediatly vanish again. I've also tried Type=Daemon, but the endresult is the same.
Any hints were my error is?
The service actually finds/executes the plonectl script successfully, just the processes die quickly
linux-wezo:/etc/systemd/system # systemctl start plone.service
linux-wezo:/etc/systemd/system # systemctl status plone.service
plone.service - Plone content management system
Loaded: loaded (/etc/systemd/system/plone.service; disabled)
Active: inactive (dead) since Mon, 2013-03-18 22:00:50 CET; 1s ago
Process: 25494 ExecStart=/srv/plone/zeocluster/bin/plonectl start (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/plone.service
Mar 18 22:00:42 linux-wezo.site systemd[1]: Starting Plone content management system...
Mar 18 22:00:42 linux-wezo.site systemd[1]: Started Plone content management system.
Mar 18 22:00:43 linux-wezo.site plonectl[25494]: zeoserver: .
Mar 18 22:00:43 linux-wezo.site plonectl[25494]: daemon process started, pid=25502
Mar 18 22:00:46 linux-wezo.site plonectl[25494]: client1: .
Mar 18 22:00:46 linux-wezo.site plonectl[25494]: daemon process started, pid=25507
Mar 18 22:00:49 linux-wezo.site plonectl[25494]: client2: .
Mar 18 22:00:49 linux-wezo.site plonectl[25494]: daemon process started, pid=25522
I do have a SysV style init script, that works via systemctl, but think it would be great to have a service file since this should be more generic than the various init scripts floating around.
The issue is the program plonectl is not a daemon, it is a wrapper script that starts Zope. You need to change the type to forking and probably to tell systemd where to find the PID file.
Plonectl forks the daemon. Try this in plone.service:
[Unit]
Description=Plone content management system
After=network.target
ConditionPathExists=/srv/plone/zeocluster/bin/plonectl
[Service]
Type=forking
ExecStart=/srv/plone/zeocluster/bin/plonectl start
ExecStop=/srv/plone/zeocluster/bin/plonectl stop
ExecReload=/srv/plone/zeocluster/bin/plonectl restart
[Install]
WantedBy=multi-user.target

Resources