Jail + DTrace + Postgres

Hi guys,

First off, really impressed with FreeBSD, ZFS and Jails. We're slowly switching out our computing platform over to FreeBSD from CentOS.

I'm trying to run Postgres 9.1.2 inside FreeBSD 9.0 jail with DTrace turned on.

Got the jail to work fine. When inside the jail, dtrace -l|head works, so DTrace works.

But you try to compile the databases/postgresql91-server port with DTrace turned on, I get a compiler error:
Code:
===>  Building for postgresql-client-9.1.2
gmake -C utils probes.h
gmake[1]: Entering directory `/usr/ports/databases/postgresql91-client/work/postgresql-9.1.2/src/backend/utils'
dtrace -C -h -s probes.d -o probes.h.tmp
dtrace: failed to compile script probes.d: "/usr/lib/dtrace/psinfo.d", line 37: syntax error near "uid_t"
gmake[1]: *** [probes.h] Error 1
gmake[1]: Leaving directory `/usr/ports/databases/postgresql91-client/work/postgresql-9.1.2/src/backend/utils'
gmake: *** [utils/probes.h] Error 2
*** Error code 2

Stop in /usr/ports/databases/postgresql91-client.
*** Error code 1

Stop in /usr/ports/databases/postgresql91-server.
*** Error code 1

I assumed this is because even though the dtrace probes are running, the files needed to compile aren't accessible inside the jail?

So I went ahead and compiled the same port in the "master" (non-jail) environment with dtrace enabled. This worked. Of course, you can't run the compiled binaries inside the jail. So I copied all the files created from installing the port into the /usr/jail//usr/local (basically copy all the binaries).

Then went back into the jail and was able to run initdb and then pg_ctl. The database runs, but I get an error:

Code:
pg_ctl -D ~/data/ start 
pg_ctl: another server might be running; trying to start server anyway
server starting
WARNING: number of probes fixed does not match the number of defined probes (54 != 68, respectively)
WARNING: some probes might not fire or your program might crash

Can anyone here tell me what's the best way to accomplish this?

I've read the docs on dtrace and jails and they all works. Just not sure how to go about dtrace + jail + postgres.

Thanks!
Matt
 
lsgroup said:
pg_ctl: another server might be running; trying to start server anyway
server starting
WARNING: number of probes fixed does not match the number of defined probes (54 != 68, respectively)
WARNING: some probes might not fire or your program might crash

Matt,
just a shot but maybe you run two pgsql servers (one host, one jail) at the same time with the same UIDs. That is not possible, because pgsql is widely using shared mem, that is even shared over the jail borders. So, use different UIDs for each instance of the pgsql server and you might have more luck.

greetings
Jimmy
 
Hi Jimmy,

Thanks for the response. I double checked just to make sure there wasn't another instance running. The
Code:
pg_ctl: another server might be running; trying to start server anyway
message came up from a kill -9 a previous postgres process while testing things! I still get the:

Code:
WARNING: number of probes fixed does not match the number of defined probes (54 != 68, respectively)
WARNING: some probes might not fire or your program might crash

without the
Code:
another server might be running
message. I'm assuming the probes is because of dtrace in the jail? I don't get the probes message when I run postgres in the master.
 
Hi,

Figured it out - just thought I'd share. This works on 9.1 release and postgresql92-server port. It might also work on 9.0, but did not bother to test.

OK, the first issue of postgres not compiling with dtrace in a jail is solved by copying the master's /boot directory into the jail's /boot directory.
cp -a /boot/* /usr/jail/jailname/boot
does the trick.

The second problem: number of probes fixed does not match the number of defined probes (54 != 68, respectively) is solved by choosing DEBUG as well as DTRACE when compiling postgres.

So far works great!
 
Solved by using packages

I had a similar problem when building php5-extensions with postgresql-support (currently php5.4) from the ports collection:

dtrace: failed to compile script probes.d

The above workaround, copying /boot from master to jail, did not solve it. Instead I installed the postgres-client with pkg like this to solve it:

pkg_add -r postgresql90-client

And all went well.
 
fegu said:
I had a similar problem when building php5-extensions with postgresql-support (currently php5.4) from the ports collection:

dtrace: failed to compile script probes.d

The above workaround, copying /boot from master to jail, did not solve it. Instead I installed the postgres-client with pkg like this to solve it:

pkg_add -r postgresql90-client

And all went well.

I realize this is an old post, but I just have to say thank you for posting this. I have been pulling my hair out for hours trying to install the source code using Subversion. I want to create a home server and I needed the source code to compile my own kernel. I have literally been reading web page after web page for hours in order to figure out how to get this thing to finish installing.

When I would get to the the apr-1 installation, it would try to install postgresql-9.0-client because of its dependent library, I would get the exact same error as the OP. I was not running it in a jail or anything like that, and as such his solution did not work for me, however, yours did. Thanks for posting your response. If you had not posted it, I would have never found the solution sans posting my own thread on it. Now I'm gleefully watching subversion finish its install and on to compiling my own kernel and eventually my very first server.
 
Back
Top