Error:
postgres[993]: [1-1] FATAL: could not create semaphores: No space left on device
postgres[993]: [1-2] DETAIL: Failed system call was semget(5432003, 17, 03600).
postgres[993]: [1-3] HINT: This error does *not* mean that you have run out of disk space.
postgres[993]: [1-4] It occurs when either the system limit for the maximum number of semaphore sets (SEMMNI), or the system wide maximum number of
postgres[993]: [1-5] semaphores (SEMMNS), would be exceeded. You need to raise the respective kernel parameter. Alternatively, reduce PostgreSQL's
postgres[993]: [1-6] consumption of semaphores by reducing its max_connections parameter (currently 40).
postgres[993]: [1-7] The PostgreSQL documentation contains more information about configuring your system for PostgreSQL.
Fix:
add the following to /boot/loader.conf
kern.ipc.semmni=255
kern.ipc.semmns=512
kern.ipc.semmnu=256