Gitlab installs but home page is a 500 error and postgres won’t start

Feb 6th, 2015 | By | Category: Linux / Freebsd

So installed gitlab on a new server today, Ubuntu 14.04 with 8GB of ram and the install went fine but upon startup I was greeted with the 500 error and the postgresql log files were full of this:

2015-02-07_00:46:16.32456 The PostgreSQL documentation contains more information about shared memory configuration.
2015-02-07_00:46:17.36825 FATAL: could not create shared memory segment: Invalid argument
2015-02-07_00:46:17.36833 DETAIL: Failed system call was shmget(key=5432001, size=2171961344, 03600).
2015-02-07_00:46:17.36838 HINT: This error usually means that PostgreSQL’s request for a shared memory segment exceeded your kernel’s SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 2171961344 bytes), reduce PostgreSQL’s shared memory usage, perhaps by reducing shared_buffers or max_connections.
2015-02-07_00:46:17.36839 If the request size is already small, it’s possible that it is less than your kernel’s SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.


Easy enough right, all we have to do is ensure that the value of “kernel.shmmax” in my sysctl.conf is greater than the value of “postgresql[‘shared_buffers’]” in my gitlab.rb file.   Ideally this is what you would do is set the first value to something like 2GB(roughly 1/4 your server ram or 8GB in my case) and then set the latter value to 1.8GB or so.   Viola, everything should start fine

Leave a Comment