Opened 4 months ago

Last modified 4 months ago

#73879 new defect

Creating a database instance, after install, for postgresql16-server @16.13 fails on Sonoma, macOS Version 14.8.5, because no user and group accounts?

Reported by: ballapete (Peter "Pete" Dyballa) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.12.4
Keywords: sonoma Cc: davidgilman1@…
Port: postgresql16-server

Description

root 243 /\ port select postgresql postgresql16
Selecting 'postgresql16' for 'postgresql' succeeded. 'postgresql16' is now active.
root 244 /\ mkdir -p /opt/local/var/db/postgresql16/defaultdb
root 245 /\ chown postgres:postgres /opt/local/var/db/postgresql16/defaultdb
root 246 /\ sudo -u postgres /bin/sh -c 'cd /opt/local/var/db/postgresql16 && /opt/local/lib/postgresql16/bin/initdb -D /opt/local/var/db/postgresql16/defaultdb'
sudo: runas gid 4294967295: invalid value
sudo: runas_gid=4294967295: invalid value
root 247 /\ l -A /opt/local/var/db/postgresql16
total 0
drwxr-xr-x  2 postgres  postgres  64 21 Apr 15:18 defaultdb
root 248 /\ l -A /opt/local/var/db/postgresql16/defaultdb
total 0

I need a running instance to test p5.34-dbd-pg. And possibly fix the illegally long socket path, see #73878.

Change History (4)

comment:1 Changed 4 months ago by ryandesign (Ryan Carsten Schmidt)

Do you have the postgres user and group? This command should tell you about them if you have them:

dscl . -read /Users/postgres
dscl . -read /Groups/postgres

They should have been created by the postgresql*-server ports. Here's the code that does that:

https://github.com/macports/macports-ports/blob/d425d946cbf4da91c22852010b126617078d221b/databases/postgresql16-server/Portfile#L32-L38

Incidentally, macOS already has a user and group called _postgres so the port should probably be using those instead of postgres.

comment:2 in reply to:  1 Changed 4 months ago by ballapete (Peter "Pete" Dyballa)

Replying to ryandesign:

Do you have the postgres user and group? This command should tell you about them if you have them:

dscl . -read /Users/postgres
dscl . -read /Groups/postgres
pete 265 /\ dscl . -read /Users/postgres
dsAttrTypeNative:accountPolicyData:
 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>creationTime</key>
	<real>1776777172.95684</real>
</dict>
</plist>

dsAttrTypeNative:record_daemon_version: 8980000
AppleMetaNodeLocation: /Local/Default
GeneratedUID: EA35C908-1810-4E38-BFEA-DEFF93C3C2CC
NFSHomeDirectory: /opt/local/var/db
Password: *
PrimaryGroupID: -1
RealName:
 PostgreSQL-16 Server
RecordName: postgres
RecordType: dsRecTypeStandard:Users
UniqueID: 509
UserShell: /usr/bin/false
pete 266 /\ dscl . -read /Groups/postgres
dsAttrTypeNative:record_daemon_version: 8980000
AppleMetaNodeLocation: /Local/Default
GeneratedUID: E28C0BFD-BCEA-487F-AF77-7B1AD705E42A
Password: *
PrimaryGroupID: 501
RealName: postgres
RecordName: postgres
RecordType: dsRecTypeStandard:Groups

comment:3 Changed 4 months ago by ballapete (Peter "Pete" Dyballa)

I also have this, which is different:

pete 272 /\ grep postgres /etc/passwd /etc/group 
/etc/passwd:_postgres:*:216:216:PostgreSQL Server:/var/empty:/usr/bin/false
/etc/group:_postgres:*:216:_devicemgr,_calendar,_teamsserver,_xserverdocs

comment:4 Changed 4 months ago by ballapete (Peter "Pete" Dyballa)

It helped to delete the old IDs and let postgresql16-server recreate them.

Note: See TracTickets for help on using tickets.