Upgrade of postgres failed

I lost access to my installation and it was necessary to launch again, but when I rebuilt the installer I got this error:

    Ensuring launcher is up to date
    Fetching origin
    Launcher is up-to-date
    Stopping old container
    + /usr/bin/docker stop -t 60 app
    app
    cd /pups && git pull && /pups/bin/pups --stdin
    Already up to date.
    I, [2020-09-25T19:47:06.304404 #1]  INFO -- : Loading --stdin
    I, [2020-09-25T19:47:06.309199 #1]  INFO -- : > locale-gen $LANG && update-locale
    I, [2020-09-25T19:47:06.340351 #1]  INFO -- : Generating locales (this might take a while)...
    Generation complete.

    I, [2020-09-25T19:47:06.340628 #1]  INFO -- : > mkdir -p /shared/postgres_run
    I, [2020-09-25T19:47:06.343723 #1]  INFO -- :
    I, [2020-09-25T19:47:06.343934 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run
    I, [2020-09-25T19:47:06.346317 #1]  INFO -- :
    I, [2020-09-25T19:47:06.346499 #1]  INFO -- : > chmod 775 /shared/postgres_run
    I, [2020-09-25T19:47:06.348438 #1]  INFO -- :
    I, [2020-09-25T19:47:06.348620 #1]  INFO -- : > rm -fr /var/run/postgresql
    I, [2020-09-25T19:47:06.350928 #1]  INFO -- :
    I, [2020-09-25T19:47:06.351051 #1]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
    I, [2020-09-25T19:47:06.353002 #1]  INFO -- :
    I, [2020-09-25T19:47:06.353156 #1]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
    2020/09/25 19:47:06 socat[26] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
    I, [2020-09-25T19:47:06.357605 #1]  INFO -- :
    I, [2020-09-25T19:47:06.357757 #1]  INFO -- : > rm -fr /shared/postgres_run/.s*
    I, [2020-09-25T19:47:06.360637 #1]  INFO -- :
    I, [2020-09-25T19:47:06.360777 #1]  INFO -- : > rm -fr /shared/postgres_run/*.pid
    I, [2020-09-25T19:47:06.363695 #1]  INFO -- :
    I, [2020-09-25T19:47:06.363840 #1]  INFO -- : > mkdir -p /shared/postgres_run/12-main.pg_stat_tmp
    I, [2020-09-25T19:47:06.366202 #1]  INFO -- :
    I, [2020-09-25T19:47:06.366392 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run/12-main.pg_stat_tmp
    I, [2020-09-25T19:47:06.368667 #1]  INFO -- :
    I, [2020-09-25T19:47:06.373532 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown:
    I, [2020-09-25T19:47:06.378089 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown:
    I, [2020-09-25T19:47:06.382828 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown:
    I, [2020-09-25T19:47:06.387764 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown:
    I, [2020-09-25T19:47:06.388395 #1]  INFO -- : > chown -R root /var/lib/postgresql/12/main
    I, [2020-09-25T19:47:07.374399 #1]  INFO -- :
    I, [2020-09-25T19:47:07.374581 #1]  INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/12/bin/initdb -D /shared/postgres_data || exit 0
    I, [2020-09-25T19:47:07.376827 #1]  INFO -- :
    I, [2020-09-25T19:47:07.376954 #1]  INFO -- : > chown -R postgres:postgres /shared/postgres_data
    I, [2020-09-25T19:47:07.394008 #1]  INFO -- :
    I, [2020-09-25T19:47:07.394177 #1]  INFO -- : > chown -R postgres:postgres /var/run/postgresql
    I, [2020-09-25T19:47:07.396745 #1]  INFO -- :
    I, [2020-09-25T19:47:07.397024 #1]  INFO -- : > /root/upgrade_postgres
    initdb: warning: enabling "trust" authentication for local connections
    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.
    debconf: delaying package configuration, since apt-utils is not installed
    I, [2020-09-25T19:47:16.037143 #1]  INFO -- : Upgrading PostgreSQL from version 10 to 12
    The files belonging to this database system will be owned by user "postgres".
    This user must also own the server process.

    The database cluster will be initialized with locale "en_US.UTF-8".
    The default database encoding has accordingly been set to "UTF8".
    The default text search configuration will be set to "english".

    Data page checksums are disabled.

    fixing permissions on existing directory /shared/postgres_data_new ... ok
    creating subdirectories ... ok
    selecting dynamic shared memory implementation ... posix
    selecting default max_connections ... 100
    selecting default shared_buffers ... 128MB
    selecting default time zone ... Etc/UTC
    creating configuration files ... ok
    running bootstrap script ... ok
    performing post-bootstrap initialization ... ok
    syncing data to disk ... ok


    Success. You can now start the database server using:

        /usr/lib/postgresql/12/bin/pg_ctl -D /shared/postgres_data_new -l logfile start

    Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
    Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
    Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
    Get:4 https://deb.nodesource.com/node_10.x buster InRelease [4,584 B]
    Get:5 http://apt.postgresql.org/pub/repos/apt buster-pgdg InRelease [103 kB]
    Get:6 http://security.debian.org/debian-security buster/updates/main amd64 Packages [233 kB]
    Get:7 http://deb.debian.org/debian buster/main amd64 Packages [7,906 kB]
    Get:8 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages [202 kB]
    Get:9 https://deb.nodesource.com/node_10.x buster/main amd64 Packages [765 B]
    Fetched 8,690 kB in 2s (5,357 kB/s)
    Reading package lists...
    Reading package lists...
    Building dependency tree...
    Reading state information...
    The following additional packages will be installed:
      postgresql-client-10
    Suggested packages:
      postgresql-doc-10
    The following NEW packages will be installed:
      postgresql-10 postgresql-client-10
    0 upgraded, 2 newly installed, 0 to remove and 27 not upgraded.
    Need to get 6,401 kB of archives.
    After this operation, 30.6 MB of additional disk space will be used.
    Get:1 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 postgresql-client-10 amd64 10.14-1.pgdg100+1 [1,433 kB]
    Get:2 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 postgresql-10 amd64 10.14-1.pgdg100+1 [4,968 kB]
    Fetched 6,401 kB in 0s (23.9 MB/s)
    Selecting previously unselected package postgresql-client-10.
    (Reading database ... 43893 files and directories currently installed.)
    Preparing to unpack .../postgresql-client-10_10.14-1.pgdg100+1_amd64.deb ...
    Unpacking postgresql-client-10 (10.14-1.pgdg100+1) ...
    Selecting previously unselected package postgresql-10.
    Preparing to unpack .../postgresql-10_10.14-1.pgdg100+1_amd64.deb ...
    Unpacking postgresql-10 (10.14-1.pgdg100+1) ...
    Setting up postgresql-client-10 (10.14-1.pgdg100+1) ...
    update-alternatives: warning: forcing reinstallation of alternative /usr/share/postgresql/12/man/man1/psql.1.gz because link group psql.1.gz is broken
    Setting up postgresql-10 (10.14-1.pgdg100+1) ...
    Creating new PostgreSQL cluster 10/main ...
    /usr/lib/postgresql/10/bin/initdb -D /var/lib/postgresql/10/main --auth-local peer --auth-host md5
    The files belonging to this database system will be owned by user "postgres".
    This user must also own the server process.

    The database cluster will be initialized with locale "C.UTF-8".
    The default database encoding has accordingly been set to "UTF8".
    The default text search configuration will be set to "english".

    Data page checksums are disabled.

    fixing permissions on existing directory /var/lib/postgresql/10/main ... ok
    creating subdirectories ... ok
    selecting default max_connections ... 100
    selecting default shared_buffers ... 128MB
    selecting default timezone ... Etc/UTC
    selecting dynamic shared memory implementation ... posix
    creating configuration files ... ok
    running bootstrap script ... ok
    performing post-bootstrap initialization ... ok
    syncing data to disk ... ok

    Success. You can now start the database server using:

        pg_ctlcluster 10 main start

    Warning: The selected stats_temp_directory /var/run/postgresql/10-main.pg_stat_tmp
    is not writable for the cluster owner. Not adding this setting in
    postgresql.conf.
    Ver Cluster Port Status Owner    Data directory              Log file
    10  main    5433 down   postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log
    update-alternatives: warning: forcing reinstallation of alternative /usr/share/postgresql/12/man/man1/postmaster.1.gz because link group postmaster.1.gz is broken
    invoke-rc.d: could not determine current runlevel
    invoke-rc.d: policy-rc.d denied execution of start.
    Processing triggers for postgresql-common (215.pgdg100+1) ...
    Building PostgreSQL dictionaries from installed myspell/hunspell packages...
    Removing obsolete dictionary files:
    Stopping PostgreSQL 10 database server: main.
    Stopping PostgreSQL 12 database server: main.
    Performing Consistency Checks
    -----------------------------
    Checking cluster versions                                   ok

    The source cluster was not shut down cleanly.
    Failure, exiting
    -------------------------------------------------------------------------------------
    UPGRADE OF POSTGRES FAILED

    Please visit https://meta.discourse.org/t/postgresql-12-update/151236 for support

    You can run ./launcher start app to restart your app in the meanwhile

The site is not able, show 502 Bad Gateway.

Visiting that URL, there is a FAQ entry for it:

2 Likes