לא ניתן לשדרג ל-PostgreSQL 15/

Hi, I read this post: PostgreSQL 15 update - 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.

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!

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

Please post the output of these quick diagnostics:

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

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

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

Also for best results read
MKJ’s Opinionated Discourse Deployment Configuration

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.

לייק 1

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

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

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.

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

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.

אז נתקלתי בדיוק באותה שגיאה, רק שאני הפעלתי את הפקודה ./launcher rebuild, לא עקבתי אחרי הפורומים והאזהרות ופשוט הרצתי את העדכון בצורה עיוורת. איך אני יכול להרוג/לבטל את הריצה הזאת? פשוט Ctrl+C כדי לצאת מהריצה?

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

זה הפסיק לעשות משהו אחרי 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).
כיביתי והדלקתי את השרת וזה החזיר את השרת.
מריץ עוד כמה עדכונים עכשיו כשהדוקר תקוע על 20 מסיבה כלשהי ותלות אחרת. איזו דרך טובה לבלות את ערב שישי חחח

באסה.

הייתי מחכה עד יום שני ועובר למכונה וירטואלית חדשה. אני מניח שהנוכחית הזו סיימה את חייה.

הצלחתי לעדכן את מערכת ההפעלה של המארח, את גרסת Docker, ואז עדכון ה-DB עבד, גם נתתי לו יותר RAM חחח צריך להיות טוב לעוד 5 שנים נכון? חחח

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

2 לייקים