# Unable to upgrade to PostgreSQL 15/

**URL:** https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397
**Category:** Self-hosting
**Created:** [February 25, 2025, 12:04pm UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397 "2025-02-25T12:04:33Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![glorioustn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/glorioustn/32/490858_2.png) [@glorioustn](https://meta.discourse.org/u/glorioustn)
#### Post date: [February 25, 2025, 12:04pm UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/1 "2025-02-25T12:04:33Z")

</div>

Hi, I read this post: [PostgreSQL 15 update](https://meta.discourse.org/t/postgresql-15-update/349515) - and tried to upgrade to version 15, however when running the rebuild command, I’m running into errors that I’m unfamiliar with, and non of my research has solved the issue. I would appreciate any help I can get here.

It complains about both Locale and postgres being initialized from version 13, and is not compatible with 15.

```plaintext
WARNING: Docker version 20.10.7 deprecated, recommend upgrade to 24.0.7 or newer.
x86_64 arch detected.
WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 600 app
app
2.0.20250129-0720: Pulling from discourse/base
Digest: sha256:01b8516e5504c0e9bc3707773015ff4407be03a89154194ff3b5b8699291bc26
Status: Image is up to date for discourse/base:2.0.20250129-0720
docker.io/discourse/base:2.0.20250129-0720
/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2025-02-25T12:02:47.588312 #1] INFO -- : Reading from stdin
I, [2025-02-25T12:02:47.603317 #1] INFO -- : File > /etc/service/postgres/run chmod: +x chown:
I, [2025-02-25T12:02:47.608602 #1] INFO -- : File > /etc/service/postgres/log/run chmod: +x chown:
I, [2025-02-25T12:02:47.614271 #1] INFO -- : File > /etc/runit/3.d/99-postgres chmod: +x chown:
I, [2025-02-25T12:02:47.619607 #1] INFO -- : File > /root/install_postgres chmod: +x chown:
I, [2025-02-25T12:02:47.623993 #1] INFO -- : File > /root/upgrade_postgres chmod: +x chown:
I, [2025-02-25T12:02:47.624696 #1] INFO -- : Replacing data_directory = '/var/lib/postgresql/15/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.628520 #1] INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.629701 #1] INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.635680 #1] INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.636635 #1] INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.637658 #1] INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.638584 #1] INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.639215 #1] INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.639833 #1] INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.640892 #1] INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres peer in /etc/postgresql/15/main/pg_hba.conf
I, [2025-02-25T12:02:47.641570 #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-02-25T12:02:47.642114 #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-02-25T12:02:47.642818 #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

failed to set locale!
[error] character map file `UTF-8' not found: No such file or directory
failed to set locale!
[error] default character map file `ANSI_X3.4-1968' not found: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US.UTF-8",
        LC_ALL = "en_US.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
popen failure: Cannot allocate memory
initdb: error: program "postgres" is needed by initdb but was not found in the same directory as "/usr/lib/postgresql/15/bin/initdb"
I, [2025-02-25T12:02:49.979779 #1] INFO -- : Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
Upgrading PostgreSQL from version 13 to 15

I, [2025-02-25T12:02:49.980481 #1] INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/15/bin/postmaster -D /etc/postgresql/15/main
I, [2025-02-25T12:02:49.983148 #1] INFO -- : Terminating async processes
2025-02-25 12:02:50.007 UTC [51] FATAL: database files are incompatible with server
2025-02-25 12:02:50.007 UTC [51] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 15.10 (Debian 15.10-1.pgdg120+1).

```

Thank you in advance!

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [February 25, 2025, 12:50pm UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/2 "2025-02-25T12:50:18Z")

</div>

> [@glorioustn](#):
>
> ```plaintext
> popen failure: Cannot allocate memory
> 
> ```

This is perhaps the most serious - you need more RAM or you need to add swap.

Please post the output of these quick diagnostics:

> [@Failed to bootstrap on first install](https://meta.discourse.org/t/failed-to-bootstrap-on-first-install/295475/6):
>
> ```plaintext
> cat /etc/lsb-release
> uptime
> df -h /
> free
> swapon
> vmstat 5 5
> dmesg|egrep -i "memory|oom|kill"
> ps auxrc
> 
> ```

---

<div class="post-metadata">

### Author: ![glorioustn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/glorioustn/32/490858_2.png) [@glorioustn](https://meta.discourse.org/u/glorioustn)
#### Post date: [February 25, 2025, 1:29pm UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/3 "2025-02-25T13:29:49Z")

</div>

Thanks for taking the time. I completely missed that memory thing, here’s the results you asked for:

```plaintext
root@glorious-discourse-forum:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
root@glorious-discourse-forum:~# uptime
 13:27:58 up 1341 days, 22:37, 2 users, load average: 0.07, 0.03, 0.00
root@glorious-discourse-forum:~# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 49G 41G 7.7G 85% /
root@glorious-discourse-forum:~# free
              total used free shared buff/cache available
Mem: 2040976 416492 436628 20940 1187856 1433788
Swap: 2097148 85248 2011900
root@glorious-discourse-forum:~# swapon
NAME TYPE SIZE USED PRIO
/swapfile file 2G 83.3M -2
root@glorious-discourse-forum:~# vmstat 5 5
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r b swpd free buff cache si so bi bo in cs us sy id wa st
 0 0 85248 436692 444416 743440 8 8 268 88 0 0 3 1 96 0 0
 0 0 85248 436684 444416 743440 0 0 0 0 50 87 0 0 100 0 0
 0 0 85248 436716 444416 743440 0 0 0 8 48 78 0 0 100 0 0
 0 0 85248 436716 444416 743440 0 0 0 6 39 63 0 0 100 0 0
 0 0 85248 436716 444416 743440 0 0 0 0 54 91 0 0 100 0 0
root@glorious-discourse-forum:~# dmesg|egrep -i "memory|oom|kill"
root@glorious-discourse-forum:~# ps auxrc
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 5781 0.0 0.1 40100 3332 pts/6 R+ 13:28 0:00 ps

```

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [February 25, 2025, 1:50pm UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/4 "2025-02-25T13:50:45Z")

</div>

Thanks. I think you could try just adding 2G or 4G of swap. But the message about out of date Docker, and the running of 18.04LTS, means you’d be in a much better position if you migrate to a new instance with a fresh new OS installation: 24.04 preferably. I run both 24.04 and 22.04 at present.

Migrating to a new fresh instance is probably less effort overall than trying to upgrade in place. It might even be less disruptive. You are very likely to have a bit of downtime whatever you do.

Step 1 is to take a backup (with downloads) and download it for safe keeping. Also take a copy of your app.yml file.

I did a migration yesterday, for similar reasons. Also, I could get a better machine for the same cost by switching to a newer offering from the hosting provider.

I followed the migration recipe and tips here  
[Steps involved to downgrade from 2GB to 1GB on DO? - #3 by merefield](https://meta.discourse.org/t/steps-involved-to-downgrade-from-2gb-to-1gb-on-do/265056/3)

Also for best results read  
[MKJ’s Opinionated Discourse Deployment Configuration](https://meta.discourse.org/t/mkjs-opinionated-discourse-deployment-configuration/193355)

You are a little short of disk space too, especially if you add swap. I usually do  
`du -kx / | sort -n | tail -55`  
or similar to see if there’s anything large that need not be there.

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [February 25, 2025, 4:04pm UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/5 "2025-02-25T16:04:27Z")

</div>

Oh, another approach to migration, instead of backup and restore, is to use rsync. I haven’t done it, but here’s a recipe:  
[Move a Discourse site to another VPS with rsync](https://meta.discourse.org/t/move-a-discourse-site-to-another-vps-with-rsync/43812)

---

<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: [February 25, 2025, 4:22pm UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/6 "2025-02-25T16:22:52Z")

</div>

The other issue is your Docker version and OS need upgrading.

> [@glorioustn](#):
>
> `WARNING: Docker version 20.10.7 deprecated, recommend upgrade to 24.0.7 or newer`

The Docker version 24.0.7 or newer requires a higher Ubuntu LTS than 18. The long term service on that LTS is out support.

---

<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: [February 25, 2025, 5:48pm UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/7 "2025-02-25T17:48:06Z")

</div>

> [@glorioustn](#):
>
> ```plaintext
> WARNING: Docker version 20.10.7 deprecated, recommend upgrade to 24.0.7 or newer.
> 
> ```

> [@Ed\_S](#):
>
> But the message about out of date Docker, and the running of 18.04LTS, means you’d be in a much better position if you migrate to a new instance with a fresh new OS installation

I’ve seen a few sites get upgraded with 18.04, but most of them haven’t.

> [@Ed\_S](#):
>
> Migrating to a new fresh instance is probably less effort overall than trying to upgrade in place.

I’ve seen people manage to do a `dist-upgrade`, but it’s success is uncertain, and do you really want remnants of your 6 year old OS potentially causing issues for the next 5 years that 24.04 is supported? Also, an upgrade of 18.04 gets you only to 20.04, which is good for about another 60 days, so you’d need to run 3 dist-upgrades to get to the latest OS.

---

<div class="post-metadata">

### Author: ![FireAllianceNX](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firealliancenx/32/141959_2.png) [@FireAllianceNX](https://meta.discourse.org/u/FireAllianceNX)
#### Post date: [May 30, 2025, 7:13pm UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/8 "2025-05-30T19:13:57Z")

</div>

So I ran into this same exact error except I ran ./launcher rebuild, I hadn’t been following the forums and warnings and kinda just blindly ran the update. How do I kill/revert this run? Just Ctrl+C out of the run?

---

<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: [May 31, 2025, 12:40am UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/9 "2025-05-31T00:40:37Z")

</div>

What happened? Was there an error? Did it say to run the rebuild again?

Did you upgrade docker?

Did you try

```
 ./launcher start app

```

Did you look at [PostgreSQL 15 update](https://meta.discourse.org/t/postgresql-15-update/349515)

---

<div class="post-metadata">

### Author: ![FireAllianceNX](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firealliancenx/32/141959_2.png) [@FireAllianceNX](https://meta.discourse.org/u/FireAllianceNX)
#### Post date: [May 31, 2025, 12:44am UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/10 "2025-05-31T00:44:56Z")

</div>

it stopped doing anything after `DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 15.10 (Debian 15.10-1.pgdg120+1).`  
I power cycled the server and that brought the server back.  
Running some more updates now with Docker being stuck on 20 for reason and other dependency. What a good way to spend Friday night haha

---

<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: [May 31, 2025, 1:39am UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/11 "2025-05-31T01:39:42Z")

</div>

Bummer.

I would wait until Monday and move to a new vm. I’m guessing this one is beyond end of life

---

<div class="post-metadata">

### Author: ![FireAllianceNX](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firealliancenx/32/141959_2.png) [@FireAllianceNX](https://meta.discourse.org/u/FireAllianceNX)
#### Post date: [June 3, 2025, 1:56pm UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/12 "2025-06-03T13:56:43Z")

</div>

I was able to update the host OS, the Docker version, and then DB update worked, I also gave it more RAM lol should be good for another 5 years right? haha

---

<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: [June 3, 2025, 1:59pm UTC](https://meta.discourse.org/t/unable-to-upgrade-to-postgresql-15/354397/13 "2025-06-03T13:59:30Z")

</div>

> [@FireAllianceNX](#):
>
> should be good for another 5 years right?

If you do OS upgrades (especially docker), probably so!
