Ugh. It turns out I had security.bsd.hardlink_check_gid=1 and
security.bsd.hardlink_check_uid=1 in sysctl.conf. Setting them to 0
fixed everything. That's frustrating. Sorry for all the trouble. Many
thanks for helping resolve this.
On 12/15/12, Amitabh Kant <amitabhkant@gmail.com> wrote:
> David
>
> I just tried installing PG 9.2.2 on FreeBSD 8.3 and initdb went smoothly
> without any problems. the only difference would be that I had it running in
> a virtualbox instance. My config were as follows;
>
> FreeBSD 8.3-RELEASE-p5 (binary updated through freebsd-update)
> PG 9.2.2 (installed through ports)
> root filesystem on UFS
> ZFS mounted on /example
> PG data directory set to /example/pgsql/data
>
> relevant rc.conf entries:
> postgresql_enable="YES"
> postgresql_data="/example/pgsql/data"
>
> running "/usr/local/etc/rc.d/postgresql initdb" works perfectly. Just
> needed to set the correct permissions on /example/pgsql directory.
>
> Amitabh
>
>
>
>
> On Sat, Dec 15, 2012 at 10:32 AM, David Noel <david.i.noel@gmail.com>
> wrote:
>
>> > You need to talk to some FreeBSD kernel hackers about why link()
>> > might be failing here. Since you see it on UFS too, we can probably
>> > exonerate the ZFS filesystem-specific code.
>> >
>> > I did some googling and found that EPERM can be issued if the
>> > filesystem
>> > doesn't support hard links (which shouldn't apply to ZFS I trust).
>> > Also, Linux has a "protected_hardlinks" option that causes certain
>> > attempts at creating hard links to fail --- but our use-case here
>> > doesn't fall foul of any of those restrictions AFAICS, and of course
>> > FreeBSD isn't Linux. Still, I wonder if you're running into some
>> > misdesigned or misimplemented security restriction. You might want
>> > to look at your kernel parameters and see if any of them look like
>> > they might have to do with restricting hard-link operations.
>> >
>> > Also, since Amitabh failed to duplicate the failure on both earlier
>> > and later FreeBSD kernels, and we've not heard reports of this from
>> > anybody else either, it seems more than possible that it's a plain
>> > old bug in the specific kernel version you're using.
>> >
>> > As a short-term workaround, I'd suggest rebuilding with
>> > HAVE_WORKING_LINK disabled. (Just remove that #define from
>> > src/include/pg_config_manual.h and rebuild.)
>>
>> OK, thanks. I've gotten in touch with the freebsd-hackers mailing
>> list. Hopefully we'll be able to get this one figured out.
>>
>> I compiled a GENERIC kernel and tried it again. Still no luck. But at
>> least we know now it wasn't a configuration error.
>>
>