in Hacking

Install postgresql in FreeBSD jail enable sysvipc

Installen postgresql on a FreeBSD jail can result in an error when intializing the database.

 service postgresql initdb
running bootstrap script ... 2023-02-24 10:21:41.757 CET [29388] FATAL:  could not create shared memory segment: Function not implemented
2023-02-24 10:21:41.757 CET [29388] DETAIL:  Failed system call was shmget(key=37383, size=56, 03600).

By default shared memory via sysvipc is not allowed.

sysctl security.jail.sysvipc_allowed
#=> security.jail.sysvipc_allowed: 0

To solve this enable sysvipc for the given jail...
For bastille this can be added to the config file: /usr/local/bastille/jails/jailname/jail.conf

allow.sysvipc = 1;

Restart jail.

sysctl security.jail.sysvipc_allowed
#=> security.jail.sysvipc_allowed: 1