[Pkg-postgresql-public] Bug#642133: [postgresql-9.1] After upgrading from 9.0 to 9.1 postgres fails to start: FATAL: could not create shared memory segment: Invalid argument

Michael Stapelberg stapelberg at debian.org
Mon Jun 25 16:12:34 UTC 2012


Hi,

I ran into the same problem today. I upgraded from postgresql-9.1.3-2
to postgresql-9.1.4-1, this is the log output:

Fetched 8.249 kB in 3s (2.216 kB/s)                
(Reading database ... 54998 files and directories currently installed.)
Preparing to replace postgresql-9.1 9.1.3-2
(using .../postgresql-9.1_9.1.4-1_i386.deb) ... Stopping PostgreSQL 9.1
database server: main. Unpacking replacement postgresql-9.1 ...
Preparing to replace postgresql-client-9.1 9.1.3-2
(using .../postgresql-client-9.1_9.1.4-1_i386.deb) ... Unpacking
replacement postgresql-client-9.1 ... Setting up postgresql-client-9.1
(9.1.4-1) ... Setting up postgresql-9.1 (9.1.4-1) ...
Starting PostgreSQL 9.1 database server: mainThe PostgreSQL server
failed to start. Please check the log output: 2012-06-25 18:03:43 CEST
FATAL: could not create shared memory segment: Invalid argument
2012-06-25 18:03:43 CEST DETAIL: Failed system call was
shmget(key=5432001, size=34922496, 03600). 2012-06-25 18:03:43 CEST
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 34922496 bytes), reduce
PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or
max_connections. 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. The
PostgreSQL documentation contains more information about shared memory
configuration. ... failed! failed! invoke-rc.d: initscript postgresql,
action "start" failed. dpkg: error processing postgresql-9.1
(--configure): subprocess installed post-installation script returned
error exit status 1 Errors were encountered while processing:
postgresql-9.1 E: Sub-process /usr/bin/dpkg returned an error code (1)

Interestingly, shmmax was set to 5 MB:

$ sysctl -a | grep shm
kernel.shmmax = 5922496
kernel.shmall = 2097152
kernel.shmmni = 4096

After changing it to 50 MB, starting postgresql worked again. Which is
strange, because I didn’t change the configuration file and it was
running fine before this upgrade o_O.

I suspected it has something to do with available memory (which might
be lower then when I last started postgresql):
$ free -m
             total       used       free     shared    buffers
cached
Mem:           501        414         86          0         24
27
-/+ buffers/cache:        362        138
Swap:          478        176        301


Here is the output of ipcs (after postgres is already running):
$ ipcs

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch
status 0x0052e2c1 3670016    postgres   600        34922496
8                       

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     
0x0052e2c1 17924096   postgres   600        17        
0x0052e2c2 17956865   postgres   600        17        
0x0052e2c3 17989634   postgres   600        17        
0x0052e2c4 18022403   postgres   600        17        
0x0052e2c5 18055172   postgres   600        17        
0x0052e2c6 18087941   postgres   600        17        
0x0052e2c7 18120710   postgres   600        17        
0x002fa327 16678920   root       666        2         

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages    

Best regards,
Michael





More information about the Pkg-postgresql-public mailing list