# Upgrade from postgres 13 to 15 failing - currently means forum is unavailable

**URL:** https://meta.discourse.org/t/upgrade-from-postgres-13-to-15-failing-currently-means-forum-is-unavailable/357028
**Category:** Support
**Tags:** postgres
**Created:** [March 12, 2025, 8:56pm UTC](https://meta.discourse.org/t/upgrade-from-postgres-13-to-15-failing-currently-means-forum-is-unavailable/357028 "2025-03-12T20:56:59Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![tanya\_byrne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tanya_byrne/32/444826_2.png) [@tanya\_byrne](https://meta.discourse.org/u/tanya_byrne)
#### Post date: [March 12, 2025, 8:56pm UTC](https://meta.discourse.org/t/upgrade-from-postgres-13-to-15-failing-currently-means-forum-is-unavailable/357028/1 "2025-03-12T20:56:59Z")

</div>

Hi all,

I am getting the below error when trying to run a rebuild to upgrade to most recent test-passed. This would include bumping the postgres version from 13 to 15.

```plaintext
[2025-03-12T20:49:22.045226 #1] INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres peer in /etc/postgresql/15/main/pg_hba.conf
I, [2025-03-12T20:49:22.045431 #1] INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/15/main/pg_hba.conf
I, [2025-03-12T20:49:22.045624 #1] INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/15/main/pg_hba.conf
I, [2025-03-12T20:49:22.045816 #1] INFO -- : > if [-f /root/install_postgres]; then
  /root/install_postgres && rm -f /root/install_postgres
elif [-e /shared/postgres_run/.s.PGSQL.5432]; then
  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
fi

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
W: https://dl.yarnpkg.com/debian/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
debconf: delaying package configuration, since apt-utils is not installed
cp: cannot stat '/etc/postgresql/13/main/*': No such file or directory

```

The script just becomes stuck at this copy command.

When I try to restart the forum, restart command completes successfully but the forum is showing “connection refused”.

How do I either rollback to use my backup in postgres 13 or move forward? Thanks

---

<div class="post-metadata">

### Author: ![Andrew\_Rowe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrew_rowe/32/445877_2.png) [@Andrew\_Rowe](https://meta.discourse.org/u/Andrew_Rowe)
#### Post date: [March 12, 2025, 10:48pm UTC](https://meta.discourse.org/t/upgrade-from-postgres-13-to-15-failing-currently-means-forum-is-unavailable/357028/3 "2025-03-12T22:48:21Z")

</div>

Until smarter folks show up to help go to this topic about the postgres upgrade

> [@PostgreSQL 15 update](https://meta.discourse.org/t/postgresql-15-update/349515):
>
> warning WARNING! If your database is very large, you will need a lot of extra disk space (2x database size) and should be very careful with this upgrade! We’ve just landed changes to upgrade our Docker image to PostgreSQL 15. Any site admins rebuilding Discourse from the command line will be upgraded to PostgreSQL 15 from the previous PostgreSQL 13. Note that if you held back from upgrading when the PostgreSQL 13 update [happened back in 2020](https://meta.discourse.org/t/postgresql-13-update/172563), you can skip that upgrade and go straight to P…

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [March 12, 2025, 10:49pm UTC](https://meta.discourse.org/t/upgrade-from-postgres-13-to-15-failing-currently-means-forum-is-unavailable/357028/4 "2025-03-12T22:49:15Z")

</div>

You could just create a completely new server and import the back up.

---

<div class="post-metadata">

### Author: ![tanya\_byrne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tanya_byrne/32/444826_2.png) [@tanya\_byrne](https://meta.discourse.org/u/tanya_byrne)
#### Post date: [March 12, 2025, 11:09pm UTC](https://meta.discourse.org/t/upgrade-from-postgres-13-to-15-failing-currently-means-forum-is-unavailable/357028/5 "2025-03-12T23:09:37Z")

</div>

I want to avoid this if possible

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 13, 2025, 12:39am UTC](https://meta.discourse.org/t/upgrade-from-postgres-13-to-15-failing-currently-means-forum-is-unavailable/357028/6 "2025-03-13T00:39:58Z")

</div>

It’s the easiest solution.

Restart the old container. You’ll have your forum. You can get the new server working at your leisure.

---

<div class="post-metadata">

### Author: ![tanya\_byrne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tanya_byrne/32/444826_2.png) [@tanya\_byrne](https://meta.discourse.org/u/tanya_byrne)
#### Post date: [March 13, 2025, 12:42am UTC](https://meta.discourse.org/t/upgrade-from-postgres-13-to-15-failing-currently-means-forum-is-unavailable/357028/7 "2025-03-13T00:42:39Z")

</div>

The restart container could not run because it was in an intermittent state between database versions. I have deleted the postgres\_data folder and now am restoring from backup

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [March 13, 2025, 1:17am UTC](https://meta.discourse.org/t/upgrade-from-postgres-13-to-15-failing-currently-means-forum-is-unavailable/357028/8 "2025-03-13T01:17:46Z")

</div>

What are your server specs? If using Ubuntu LTS what version is your server?

---

<div class="post-metadata">

### Author: ![mwaniki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mwaniki/32/313097_2.png) [@mwaniki](https://meta.discourse.org/u/mwaniki)
#### Post date: [March 13, 2025, 11:00am UTC](https://meta.discourse.org/t/upgrade-from-postgres-13-to-15-failing-currently-means-forum-is-unavailable/357028/9 "2025-03-13T11:00:33Z")

</div>

> [@tanya\_byrne](#):
>
> now am restoring from backup

Were you able to restore the site?

> [@Heliosurge](#):
>
> If using Ubuntu LTS what version is your server?

If you’re indeed running an older OS and Docker version, I recommend updating both _before_ retrying the rebuild.

> [@tanya\_byrne](#):
>
> The script just becomes stuck

Were you perhaps updating a [large database](https://meta.discourse.org/t/postgresql-stuck-during-rebuilding/323434/38)? If so, it’s possible that the update was still running. During the rebuild, you can periodically compare the size of the `postgres_data` and `postgres_data_new` directories. If the size of `postgres_data_new` keeps growing, the update is still ongoing. (You can also confirm whether the `pg_upgrade` command is running from the process list.)

* * *

> [@tanya\_byrne](#):
>
> ```plaintext
> cp: cannot stat '/etc/postgresql/13/main/*': No such file or directory
> 
> ```

You may ignore that `cp` error for now. I was able to update a test site on a [standard install](https://meta.discourse.org/t/142537?silent=true) even with the same error. (It was caused by [an upstream change](https://salsa.debian.org/postgresql/postgresql-common/-/commit/d9139f7777a42a39b5b6fabbffc9f020fad4dce5) so we’ll fix the image to remove the error, but it should not break the database updates unless the postgres configs were significantly modified beforehand.)

---

<div class="post-metadata">

### Author: ![tanya\_byrne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tanya_byrne/32/444826_2.png) [@tanya\_byrne](https://meta.discourse.org/u/tanya_byrne)
#### Post date: [March 13, 2025, 4:10pm UTC](https://meta.discourse.org/t/upgrade-from-postgres-13-to-15-failing-currently-means-forum-is-unavailable/357028/10 "2025-03-13T16:10:31Z")

</div>

Hi there,

yes I was able to restore the site. We were indeed updating a large database, but I was keeping an eye on the above directories to ensure postgres\_data\_new was growing. After a time it did not grow further, and the script just became stuck on this command

Our config was pretty standard, apart from the large size of the db. I’ll get the details together and will post these details later today.
