Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#58131 closed defect (worksforme)

postgres-server post-install instructions seem incorrect?

Reported by: masklinn Owned by: jyrkiwahlstedt
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: postgresql11-server

Description

After installing the port, a life-saver note is printed providing setup instructions

notes "\nTo create a database instance, after install do\n\
        sudo mkdir -p ${dbdir}\n\
        sudo chown ${dbuser}:${dbgrp} ${dbdir}\n\
        sudo su ${dbuser} -c \'cd ${dbhome} && ${libdir}/bin/initdb -D ${dbdir}\' "

Unless I'm misreading things or my machine is in a really weird state (as these failed) there's an issue with it though: on the last line, it cds to ${dbhome} as ${dbuser}, but ${dbhome} *is still owned by root*

  • ${dbdir} is ${dbhome}/defaultdb
  • both directories are created as root
  • chown is only applied to ${dbdir}

so the postgres user doesn't have access to ${dbhome} to which it tries to cd.

I don't really know whether the proper fix is to just not cd there at all (is it really necessary for initdb?) or to chown -R ${dbdir} instead of just ${dbhome}.

Assuming it's not an error between my keyboard and chair, I think it's a long-standing issue too, I remember hitting it on previous versions but assuming I'd screwed up somewhere.

Change History (3)

comment:1 Changed 6 years ago by jmroot (Joshua Root)

Cc: jwa@… removed
Owner: set to jyrkiwahlstedt
Status: newassigned

comment:2 Changed 6 years ago by jyrkiwahlstedt

Resolution: worksforme
Status: assignedclosed

I checked the instructions by doing initdb with postgresql11, it worked quite fine. The only reason I see one couldn't access ${dbhome} is, if the permissions for it are something like rwx------. I have my umask as 0022, a normal value for it, with no problems…

comment:3 Changed 6 years ago by masklinn

I have my umask as 0022, a normal value for it, with no problems…

Ah, that's the one. Apparently sometimes in the past I decided to set umask 027, then promptly forgot about it. Sorry for the bother.

Note: See TracTickets for help on using tickets.