[Bug 288992] databases/postgresql16-server: does not restart on package upgrade

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 21 Aug 2025 17:03:45 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288992

            Bug ID: 288992
           Summary: databases/postgresql16-server: does not restart on
                    package upgrade
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: pgsql@FreeBSD.org
          Reporter: wollman@FreeBSD.org
             Flags: maintainer-feedback?(pgsql@FreeBSD.org)
          Assignee: pgsql@FreeBSD.org

When upgrading the postgresql-server package, if HANDLE_RC_SCRIPTS is enabled
in pkg.conf, it is expected that the server will be stopped before the old
package is removed, and indeed this used to happen. Now, the server is not shut
down before upgrading, which causes the restart (after the new package is
installed) to fail.

Partial transcript:

```
[myjail] [95/205] Deleting files for postgresql16-contrib-16.9_1: 100%
[myjail] [96/205] Deinstalling postgresql16-server-16.9_1...
[myjail] [96/205] Deleting files for postgresql16-server-16.9_1: 100%
==> You should manually remove the "pgsql" user
==> You should manually remove the "pgsql" group
[myjail] [97/205] Deinstalling llvm19-19.1.7_1...
...many other packages deleted...
[myjail] [205/205] Installing postgresql16-server-16.10...
===> Creating groups
Using existing group 'pgsql'
===> Creating users
Using existing user 'pgsql'
===> Creating homedir(s)

  =========== BACKUP YOUR DATA! =============
  As always, backup your data before
  upgrading. If the upgrade leads to a higher
  major revision (e.g. 9.6 -> 10), a dump
  and restore of all databases is
  required. This is *NOT* done by the port!
  See https://www.postgresql.org/docs/current/upgrading.html
  ===========================================
[myfail] [205/205] Extracting postgresql16-server-16.10: 100%
start postgresql
pg_ctl: another server might be running; trying to start server anyway
pg_ctl: could not start server
Examine the log output.
```

The server restarts just fine with `service postgresql restatart`.
(Note that we override `PG_USER` et al in `make.conf` when building the package
but this the case before restarting broke. pkg 2.2.2 was installed as a part of
this upgrade.)

-- 
You are receiving this mail because:
You are the assignee for the bug.