# Problem with upgrading the latest version

**URL:** https://meta.discourse.org/t/problem-with-upgrading-the-latest-version/154774
**Category:** Self-hosting
**Created:** [June 13, 2020, 9:59pm UTC](https://meta.discourse.org/t/problem-with-upgrading-the-latest-version/154774 "2020-06-13T21:59:58Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![bekircem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bekircem/32/44582_2.png) [@bekircem](https://meta.discourse.org/u/bekircem)
#### Post date: [June 13, 2020, 9:59pm UTC](https://meta.discourse.org/t/problem-with-upgrading-the-latest-version/154774/1 "2020-06-13T21:59:59Z")

</div>

Hi, I am trying to update Discourse to the latest version.

```
FAILED
--------------------
Pups::ExecError: /root/upgrade_postgres failed with return #<Process::Status: pid 45 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params "/root/upgrade_postgres"
1cafe54cd6661316d8e9e393c54f73ab89bc3f5e70e104f6c5e4f8794053c09c
**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

```

Also

```
 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 (213.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

```

Output of` tail -f shared/standalone/log/var-log/postgres/current` command:

```
2020-06-14 01:37:02.155 UTC [3508] FATAL: data directory "/shared/postgres_data" has wrong ownership
2020-06-14 01:37:02.155 UTC [3508] HINT: The server must be started by the user that owns the data directory.

```

> [@PostgreSQL 12 update](https://meta.discourse.org/t/postgresql-12-update/151236/1):
>
> ## Postponing the update
> 
> If you need to postpone the update during your next rebuild, you can swap the PostgreSQL template on your app.yml file by changing `"templates/postgres.template.yml"` to `"templates/postgres.10.template.yml"` .
> 
> This is not recommended, as some site admins will forget to revert the change afterwards.

> ## Postponing the update
> 
> If you need to postpone the update during your next rebuild, you can swap the PostgreSQL template on your app.yml file by changing `"templates/postgres.template.yml"` to `"templates/postgres.10.template.yml"` .
> 
> This is not recommended, as some site admins will forget to revert the change afterwards.

**I applied this and the Discourse forum is now online. What can we do next?** Currently, I am using “templates/postgres.10.template.yml”

---

<div class="post-metadata">

### Author: ![bekircem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bekircem/32/44582_2.png) [@bekircem](https://meta.discourse.org/u/bekircem)
#### Post date: [June 15, 2020, 8:06pm UTC](https://meta.discourse.org/t/problem-with-upgrading-the-latest-version/154774/2 "2020-06-15T20:06:37Z")

</div>

Any ideas? I am still using “templates/postgres.10.template.yml".

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [June 22, 2020, 5:27pm UTC](https://meta.discourse.org/t/problem-with-upgrading-the-latest-version/154774/3 "2020-06-22T17:27:44Z")

</div>

Try the following:

1. Edit the app.yml and change `"templates/postgres.10.template.yml"` to `"templates/postgres.template.yml"` .

2. Issue a stop: `./launcher stop app`

3. Try a rebuild `./launcher rebuild app`

---

<div class="post-metadata">

### Author: ![bekircem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bekircem/32/44582_2.png) [@bekircem](https://meta.discourse.org/u/bekircem)
#### Post date: [June 22, 2020, 9:49pm UTC](https://meta.discourse.org/t/problem-with-upgrading-the-latest-version/154774/4 "2020-06-22T21:49:42Z")

</div>

```
Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
    ./analyze_new_cluster.sh

Running this script will delete the old cluster's data files:
    ./delete_old_cluster.sh
-------------------------------------------------------------------------------------
UPGRADE OF POSTGRES COMPLETE

Old 10 database is stored at /shared/postgres_data_old

To complete the upgrade, rebuild again using:

./launcher rebuild app

```

And Discourse forum offline at this time.

I am trying ./launcher rebuild app again as said above.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [June 22, 2020, 9:56pm UTC](https://meta.discourse.org/t/problem-with-upgrading-the-latest-version/154774/5 "2020-06-22T21:56:27Z")

</div>

> [@bekircem](#):
>
> And Discourse forum offline at this time.

Yes that is expected.

> [@bekircem](#):
>
> I am trying ./launcher rebuild app again as said above.

Yeah, follow the instructions and it should be back soon.

---

<div class="post-metadata">

### Author: ![bekircem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bekircem/32/44582_2.png) [@bekircem](https://meta.discourse.org/u/bekircem)
#### Post date: [June 22, 2020, 9:58pm UTC](https://meta.discourse.org/t/problem-with-upgrading-the-latest-version/154774/6 "2020-06-22T21:58:01Z")

</div>

Interesting and awesome, now the update has been successfully completed. I have tried the same way many times before, but it never happened.

Do I need to use the following commands to clear the space?

```
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
    ./analyze_new_cluster.sh

Running this script will delete the old cluster's data files:
    ./delete_old_cluster.sh

```

Thank you!

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [June 22, 2020, 9:59pm UTC](https://meta.discourse.org/t/problem-with-upgrading-the-latest-version/154774/7 "2020-06-22T21:59:22Z")

</div>

> [@bekircem](#):
>
> Do I need to use the following commands to clear the space?

You can run the [Post update optional tasks](https://meta.discourse.org/t/postgresql-12-update/151236#post-update-optional-tasks) listed in our FAQ.

---

<div class="post-metadata">

### Author: ![bekircem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bekircem/32/44582_2.png) [@bekircem](https://meta.discourse.org/u/bekircem)
#### Post date: [June 22, 2020, 10:03pm UTC](https://meta.discourse.org/t/problem-with-upgrading-the-latest-version/154774/8 "2020-06-22T22:03:31Z")

</div>

Wonderful. Thanks again!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [July 22, 2020, 10:03pm UTC](https://meta.discourse.org/t/problem-with-upgrading-the-latest-version/154774/9 "2020-07-22T22:03:31Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
