Running postgres 8.2 in a jail

David N davidn04 at gmail.com
Thu Aug 30 15:32:16 PDT 2007


On 30/08/2007, Karsten Rothemund <karsten at photor.de> wrote:
> Hello list,
>
> I played a little bit with jails on FBSD 6.2 (just to learn). One jail
> I want to use as database server, so installed postgresql82-server
> from the ports.
>
> But when I try to initdb I get the following:
>
> pgsql# /usr/local/etc/rc.d/postgresql initdb
> The files belonging to this database system will be owned by user "pgsql".
> This user must also own the server process.
>
> The database cluster will be initialized with locales
>   COLLATE:  C
>   CTYPE:    en_US.UTF-8
>   MESSAGES: en_US.UTF-8
>   MONETARY: en_US.UTF-8
>   NUMERIC:  en_US.UTF-8
>   TIME:     en_US.UTF-8
>
> creating directory /usr/local/pgsql/data ... ok
> creating subdirectories ... ok
> selecting default max_connections ... 10
> selecting default shared_buffers/max_fsm_pages ... 400kB/20000
> creating configuration files ... ok
> creating template1 database in /usr/local/pgsql/data/base/1 ... FATAL:  could not create semaphores: No space left on device
> DETAIL:  Failed system call was semget(1, 17, 03600).
> HINT:  This error does *not* mean that you have run out of disk space.
>         It occurs when either the system limit for the maximum number of semaphore sets (SEMMNI), or the system wide maximum number of semaphores (SEMMNS), would be exceeded.  You need to raise the respective kernel parameter.  Alternatively, reduce PostgreSQL's consumption of semaphores by reducing its max_connections parameter (currently 10).
>         The PostgreSQL documentation contains more information about configuring your system for PostgreSQL.
> child process exited with exit code 1
> initdb: removing data directory "/usr/local/pgsql/data"
>
> As I understand, I have to change some sysctls to
> - allow the jail to use some resources: security.jail.sysvipc_allowed=1
> - raise some values of kern.ipc; this looks like the following:
> pgsql# sysctl kern.ipc | grep sem
> kern.ipc.semmap: 256
> kern.ipc.semmni: 10
> kern.ipc.semmns: 60
> kern.ipc.semmnu: 30
> kern.ipc.semmsl: 60
> kern.ipc.semopm: 100
> kern.ipc.semume: 10
> kern.ipc.semusz: 92
> kern.ipc.semvmx: 32767
> kern.ipc.semaem: 16384
> - and the same with shared memory (got this from the postgres
>   documentation)
> pgsql# sysctl -a | grep shm
> kern.ipc.shmmax: 134217728
> kern.ipc.shmmin: 1
> kern.ipc.shmmni: 192
> kern.ipc.shmseg: 128
> kern.ipc.shmall: 32768
> kern.ipc.shm_use_phys: 0
> kern.ipc.shm_allow_removed: 0
>
> but postgres does still not initdb (I tried also with postgresql74-server
> which worked).
>
> The question is simple: what is missing, what is wrong?
>
> (I can of course provide any config and information if more is needed)
>
> Thank you for any hint,
>
> Karsten
>
> --
>
> Karsten Rothemund <karsten at photor.de>     /"\
> PGP-Key:     0x7019CAA5                   \ /
> Fingerprint: E752 C759 B9B2 2057 E42F      \  ASCII Ribbon Campaign
>              50EE 47AC A7CE 7019 CAA5     / \ Against HTML Mail and News
>
>


in your /etc/rc.conf put
jail_sysvipc_allow="YES"


Regards
David N


More information about the freebsd-jail mailing list