# Error altering user password when building Postgres container

**URL:** https://meta.discourse.org/t/error-altering-user-password-when-building-postgres-container/293069
**Category:** Self-hosting
**Created:** [January 26, 2024, 5:06pm UTC](https://meta.discourse.org/t/error-altering-user-password-when-building-postgres-container/293069 "2024-01-26T17:06:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ewd910](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ewd910/32/354522_2.png) [@ewd910](https://meta.discourse.org/u/ewd910)
#### Post date: [January 26, 2024, 5:06pm UTC](https://meta.discourse.org/t/error-altering-user-password-when-building-postgres-container/293069/1 "2024-01-26T17:06:59Z")

</div>

After postgres is successfully installed in the container, the launcher script tries to change the password of the discourse user. However I get this error

```plaintext
Pups::ExecError: su - postgres -c 'psql discourse' failed with return #<Process::Status: pid 100 exit 141>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"stdin"=>"alter user discourse with password 'redacted';\n", "cmd"=>"su - postgres -c 'psql discourse'", "raise_on_fail"=>true}
bootstrap failed with exit code 141
**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one.

```

Seems like postgres isn’t running when this command is reached so it fails in a broken pipe. My postgres.yml is based off the data.yml sample file though, so I’m not sure what I’m doing wrong. Any ideas?

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [January 26, 2024, 6:03pm UTC](https://meta.discourse.org/t/error-altering-user-password-when-building-postgres-container/293069/2 "2024-01-26T18:03:03Z")

</div>

Would you please

> [@ewd910](#):
>
> `scroll up and look for earlier error messages, there may be more than one.`

And then share them here?

---

<div class="post-metadata">

### Author: ![ewd910](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ewd910/32/354522_2.png) [@ewd910](https://meta.discourse.org/u/ewd910)
#### Post date: [January 26, 2024, 6:18pm UTC](https://meta.discourse.org/t/error-altering-user-password-when-building-postgres-container/293069/3 "2024-01-26T18:18:00Z")

</div>

Hi, nothing notable in the earlier logs, but I noticed in the container logs this message

```plaintext
2024-01-26 12:30:54 I, [2024-01-26T17:30:54.465403 #1] INFO -- : Reading from stdin
2024-01-26 12:30:54 /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/config.rb:22:in `block in initialize': undefined method `has_key?' for nil:NilClass (NoMethodError)
2024-01-26 12:30:54 
2024-01-26 12:30:54 @config[key] = {} unless @config.has_key?(key)
2024-01-26 12:30:54 ^^^^^^^^^
2024-01-26 12:30:54 from /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/config.rb:21:in `each'
2024-01-26 12:30:54 from /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/config.rb:21:in `initialize'
2024-01-26 12:30:54 from /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/cli.rb:68:in `new'
2024-01-26 12:30:54 from /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/cli.rb:68:in `run'
2024-01-26 12:30:54 from /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/bin/pups:9:in `<top (required)>'
2024-01-26 12:30:54 from /usr/local/bin/pups:25:in `load'
2024-01-26 12:30:54 from /usr/local/bin/pups:25:in `<main>'

```

This crashes the container even with the `after_postgres` password alteration commented out, which is where the broken pipe comes in
