# Issue Rebuilding App Failing on Postgres Upgrade

**URL:** https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278
**Category:** Self-hosting
**Created:** [June 30, 2018, 6:57pm UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278 "2018-06-30T18:57:34Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Jose\_C\_Gomez](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jose_c_gomez/32/137297_2.png) [@Jose\_C\_Gomez](https://meta.discourse.org/u/Jose_C_Gomez)
#### Post date: [June 30, 2018, 6:57pm UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/1 "2018-06-30T18:57:35Z")

</div>

Trying to do a launcher rebuild and getting this error

```plaintext
I, [2018-06-30T18:56:08.346656 #17] INFO -- :
I, [2018-06-30T18:56:08.346728 #17] INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2018-06-30T18:56:08.357457 #17] INFO -- :
I, [2018-06-30T18:56:08.357700 #17] INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2018-06-30T18:56:08.359892 #17] INFO -- :
I, [2018-06-30T18:56:08.360109 #17] INFO -- : > /root/upgrade_postgres
I, [2018-06-30T18:56:08.374537 #17] INFO -- : Upgrading PostgreSQL from version 9.5 to 10
WARNING: Upgrading PostgresSQL would require an addtional 13M of disk space
Please free up some space, or expand your disk, before continuing.

To avoid upgrading change "templates/postgres.template.yml" TO "templates/postgres.9.5.template.yml" in containers/app.yml

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

```

It appears to be failing upgrading PostGre because it needs more space? I have plenty of space 23GB

```plaintext
root@EPICORHELP:/var/discourse# df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 4.0K 2.0G 1% /dev
tmpfs 396M 364K 395M 1% /run
/dev/vda1 79G 53G 23G 71% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 0 2.0G 0% /run/shm
none 100M 0 100M 0% /run/user

```

Any ideas?

---

<div class="post-metadata">

### Author: ![Jose\_C\_Gomez](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jose_c_gomez/32/137297_2.png) [@Jose\_C\_Gomez](https://meta.discourse.org/u/Jose_C_Gomez)
#### Post date: [June 30, 2018, 7:00pm UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/2 "2018-06-30T19:00:40Z")

</div>

Renaming the template as suggested in the error worked… However I don’t understand why its failing. I have plenty of space.

---

<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: [July 1, 2018, 1:06am UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/3 "2018-07-01T01:06:39Z")

</div>

Enter the container and do

```
df - h

```

---

<div class="post-metadata">

### Author: ![Jose\_C\_Gomez](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jose_c_gomez/32/137297_2.png) [@Jose\_C\_Gomez](https://meta.discourse.org/u/Jose_C_Gomez)
#### Post date: [July 1, 2018, 1:27pm UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/4 "2018-07-01T13:27:12Z")

</div>

Ok… here’s the output… Looks fine?

```plaintext
root@EPICORHELP:/var/discourse# ./launcher enter app
root@EPICORHELP-app:/var/www/discourse# df -h
Filesystem Size Used Avail Use% Mounted on
none 79G 55G 20G 74% /
tmpfs 64M 0 64M 0% /dev
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/vda1 79G 55G 20G 74% /shared
shm 512M 4.0K 512M 1% /dev/shm
tmpfs 2.0G 0 2.0G 0% /sys/firmware

```

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [July 1, 2018, 4:33pm UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/5 "2018-07-01T16:33:50Z")

</div>

You’d need 2x your used space as free space for postgres upgrade to work …

I see 55GB used and 79GB available.  
Maybe try upgrade with 170GB storage or more?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 1, 2018, 6:27pm UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/6 "2018-07-01T18:27:43Z")

</div>

2x the database size specifically, to be clear.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [July 1, 2018, 6:28pm UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/7 "2018-07-01T18:28:30Z")

</div>

Any way to find out the exact database size?

---

<div class="post-metadata">

### Author: ![Jose\_C\_Gomez](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jose_c_gomez/32/137297_2.png) [@Jose\_C\_Gomez](https://meta.discourse.org/u/Jose_C_Gomez)
#### Post date: [July 1, 2018, 7:18pm UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/8 "2018-07-01T19:18:09Z")

</div>

When I take backups within discourse the file generated is 3GB…

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 2, 2018, 12:08am UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/9 "2018-07-02T00:08:20Z")

</div>

With compression, so at least 10gb uncompressed.

---

<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: [July 2, 2018, 6:03am UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/10 "2018-07-02T06:03:31Z")

</div>

```
du - h /var/discourse/shared/standalone/postgres_data

```

(from memory and on my phone, so, no promises)

---

<div class="post-metadata">

### Author: ![Ignacio\_Carrera](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ignacio_carrera/32/119696_2.png) [@Ignacio\_Carrera](https://meta.discourse.org/u/Ignacio_Carrera)
#### Post date: [August 8, 2018, 6:31am UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/11 "2018-08-08T06:31:12Z")

</div>

Same problem here:

```bash
Run: ./launcher rebuild app

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

```

And my DB is ~330mb

```bash
# du -h /var/discourse/shared/standalone/postgres_data
…
329M /var/discourse/shared/standalone/postgres_data

```

Free space is 26GiB

```bash
# df -H
…
/dev/vda 50G 22G 26G 46% /

```

---

<div class="post-metadata">

### Author: ![dhoop](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dhoop/32/195293_2.png) [@dhoop](https://meta.discourse.org/u/dhoop)
#### Post date: [September 25, 2020, 11:49pm UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/12 "2020-09-25T23:49:56Z")

</div>

@Ignacio_Carrera Did you ever figure this out? I have the same problem

---

<div class="post-metadata">

### Author: ![pzubkiewicz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pzubkiewicz/32/197233_2.png) [@pzubkiewicz](https://meta.discourse.org/u/pzubkiewicz)
#### Post date: [October 17, 2020, 11:41am UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/13 "2020-10-17T11:41:17Z")

</div>

I have a same problem as well ☹

---

<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: [October 18, 2020, 4:35am UTC](https://meta.discourse.org/t/issue-rebuilding-app-failing-on-postgres-upgrade/91278/14 "2020-10-18T04:35:07Z")

</div>

Did you see [PostgreSQL 12 update](https://meta.discourse.org/t/postgresql-12-update/151236)?
