Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/postgresql/15/main/postgresql.conf

AI-generated summary

User sallypf encountered an error during a Discourse rebuild: Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/postgresql/15/main/postgresql.conf, caused by an outdated Docker base image (2.0.20240708-0023) being used despite having a newer image configured in launcher. The issue arose after an attempted admin update left the admin panel blank, prompting a CLI rebuild. pfaffman initially suspected a typo in the app.yml file, but sallypf confirmed it was a copy-paste error. mwaniki identified the root cause: the outdated image was likely hardcoded elsewhere, possibly in app.yml via base_image. sallypf confirmed the launcher file pointed to a newer image (2.0.20250129-0720), so mwaniki suggested searching recursively for the old image string. After following this advice, sallypf successfully resolved the issue and restored the forum. The problem affected only one of two otherwise identical DigitalOcean Ubuntu droplets, indicating a configuration drift rather than a systemic environment issue.

I tried to update via admin, not sure what happened but admin pages went blank while front was ok. Decided to do update again via command line and got this error

Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/postgresql/15/main/postgresql.conf

cd /var/discourse; ./launcher rebuild app
x86_64 arch detected.
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
2.0.20240708-0023: Pulling from discourse/base
Digest: sha256:025e9c1f68
Status: Image is up to date for discourse/base:2.0.20240708-0023
docker.io/discourse/base:2.0.20240708-0023
/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2025-02-06T20:57:43.044950 #1]  INFO -- : Reading from stdin
I, [2025-02-06T20:57:43.066724 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown: 
I, [2025-02-06T20:57:43.072432 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown: 
I, [2025-02-06T20:57:43.077790 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown: 
I, [2025-02-06T20:57:43.083299 #1]  INFO -- : File > /root/install_postgres  chmod: +x  chown: 
I, [2025-02-06T20:57:43.087962 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown: 


FAILED
--------------------
Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/postgresql/15/main/postgresql.conf
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/replace_command.rb:11:in `read'
replace failed with the params {"filename"=>"/etc/postgresql/15/main/postgresql.conf", "from"=>"data_directory = '/var/lib/postgresql/15/main'", "to"=>"data_directory = '/shared/postgres_data'"}
bootstrap failed with exit code 1
** 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.

Some other info

cat containers/app.yml | grep postgres

- "templates/postgres.template.yml"

How to fix it?

I’ve digital ocean droplet, ubuntu, if that helps.

I’ve only one container.

Are those *'s really there?

Should be

- "templates/postgres.template.yml"

Sorry, it was copy paste error. I’ve fixed it. No they are not there.

I just tried updating another instance on another server and it went through. Both servers are DO droplets with same spec.
Not sure what is going on.

My forum has been down for 2 days, can’t get it work. Moved thread to Support. Hope to get some help.

That’s a much older Docker image which does not have PostgreSQL 15 packages installed, hence the error:

Your launcher file has probably been modified and locked into using that older Docker image above. You can change it to the latest image highlighted below then try rebuilding again. (Take necessary backups beforehand.)

Thanks for the reply. I just checked and in launcher file the base seems to to be latest one

root@host:/var/discourse# cat launcher | grep "base:2.0"
image="discourse/base:2.0.20250129-0720"

However during rebuild it is still taking older image, so where does this older image is being picked up from? How do I check it?

It could also be defined as base_image in your app.yml file. If you find that, you can simply comment out (or remove) the line.

If that doesn’t help, you can try a recursive search for part of that string instead.

grep --exclude-dir shared -rI 20240708 /var/discourse

It worked. Thank you very much for help.