postgresql in plugin Jail

Status
Not open for further replies.

hyulee

Cadet
Joined
Sep 26, 2012
Messages
6
I tried to install posgreSQL (9.2) in pluginjail because not many people uses my FreeNAS (8.2) system in my office, so felt waste for this server processor. The installation was successfully done from ports, but I was not able to initialize the DB and had error message as below.

$ initdb -D /usr/local/pgsql/data
The files belonging to this database system will be owned by user "pgsql".
This user must also own the server process.

The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".

fixing permissions on existing directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 10
selecting default shared_buffers ... 400kB
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... FATAL: could not create shared memory segment: Function not implemented
DETAIL: Failed system call was shmget(key=1, size=2088960, 03600).

child process exited with exit code 1
initdb: removing contents of data directory "/usr/local/pgsql/data"

Does anyone know how to fix this?
 

toddos

Contributor
Joined
Aug 18, 2012
Messages
178
Perhaps this is useful?

Running PostgreSQL in a jail is interesting. There are shared memory issues which can be resolved by setting security.jail.sysvipc_allowed via sysctl.
 

William Grzybowski

Wizard
iXsystems
Joined
May 27, 2011
Messages
1,754
There is a bug in the jail initialization that does not allow sysvipc in jails, the issue should have been fixed in 8.3.0-BETA3, give it a try and report back, please.
 

hyulee

Cadet
Joined
Sep 26, 2012
Messages
6
Dear toddos, William,

I would like to thank you for your help and comment.
Yes, no matter what I tried in Jail it always returns security.jail.sysvipc_allowed:0 (host system returns 1, but not in jail). However, after Jail was initialized, it can be manually set by below commend and could start PostgreSQL server in Jail.

jail -m jid=3 allow.sysvipc=1 (very last answer at the bottom)

This solution cannot run PostgreSQL while the host system is booting, so it might not be appropriate solution for automated environment.

Anyway I will try new version later and post back here.
 

hyulee

Cadet
Joined
Sep 26, 2012
Messages
6
Dear William, toddos,

I upgraded FreeNAS from 8.2 Release to 8.3 Beta3, and security.jail.sysvipc_allowed was set "1" in Jail successfully, but still PostgreSQL was not able to start with below error,

DETAIL: Failed system call was semget(#, ##, ####).
HINT: This error does *not* mean that you have run out of disk space.
It occurs when either the system limit for the maximum number of
semaphore sets (SEMMNI), or the system wide maximum number of semaphores
(SEMMNS), would be exceeded. You need to raise the respective kernel parameter.

So I followed toddos link, added below values in /boot/loader.conf (using "mount -uw /") as it instructed,

kern.ipc.semmni=256
kern.ipc.semmns=512
kern.ipc.semmnu=256

and rebooted the system, and now it is finally working!


Thank you both for help!

I'm not sure I can use this jail under the production environment, or just use it as my personal research and development system, but I will try it anyway.
 

William Grzybowski

Wizard
iXsystems
Joined
May 27, 2011
Messages
1,754
Do not manually edit /boot/loader.conf, use System->Tunables, otherwise those changes will be lost on upgrades...
 

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
I have been searching for a way to run PostgreSQL from FreeNAS to host an xTuple ERP database to be accessed by Mac and Windows clients. This forum post came up in my search; could anyone elaborate on what it takes to get PostgreSQL up and running on a FreeNAS server?
 

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
Is there a installer specifically for the FreeNAS platform, or do I need to find comand line instructions,

Thanks for the quick reply.
 

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
So I have found this info regarding the PostgreSQL installation using the comand line on the xTuple forum:

http://www.xtuple.org/InstallingTheDatabase#CommandLineExamples

Is this accurate to installing on FreeNAS; I am struggling to understand if I can install remotely from another machine, (possibly using the comand line tool from the web GUI), or whether I need to to be doing this from within the FreeNAS system itself. (IE hook up a monitor and keyboard, etc.)

I have spent years fooling with the Unix Terminal since OSX came out, but this is the first time I have setup a dedicated Server; which has been successful to this point I might add. ;)
 
Status
Not open for further replies.
Top