elf_begin failed on postgresql 9.4 with dtrace enabled
Mark Johnston
markj at FreeBSD.org
Sun Dec 21 23:58:13 UTC 2014
On Sun, Dec 21, 2014 at 03:22:25PM -0800, Lacey Powers wrote:
> Hello Everyone,
>
> I was attempting to build and use PostgreSQL with dtrace on FreeBSD 10.1 on
> my home workstation.
>
> It builds, and the binary works, but fails to register any probes.
>
> After double checking that I had the dtraceall kernel module loaded,
> changing permissions on /dev/dtrace/helper (0666), verifying that
> devel/libelf was loaded, and digging around source code and Google for debug
> flags, I'm at a loss for what else to do.
>
> Here is the error:
>
> [pgsql at talizorah ~]$ DTRACE_DOF_INIT_DEBUG=1 /usr/local/bin/postgres -D
> /usr/local/pgsql/9.4/data
> dtrace DOF postgres: elf_begin failed
> LOG: ending log output to stderr
> HINT: Future log output will go to log destination "syslog".
> dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1)
> dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1)
> dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1)
> ^Cdtrace DOF postgres: dtrace DOF postgres: DTrace ioctl failed to remove
> DOF (-1)
> DTrace ioctl failed to remove DOF (-1)
> dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1)
> dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1)
> dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1)
> dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1)
> [pgsql at talizorah ~]$
Hi Lacey,
I've never seen this particular problem before. Could you post the
output of "ldd /usr/local/bin/postgres"? I've never tried using libelf
from ports, so perhaps there's a problem with it, assuming it is indeed
being used (as opposed to the base system's libelf).
If the ports libelf is being used (/usr/local/lib/libelf.so will show up
in the ldd ouput if so), could you try deleting devel/libelf, rebuilding
postgres, and trying again? If not, or if other packages require
devel/libelf on your system, could you apply the patch below, rebuild drti,
rebuild postgres (in that order), and try again?
To rebuild drti, cd to /usr/src/cddl/lib/drti and run
"make && make install".
Thanks!
-Mark
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
index ccd4f9b..eafc4c6 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
@@ -158,7 +158,7 @@ dtrace_dof_init(void)
return;
}
if ((e = elf_begin(efd, ELF_C_READ, NULL)) == NULL) {
- dprintf(1, "elf_begin failed\n");
+ dprintf(1, "elf_begin failed: %s\n", elf_errmsg(elf_errno()));
close(efd);
return;
}
More information about the freebsd-dtrace
mailing list