package upgrades broken after using the gitlab-ctl pg_upgrade command
If you have used the pg_upgrade command to upgrade the database to postgresql 9.6, upgrading gitlab to the next version will fail (unless they are skipping auto-migrations).
This i because the new package overrides the upgraded symlink, then tries to start the database before running reconfigure. But starting the database will fail because it is trying to start postgres 9.2 on postgres 9.6 data.
Shutting down all GitLab services except those needed for migrations
ok: down: gitlab-workhorse: 0s, normally up
ok: down: logrotate: 0s, normally up
ok: down: nginx: 1s, normally up
ok: down: postgresql: 1s, normally up
ok: down: redis: 0s, normally up
ok: down: sidekiq: 0s, normally up
ok: down: unicorn: 1s, normally up
timeout: down: postgresql: 0s, normally up, want up
ok: run: redis: (pid 26381) 1s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1704s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1705s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1706s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1707s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1708s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1709s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1710s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1711s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1712s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1713s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1714s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1715s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1716s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1717s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1718s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1719s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1720s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1721s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1722s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1723s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1724s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1725s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1726s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1727s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1728s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1729s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1730s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1731s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1732s
down: postgresql: 1s, normally up, want up; run: log: (pid 13427) 1733s
Failed to start postgresql for migrations
dpkg: error processing package gitlab-ce (--install):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
gitlab-ce
Manual fix once you are in this state is to run sudo gitlab-ctl reconfigure
and then rerun the package scripts. debian example: sudo dpkg --configure -a