[systemd-devel] The unit asterisk.service has entered the 'failed' state with result 'timeout'
Ricardo
mcgrathricardol at gmail.com
Tue Dec 17 16:54:47 UTC 2024
Your asterisk script is unusual and never see before.
The most striking you have an asterisk fork script which call asterisk PID,
could result process as zombies.
By the other way are your trying to set dynamic permission of asterisk
before running??
Very hard and strange to get right answer.
Based on asterisk it could pointed to minors details as type setting as:
ExecStartPre instead of "ExecStart".
"notification" when the normal asterisk is "simple" and It understood
user="'invade'" has right permissions and if so when this kind of issue
happens mainly problem becomes from SELinux which must be in forced mode by
changing it to permissive mode.
Very hard to pointed how could make it work.
Mc Grath Ricardo
Typical asterisk startup script.
[Unit]
Description=Asterisk PBX and telephony daemon
Documentation=man:asterisk(8)
Wants=network.target
After=network.target
[Service]
Type=simple
User=
Environment=HOME=/var/lib/asterisk
WorkingDirectory=/var/lib/asterisk
ExecStart=/usr/sbin/asterisk -f -C /etc/asterisk/asterisk.conf
ExecStop=/usr/sbin/asterisk -rx ‘core stop now’
ExecReload=/usr/bin/asterisk -rx ‘core reload’
safe_asterisk emulation
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
El mar, 17 dic 2024 a la(s) 1:22 p.m., Raul Jimeno (raul.jimeno at invade.net)
escribió:
> Your status output shows the unit file being in /etc --> yes, that is
> correct.
> Does `systemctl cat asterisk` show the same contents on all systems? Yes,
> it does.
>
>
> ---------------------------
> grep -E "^User|^Group" /etc/systemd/system/asterisk.service
> User=invade
> Group=invade
> ---------------------------
> # /etc/systemd/system/asterisk.service
> [Unit]
> Description=Asterisk PBX and telephony daemon.
> After=network.target
> #include these if asterisk need to bind to a specific IP (other than
> 0.0.0.0)
> #Wants=network-online.target
> #After=network-online.target network.target
>
> [Service]
> *Type=notify*
> Environment=HOME=/var/lib/asterisk
> #if systemd do not provide hostname and you need to use ${ENV(HOSTNAME)}
> #Environment=HOSTNAME=%H
> WorkingDirectory=/var/lib/asterisk
> User=invade
> Group=invade
> ExecStartPre=+/usr/bin/mkdir -p /var/run/asterisk
> ExecStartPre=+/usr/bin/chown invade:invade /var/run/asterisk
> ExecStartPre=+/usr/bin/chmod 0755 /var/run/asterisk
> ExecStart=/usr/sbin/asterisk -mqf -C /etc/asterisk/asterisk.conf
> ExecReload=/usr/sbin/asterisk -rx 'core reload'
> #if /var/run is a tmpfs, this will create /var/run/asterisk on start
> #RuntimeDirectory=asterisk
>
> #Nice=0
> #UMask=0002
> LimitCORE=infinity
> #LimitNOFILE=
> Restart=always
> RestartSec=4
>
> # Prevent duplication of logs with color codes to /var/log/messages
> StandardOutput=null
>
> PrivateTmp=true
>
> [Install]
> WantedBy=multi-user.target
>
> # /etc/systemd/system/asterisk.service.d/override.conf
> [Service]
> Type=forking
> PIDFile=/var/run/asterisk/asterisk.pid
> TimeoutStartSec=300
> Restart=on-failure
>
> Kind regards,
>
>
> *Raúl Jimeno*
>
> IT Support Engineer
>
> INVADE International Ltd
> +44 33 3344 0784 (Office)
> +44 117 3251309 (Direct)
> raul.jimeno at invade.net
> http://www.invade.net <http://support.invade.net/>
>
> Invade International Ltd
>
> Unit 6, Badminton Court, Station Road, Bristol
> BS37 5HZ, United Kingdom
> ------------------------------------------------------
> Company Registration Number: 3660482
> Registered in England and Wales
> this email, and any attachment, is intended only for the attention of the
> addressee. Its unauthorised use, disclosure, storage or copying is not
> permitted. If you are not the intended recipient, please destroy all copies
> and inform the sender by return email. If you have received this email in
> error, please return it to the sender and highlight the error. We accept no
> legal liability for the content of the message. Any opinions or views
> presented are solely the responsibility of the author and do not
> necessarily represent those of InVADE. We cannot guarantee that this
> message has not been modified in transit, and this message should not be
> viewed as contractually binding. Although we have taken reasonable steps to
> ensure that this email and attachments are free from any virus, we advise
> that in keeping with good computing practice the recipient should ensure
> they are actually virus free.
>
>
> On Tue, 17 Dec 2024 at 17:08, Mantas Mikulėnas <grawity at gmail.com> wrote:
>
>> Your status output shows the unit file being in /etc; does it differ much
>> from the original packaged unit (if there was one)? Does `systemctl cat
>> asterisk` show the same contents on all systems? The most common cause of a
>> timeout is probably the unit and the daemon disagreeing on whether to
>> report 'started' (e.g. if the unit is Type=forking but the service's own
>> config file tells it to not fork/daemonize at all).
>>
>> On Tue, Dec 17, 2024, 16:58 Raul Jimeno <raul.jimeno at invade.net> wrote:
>>
>>> Hi all,
>>>
>>> Sorry, I am new on this list and this is my first post requesting some
>>> help troubleshooting an issue with systemd.
>>>
>>> I’m experiencing an issue where the Asterisk service fails to start and
>>> times out consistently. This happens across multiple versions of Asterisk,
>>> so we suspect it might be a systemd-related issue.
>>>
>>> The OS is Rocky Linux release 8.9 and running in a VM.
>>> No issue in other sites with same OS and same Asterisk versions
>>> Issue Details:
>>>
>>> -
>>>
>>> When starting Asterisk with systemctl, it fails due to a timeout:
>>>
>>> sudo systemctl start asterisk
>>> Job for asterisk.service failed because a timeout was exceeded.
>>> See "systemctl status asterisk.service" and "journalctl -xe" for details.
>>>
>>> -
>>>
>>> systemctl status asterisk shows the service in an "activating" state
>>> for a while before timing out:
>>>
>>> asterisk.service - Asterisk PBX and telephony daemon
>>> Loaded: loaded (/etc/systemd/system/asterisk.service; enabled; vendor preset: disabled)
>>> Active: activating (start) since Tue 2024-12-17 16:22:36 EET; 21s ago
>>>
>>> -
>>>
>>> After a minute or so, the service fails with the following:
>>>
>>> Dec 17 16:37:47 localhost systemd[1]: Failed to start Asterisk PBX and telephony daemon.
>>> The unit asterisk.service has entered the 'failed' state with result 'timeout'.
>>>
>>>
>>> What Has Been Tried:
>>>
>>> 1. Different versions of Asterisk have been tested — the issue
>>> persists.
>>> 2. Asterisk was run manually, and it starts fine outside of systemd.
>>> 3. Timeouts (TimeoutStartSec) were increased in the systemd unit
>>> file, but the service still doesn’t reach an "active (running)" state.
>>>
>>>
>>> Any help would be really appreciate.
>>>
>>>
>>> Kind regards,
>>>
>>>
>>> *Raúl Jimeno*
>>>
>>> IT Support Engineer
>>>
>>> INVADE International Ltd
>>> +44 33 3344 0784 (Office)
>>> +44 117 3251309 (Direct)
>>> raul.jimeno at invade.net
>>> http://www.invade.net <http://support.invade.net/>
>>>
>>> Invade International Ltd
>>>
>>> Unit 6, Badminton Court, Station Road, Bristol
>>> BS37 5HZ, United Kingdom
>>> ------------------------------------------------------
>>> Company Registration Number: 3660482
>>> Registered in England and Wales
>>> this email, and any attachment, is intended only for the attention of
>>> the addressee. Its unauthorised use, disclosure, storage or copying is not
>>> permitted. If you are not the intended recipient, please destroy all copies
>>> and inform the sender by return email. If you have received this email in
>>> error, please return it to the sender and highlight the error. We accept no
>>> legal liability for the content of the message. Any opinions or views
>>> presented are solely the responsibility of the author and do not
>>> necessarily represent those of InVADE. We cannot guarantee that this
>>> message has not been modified in transit, and this message should not be
>>> viewed as contractually binding. Although we have taken reasonable steps to
>>> ensure that this email and attachments are free from any virus, we advise
>>> that in keeping with good computing practice the recipient should ensure
>>> they are actually virus free.
>>>
>>>
>>>
>>> Invade International Limited, Unit 6, Badminton Court, Station Road,
>>> Bristol, BS37 5HZ. Registered in England & Wales - Company number:
>>> 3660482
>>> This email, and any attachment, is intended only for the attention of
>>> the addressee. Its unauthorised use, disclosure, storage or copying is not
>>> permitted. If you are not the intended recipient, please destroy all copies
>>> and inform the sender by return email. If you have received this email in
>>> error, please return it to the sender and highlight the error. We accept no
>>> legal liability for the content of the message. Any opinions or views
>>> presented are solely the responsibility of the author and do not
>>> necessarily represent those of INVADE. We cannot guarantee that this
>>> message has not been modified in transit, and this message should not be
>>> viewed as contractually binding. Although we have taken reasonable steps to
>>> ensure that this email and attachments are free from any virus, we advise
>>> that in keeping with good computing practice the recipient should ensure
>>> they are actually virus free.
>>>
>>
>
>
> Invade International Limited, Unit 6, Badminton Court, Station Road,
> Bristol, BS37 5HZ. Registered in England & Wales - Company number: 3660482
> This email, and any attachment, is intended only for the attention of the
> addressee. Its unauthorised use, disclosure, storage or copying is not
> permitted. If you are not the intended recipient, please destroy all copies
> and inform the sender by return email. If you have received this email in
> error, please return it to the sender and highlight the error. We accept no
> legal liability for the content of the message. Any opinions or views
> presented are solely the responsibility of the author and do not
> necessarily represent those of INVADE. We cannot guarantee that this
> message has not been modified in transit, and this message should not be
> viewed as contractually binding. Although we have taken reasonable steps to
> ensure that this email and attachments are free from any virus, we advise
> that in keeping with good computing practice the recipient should ensure
> they are actually virus free.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20241217/b3c7b7ee/attachment-0001.htm>
More information about the systemd-devel
mailing list