# Trouble with postgre（maybe）

**URL:** https://meta.discourse.org/t/trouble-with-postgre-maybe/160605
**Category:** Self-hosting
**Created:** [August 12, 2020, 9:26am UTC](https://meta.discourse.org/t/trouble-with-postgre-maybe/160605 "2020-08-12T09:26:33Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![endless\_Lin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/endless_lin/32/189927_2.png) [@endless\_Lin](https://meta.discourse.org/u/endless_Lin)
#### Post date: [August 12, 2020, 9:26am UTC](https://meta.discourse.org/t/trouble-with-postgre-maybe/160605/1 "2020-08-12T09:26:33Z")

</div>

Here’s where I got the discourse setup script  
[GitHub - discourse/discourse\_docker: A Docker image for Discourse · GitHub](https://github.com/discourse/discourse_docker.git) /var/discourse

and it runs good when creating a new discourse instance.

But problem comes when I tried to rebuild app with my old discourse data.

Here’s part of the log:

```plaintext
**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**
 **postgresql.conf.**
 **is not writable for the cluster owner. Not adding this setting in**
 **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**

**FAILED**
 **--------------------**
 **Pups::ExecError: /root/upgrade_postgres failed with return #<Process::Status: pid 47 exit 1>**
 **Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'**
 **exec failed with the params "/root/upgrade_postgres"**
 **43aeccc15b54cbb03c8d665c755aa666012088aaeb8bbd7437faf68d70c28634**
 ****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.**
```

---

<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: [August 12, 2020, 2:04pm UTC](https://meta.discourse.org/t/trouble-with-postgre-maybe/160605/2 "2020-08-12T14:04:02Z")

</div>

> [@endless\_Lin](#):
>
> **postgresql.conf.**  
> **is not writable for the cluster owner.**

Looks like a permissions problem.

> [@endless\_Lin](#):
>
> Please visit [PostgreSQL 12 update](https://meta.discourse.org/t/postgresql-12-update/151236) for support

Did you look at that topic for clues?

Is this data that you moved from another server? Is that server working? Can you take a backup and restore it to the new server?

---

<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: [August 12, 2020, 3:25pm UTC](https://meta.discourse.org/t/trouble-with-postgre-maybe/160605/3 "2020-08-12T15:25:01Z")

</div>

> [@endless\_Lin](#):
>
> The source cluster was not shut down cleanly.

There is a FAQ entry just for this problem in the linked topic, please follow the instructions:

> [@PostgreSQL 12 update](https://meta.discourse.org/t/postgresql-12-update/151236/1):
>
> ## FAQ
> 
> ### The source cluster was not shut down cleanly
> 
> If you get a upgrade failed with the above message, you can try a simpler approach to get it back into a better state.
> 
> Restart the old container with `./launcher start app` . Wait a few minutes until it is back up.

---

<div class="post-metadata">

### Author: ![endless\_Lin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/endless_lin/32/189927_2.png) [@endless\_Lin](https://meta.discourse.org/u/endless_Lin)
#### Post date: [August 13, 2020, 2:07am UTC](https://meta.discourse.org/t/trouble-with-postgre-maybe/160605/4 "2020-08-13T02:07:33Z")

</div>

Did you look at that topic for clues?  
Yeah, but nothing could help me till now.

Is this data that you moved from another server?  
Yes

Is that server working?  
Nope.

Can you take a backup and restore it to the new server?  
Nope, I can only copy the entire /var/discourse folder to get my data.

---

<div class="post-metadata">

### Author: ![endless\_Lin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/endless_lin/32/189927_2.png) [@endless\_Lin](https://meta.discourse.org/u/endless_Lin)
#### Post date: [August 13, 2020, 2:44am UTC](https://meta.discourse.org/t/trouble-with-postgre-maybe/160605/5 "2020-08-13T02:44:50Z")

</div>

I followed the instructions and the problem’s still there.

---

<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: [August 13, 2020, 2:49am UTC](https://meta.discourse.org/t/trouble-with-postgre-maybe/160605/6 "2020-08-13T02:49:37Z")

</div>

> [@endless\_Lin](#):
>
> Is this data that you moved from another server?  
> Yes

You can’t copy the data between servers, while the database is running, and expect it to work.

For migration between servers you can use our backup feature and follow [Move your Discourse Instance to a Different Server](https://meta.discourse.org/t/move-your-discourse-instance-to-a-different-server/15721)
