On Thu, Sep 29, 2011 at 12:08 PM, dennis jenkins <
> (root(at)failed: </db>) # psql -Upgsql -dmy_db -c"create or replace function
> parse_micr(text) returns micr_struct
> as '/db/pgsql_micr_parser_64.so', 'pgsql_micr_parser' language c volatile
> cost 1;"
> ERROR: could not load library "/db/pgsql_micr_parser_64.so": ld.so.1:
> postgres: fatal: /db/pgsql_micr_parser_64.so: Permission denied
> stat("/db/pgsql_micr_parser_64.so", 0xFFFFFD7FFFDF8F50) = 0
> resolvepath("/db/pgsql_micr_parser_64.so", "/db/pgsql_micr_parser_64.so",
> 1023) = 27
> open("/db/pgsql_micr_parser_64.so", O_RDONLY) = 22
> mmap(0x00010000, 32768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ALIGN, 22, 0)
> Err#13 EACCES
> close(22) = 0
First, some more background. These 5 postgresql servers are local zones
running in Solaris. (like a "linux container"). The database itself is
inside "/db". The database user ("pgsql") has no problems reading any file
there, including the micr_parser.so file.
"/db" is not just a directory under "/". It is a separate file system
mounted within the zone (via a loopback mount). The actual file-system is a
ZFS sub-filesystem on a dedicated zpool on the (shared) servers. On the
four servers where the "create function" worked, "/db" was mounted with
However, on the server where it failed, "/db" was mounted with
"nodevices,noexec". This was causing mmap() to fail when it requested
My inspiration for solving this riddle was that I copied the .so to a local
directory under "/" that was not under "/db". "create function" then
succeeded. The little light bulb over my head turned on and I began
checking filesystem mount flags.
So, for anyone who finds this posting via a search engine years from now...
if "create function" fails with "permission denied", also check that the
filesystem holding the ".so" file is not mounted with "exec" disabled.
I've not tested this behavior on Linux. I humble suggest putting a note in
the postgresql documentation about the FS mount flags impact on 'C' language
In response to
pgsql-general by date
|Next:||From: Joe Conway||Date: 2011-10-07 17:21:09|
|Subject: Call For Talks: PGDay.SoCal @ SCALE 10X|
|Previous:||From: Cédric Villemain||Date: 2011-10-07 14:23:48|
|Subject: Re: Never-idle autovacuum, and does (auto)vacuuming fill
the OS cache ?|