Comment 21 for bug 264336

Revision history for this message
Peter Van Laer (concuria) wrote : Re: [Bug 264336] Re: pgsql fails to start due to shared buffer setting greater than kernel allows

I have set SHMALL to 1GB & it's ok now.
thx

2009/4/1 Martin Pitt <email address hidden>

> I thought about this problem a little, and also discussed it with
> upstream. Basically, we have four options:
>
> (1) Ignore
> + no hidden magic
> - very inconvenient, package installation does not create default
> cluster sometimes, or the default cluster fails to start on
> system boot
>
> Best solution for admin control freaks.
>
> (2) Bee shy about initdb's default setting and set it to 3/4 of the
> available memory.
> + no hidden magic
> + upstream compatible solution
> - suboptimal performance by default
>
> (3) Change SHMALL/SHMMAX in postgresql's init script if necessary
> + Always works
> - Unexpected, works behind admin's back.
>
> (4) Set a bigger SHMALL default in the kernel.
> + no hidden magic
> + no guesswork involved in scripts
> + no hidden magic
>
> Upstream recommended to do (4). Quote: "I imagine BTW that it's SHMALL
> that's causing you issues. SHMMAX shouldn't have any effect that varies
> depending on what else is using shared memory."
>
> I reassign this to the kernel guys to get their input.
>
> This is still not breaking many boxes, and intrusive to solve either
> way, so taking off the Jaunty radar.
>
> ** Package changed: postgresql-common (Ubuntu Jaunty) => linux (Ubuntu
> Jaunty)
>
> ** Changed in: linux (Ubuntu Jaunty)
> Status: Triaged => Won't Fix
>
> ** Changed in: linux (Ubuntu Jaunty)
> Assignee: Martin Pitt (pitti) => (unassigned)
>
> --
> pgsql fails to start due to shared buffer setting greater than kernel
> allows
> https://bugs.launchpad.net/bugs/264336
> You received this bug notification because you are a direct subscriber
> of a duplicate bug.
>
> Status in “linux” source package in Ubuntu: New
> Status in “postgresql-8.3” source package in Ubuntu: Won't Fix
> Status in linux in Ubuntu Jaunty: Won't Fix
> Status in postgresql-8.3 in Ubuntu Jaunty: Won't Fix
>
> Bug description:
> Binary package hint: postgresql-8.3
>
> Freshly installed pgsql 8.3 on hardy got me this error when restarting:
> 2008-09-03 09:16:39 EDT DETAIL: Failed system call was shmget(key=5432001,
> size=38207488, 03600).
> 2008-09-03 09:16:39 EDT 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 38207488 bytes),
> reduce PostgreSQL's shared_buffers parameter (currently 4096) and/or its
> max_connections parameter (currently 103).
> 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.
>
> Checking the kernel settings:
> sudo sysctl -a | grep -i shm
> kernel.shmmax = 33554432
> kernel.shmall = 2097152
> kernel.shmmni = 4096
>
> The shared_buffers setting defaults to 32MB. I changed this down to 25MB to
> test and then the server would start right up.
>