brew postgresql-upgrade-database fails with initb #60686
Comments
However I have [email protected] linked. Output from brew_config was
What you were trying to do (and why)Running Command output==> Upgrading postgresql data from 11 to 12... waiting for server to start....2020-09-13 07:31:24.237 AEST [22171] LOG: listening on IPv6 address "::1", port 5432 2020-09-13 07:31:24.237 AEST [22171] LOG: listening on IPv4 address "127.0.0.1", port 5432 2020-09-13 07:31:24.238 AEST [22171] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-09-13 07:31:24.247 AEST [22172] LOG: database system was shut down at 2020-09-13 07:31:09 AEST 2020-09-13 07:31:24.251 AEST [22171] LOG: database system is ready to accept connections done server started waiting for server to shut down...2020-09-13 07:31:24.464 AEST [22171] LOG: received fast shutdown request .2020-09-13 07:31:24.466 AEST [22171] LOG: aborting any active transactions 2020-09-13 07:31:24.467 AEST [22171] LOG: background worker "logical replication launcher" (PID 22178) exited with exit code 1 2020-09-13 07:31:24.467 AEST [22173] LOG: shutting down 2020-09-13 07:31:24.475 AEST [22171] LOG: database system is shut down done server stopped ==> Moving postgresql data from /usr/local/var/postgres to /usr/local/var/postgres.old... ==> Creating database... Error: Upgrading postgresql data from 11 to 12 failed! ==> Moving postgresql data back from /usr/local/var/postgres.old to /usr/local/var/postgres... Error: Failure while executing; `/usr/local/Cellar/postgresql/12.4/bin/initdb --lc-collate=en_AU.UTF-8 --lc-ctype=en_AU.UTF-8 --lc-messages=en_AU.UTF-8 --lc-monetary=en_AU.UTF-8 --lc-numeric=en_AU.UTF-8 --lc-time=en_AU.UTF-8 -E\ UTF8 /usr/local/var/postgres` exited with 1. What you expected to happenI expected the version of posgres to be updated to the most recent version 12 and my data migrated from the version 11 format to the version 12 format. Step-by-step reproduction instructions (by running
|
Can you do a |
I did a |
This is on a spare development laptop, so I have the option of fixing it by uninstalling version 11 and installing version 12, and recreating my databases from scratch. I am holding off doing this as it would mean I am not able to reproduce the problem for you. The spare machine is for travel, so just to let you know that I plan to do this next weekend, unless I hear from someone. |
As foreshadowed, my work around for this was to
and all was right with the world. Clearly this means I had to reinitialise all my databases, so is only good for a development machine. |
I have not been able to successfully update my Postgres since 2015. I have lazily just reinitialized my database but know this is a problem vexing another developer on my team so have dug more into it since I currently have a reproducible issue on my machine migrating from 12 --> 13. Shell output of
|
What's the output of |
This predates the existence of this script which means we're unlikely to fix your issue. Closing this out as it's specific to a few users. This script is provided as a helper and is a shallow wrapper around |
I don't think it's specific to a few users. I think any pre-existing Postgres install is affected by this. Simply reinstalling doesn't work either. This is breaking for Postgres 13 if you had 12 in before. |
Reopening but marking |
Thanks @MikeMcQuaid. Understood. I'll try to take a look at it this week. |
I am happy to help debug this as well. I may have some bandwidth Wednesday and Thursday night. |
I attempted to put some work into this but am blocked by the fact that I accidentally lost my old Postgres data directory during other development work. I attempted to recreate a blank postgres + PostGIS database using postesql@12 but there doesn't appear to be a way to link postgis to postgresql@12 in order to create a basic/blank test database for this use case. If there is a trick anyone knows for this, that would help me create a reproducible test case. I can confirm databases that are blank without PostGIS ever installed/enabled work fine with the script, however. If nobody has suggestions then I will likely be able to surface a usable test case again when Postgres 14 is released and can re-visit this. |
So Just to be clear, are you saying that this issue only occurs if at some point PostGis has been used? |
same problem when I upgrade pg from 12 to 13, |
I have the exact same issue when I upgrade pg from 12 to 13 When migrating the existing DB, it fails at the step "Creating dump of database schemas"
I uninstalled / reinstalled postgis without success Thanks for your help ! |
@obromios Apologies for the tardy reply, but yes |
Seeing the same issue as @vdaubry on upgrade from Postgres 12 to 13 and running
|
I now have a working theory about this which is that the old database binary doesn't have a working PostGIS install when the Potential solution paths:
|
I just want to chime in that I have experienced similar problems: postgresql-upgrade-database from 12 to 13 didn't work for me, and after that, my postgresql@12 also got the error "could not access file "$libdir/postgis-3": No such file or directory" and it's unclear to me how I can fix the installation of postgis, for postgreqsl@12 Another similar issue that wasn't linked earlier in this thread: #47077 |
we can downgrade pg to 12.4 and install postgis from source to solve this problem temporally. The solution steps are as follows.
brew edit postgresql
// git diff
diff --git a/Formula/postgresql.rb b/Formula/postgresql.rb
index 863e35f6c14a..f4a641d306da 100644
--- a/Formula/postgresql.rb
+++ b/Formula/postgresql.rb
@@ -1,8 +1,8 @@
class Postgresql < Formula
desc "Object-relational database system"
homepage "https://www.postgresql.org/"
- url "https://ftp.postgresql.org/pub/source/v13.1/postgresql-13.1.tar.bz2"
- sha256 "12345c83b89aa29808568977f5200d6da00f88a035517f925293355432ffe61f"
+ url "https://ftp.postgresql.org/pub/source/v12.4/postgresql-12.4.tar.bz2"
+ sha256 "bee93fbe2c32f59419cb162bcc0145c58da9a8644ee154a30b9a5ce47de606cc"
license "PostgreSQL"
head "https://github.com/postgres/postgres.git"
brew install postgresql
//download postgis
wget https://download.osgeo.org/postgis/source/postgis-3.1.1.tar.gz && tar -zxvf postgis-3.1.1.tar.gz && cd postgis-3.1.1
//generate GUNMakefile
./configure --with-pgconfig=/usr/local/opt/postgresql/bin/pg_config --with-projdir=/usr/local/Cellar/proj/7.2.0 --with-gettext=/usr/local/Cellar/gettext/0.21 --disable-nls --with-jsondir=/usr/local/Cellar/json-c/0.15/ --with-protobufdir=/usr/local/Cellar/protobuf-c/1.3.3_3/ --with-pcredir=/usr/local/Cellar/pcre/8.44
//install
make && make install ps: pay attention to the software version in configure
pg_dump databasename > backup.sql
|
A failing At least for me, after the |
I tried @mnutt approach and built the postgis from my 12 pg_config using modified config options from @shuiqingliu to allow me to copy it to my In the end I wasted too much time trying to save my local test data and created a new data directory. |
Thank you above for the hints.
I tried uninstalling and re-installing postgresql@12, but the config still pointed to the wrong folder.
Proceed to dump and restore to the new pg13 db. |
So following the comments, was able to make postgis work, thanks everybody, especially @smnorris. But needed to point out a slight change I had to do, might be a typo: i noticed I had no postgis directory out the get go, and started to try to understand what I was missing, but took me a while to notice that slight difference in the directory tree, to create the symlink on Edit that might make restoring easier: using brew to install posgres and postgis (from core tap) I was able to do a simple restore using
Where restoring like that was inspired by: @olivierlacan post |
That does look like a typo, sorry for the sabotage |
Bug report
I can now reproduce the problem. Please see post below to see problem in a reproducible format.
brew update
and can still reproduce the problem?On the other hand,
brew update
did not update any postgresl formulae. I have also asked this [question]https://stackoverflow.com/questions/63749141/initb-fails-for-brew-postgresql-upgrade-database) on SO but received no answer.brew doctor
, fixed all issues and can still reproduce the problem?I have run brew doctor and fixed a number of issues, but cannot reproduce the problem (see above).
brew gist-logs <formula>
(where<formula>
is the name of the formula that failed) and included the output link?When I run
brew gist-logs postgresql-upgrade-database
I get this output:Error: No available formula with the name "postgresql-upgrade-database"
brew gist-logs
didn't work: ranbrew config
andbrew doctor
and included their output with your issue?Included brew_config.txt and brew_doctor.txt and brew_doctor1.txt (output of brew doctor after trying to fix issues outlined initial run of brew_doctor
brew_config.txt
temp_brew_doctor.txt
brew_doctor1.txt
temp_brew_update.txt
What you were trying to do (and why)
Running
brew postgresql-upgrade-database
to upgrade database and data from 11.8 to 12What happened (include command output)
Command output
What you expected to happen
I expected the version of posgres to be updated to the most recent version 12 and my data migrated from the version 11 format to the version 12 format.
Step-by-step reproduction instructions (by running
brew install
commands)Just run
brew postgresql-upgrade-database
. This issue looks very similar to this issue.The text was updated successfully, but these errors were encountered: