Ulimit for user asterisk inside an LXD container

I have a bare metal ubuntu 16.04 server with a centos 6 LXD container within which I wish to install FreePBX/asterisk which I’m building from source.

The building and install process was going very well until the FreePBX GUI itself gets installed. This requires asterisk to be started (which itself compiled fine) with the FreePBX script ./start_asterisk start. This throws the following error -

/usr/sbin/safe_asterisk: line 96: ulimit: open files: cannot modify limit: Operation not permitted

Line 96 is trying to change the open files limit to 1048576 “ulimit -n 1048576” but clearly the operation is not permitted.

I’ve scoured the internet for guides to try and manually change the ulimit for the user asterisk and they either appear to have no effect or give the same “operation not permitted” message.

So I wondered if somebody could maybe point me in the right direction with this. Is this related to asterisk being in a container perhaps?

Thanks very much in advance.

Have you tried it in a “sudo …”?

Yeah I’ve tried that, the shell is root anyway.



I solved this by running FreePBX/asterisk inside a privileged LXD container. Security isn’t an issue as I’m only running one container, the idea being I can easily create a snapshot/backup of the PBX.