Asterisk doesn't detach, "amportal start" hangs

Hello!
I have installed latest freepbx on debian lenny. But when I type amportal start, asterisk starts and aportal hangs (doesn’t even check if asterisk is started). How should I fix it?
Software: Debian Lenny (5.0), Asterisk 1.4.21 (apt-get install asterisk …) and latest release of FreePBX.
amportal start output:

[code]lenny-test:~# amportal start

SETTING FILE PERMISSIONS
Permissions OK

STARTING ASTERISK
Asterisk 1.4.21.2~dfsg-3, Copyright © 1999 - 2008 Digium, Inc. and others.
Created by Mark Spencer [email protected]
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

This package has been modified for the Debian GNU/Linux distribution
Please report all bugs to http://bugs.debian.org/asterisk

Running as user 'asterisk’
Warning! Asterisk is not thread safe.
Asterisk Event Logger Started /var/log/asterisk/event_log
Asterisk Dynamic Loader Starting:
Asterisk Management interface listening on port 5038
Asterisk PBX Core Initializing
Registering builtin applications:
[Answer]
—skip—
[WaitExten]
Asterisk Dynamic Loader Starting:
res_musiconhold.so => (Music On Hold Resource)
—skip—
func_cut.so => (Cut out information from a string)
Asterisk Ready.
[/code]
ps aux output:

root      2508  0.0  0.2  10152  1328 pts/2    S+   05:11   0:00 bash /usr/local/sbin/amportal start
root      2509  0.2  0.2  10288  1504 pts/2    S+   05:11   0:00 bash /var/lib/asterisk/bin/freepbx_engine start
root      2538  0.1  0.2  10180  1368 pts/2    S+   05:11   0:00 /bin/sh /usr/sbin/safe_asterisk -U asterisk -G asterisk
asterisk  2550  1.3  2.8 495768 14764 pts/2    Sl+  05:11   0:00 /usr/sbin/asterisk -U asterisk -G asterisk -f -g -p
root      2581  0.0  0.2  16012  1104 pts/0    R+   05:12   0:00 ps aux

Any help would be greatly appreciated!

no one to help me?

I am having the same problem. Also with Debian.

Have you found a solution? Anyone?

I had this issue also and when investigating its an easy fix…

edit: /usr/sbin/safe_asterisk

Change: BACKGROUND=0 to BACKGROUND=1

The amportal start will end in background as when safe_asterisk starts it will end in background…

Hope this helps

Regards
Logicness

I still had issues with adding the background=1 to safe_asterisk. So what I did was I modified the freebpx_engine script and where it starts and stops Asterisk I replaced with /etc/init.d/asterisk start|stop.

The issue I had was that with amportal stop…I would usually get a asterisk core dump. Even I only just started it and then stopped it immediately. And then Asterisk would restart.

This way works just fine. And if Asterisk crashes…well I just have to manually restart it.

Ubuntu 10.04 BTW with Asterisk 1.6