OUR BLOG

Thoughts on development, design and the world we live in.



sysctl

By pablokang in Apple. Posted on September 23rd

Occasionally my shared memory segment settings in my /etc/rc file aren’t applied correctly during startup and I get the following error when I try to start Postgres:

I would expect my shared memory size to be 167772160 instead of 33554432 since my /etc/rc file looks like this:

Restarting my machine helps, but doing that is just painful.

This may be obvious, but I learned that you can apply the sysctl command even if it doesn’t happen during startup. So all I had to do to fix my Postgres problem was:

To see a list of all the kernel variables, type sysctl -A. Check out the sysctl man page for more details.

By pablokang | Posted in Apple | Tagged , , , | Comments (2)

2 Comments

  1. goatchowder
    Posted September 29, 2010 at 1:04 pm | Permalink

    It seems that either your /etc/rc is not getting called, or that some other program or process with root privileges is calling sysctl or issuing system calls and changing your shmem settings.

    After boot, run sysctl -a and see if the settings in your startup file are getting run. If not, there’s the problem; fix that by checking with your distribution and finding out the correct way to get those settings run at startup.

    If it’s getting set up correctly at boot, but changed later “mysteriously”, then you will have some forensics to do. Some process is changing them, and you’ll want to know what and why.

    Manually running systcl commands when things go haywire is a hack. You should probably figure out what is causing the problem in the first place, and fix that.

  2. Posted September 29, 2010 at 9:09 pm | Permalink

    Thanks for the comment. Absolutely agree with you. Hacking the system with sysctl was probably not the best approach, but under deadline, it was the immediate option I went with.

    In the end, I actually ended up getting a new system. My mac had a bunch of issues related to hardware: airport kept on failing (I tried every trick on the web to fix it), my battery needed replacing, and my trackpad started sticking.

Post a Comment

Your email is never shared. Required fields are marked *

*
*