Error 502 after Postsql update

Infos:

Sorry ahead of time, I’m still very new to Linux and Zammad. I probably messed this up myself but all your help is appreciated!

  • Used Zammad version: Zammad 5.0.2
  • Used Zammad installation type: (source, package, docker-compose, …)
  • Operating system: CentOS 7
  • Browser + version: Firefox

Expected behavior:

  • Load in like normal and log in from browser.

Actual behavior:

  • Getting error 502 Bad Gateway.

Steps to reproduce the behavior:

  • I had an update for Zammad and it needed the latest version of Postgres to install so I tried to install an updated version of Postgres. But after installing the updated Postgres version 14 I received error 502.

  • I have checked the Zammad.conf file and the Nginx.conf. I changed the localhost to the FQDN and that changed the error to 504. But seeing as that doesn’t seem to be the problem and nginx -t returns with okay status (besides the ssl_stapling error which apparently is from my self-signed cert).

*Zammad also updated to the latest version above. I have also found that Postgres was giving an error of the user account Zammad not having access to the database. I then gave it access and assigned it ownership but not it is still saying it can’t open a file “pg_stat_tmp/global.stat”

[root@ticketos log]# systemctl start postgresql-14
Job for postgresql-14.service failed because the control process exited with error code. See "systemctl status postgresql-14.service" and "journalctl -xe" for details.
2021-10-29 14:01:22.577 CDT [62462] FATAL:  could not open file "global/pg_filenode.map": Permission denied
2021-10-29 14:01:22.579 CDT [62463] FATAL:  could not open file "global/pg_filenode.map": Permission denied
2021-10-29 14:01:22.580 CDT [1911] WARNING:  could not open statistics file "pg_stat_tmp/global.stat": Permission denied
2021-10-29 14:01:22.590 CDT [1911] WARNING:  could not open statistics file "pg_stat_tmp/global.stat": Permission denied

Update:

I found this link: How to upgrade PostgreSQL from version 9.6 to version 10.1 without losing data? - Stack Overflow

Showing the proper way to upgrade the database from one version to the next. Which I didn’t do. Hopefully, I can still recover the original data in the previous database. According to my PG_VERSION it says it was 9.2.

I hope this can help.

I have fixed my problem. Maybe someone will be helped by this another time.

Moral of the story: ALWAYS UPGRADE POSTGRES CORRECTLY

I was running Postgresql 9.2 and the new Zammad 5.0 needs Postgresql 9.3 or higher. I have no experience with this so I simply add the repository and upgrade PostgreSQL.

After several days of errors:

Error #1: 502 when trying to access the website
Error #2: Zammad role does not exist
Error #3: database zammad_production does not exist. Can’t create a database.
Error #4: Postsql-14 failed to restart. Journalctl -xe would show zammad_websocket_1 can not connect
etc., etc. etc…Lots of errors.

After learning more and more about Postgres and how it relates to Zammad. I realize that I need to have Postgresql 9.2 in order to migrate my data. But…Postgresql doesn’t support 9.2 anymore but you need it to do the migration of your data… Days later I find out that CentOS 7 Base Repository is where you get 9.2 and before I installed Postgresql 14 I was instructed to do exclude=postgresql* in my repository base file. I had to remove that and I was able to reinstall PostgreSQL 9.2.

Once that was installed I needed to migrate the old database data to the new folder for that I used this guideCentOS: Upgrade PostgreSQL from 9.2 to 9.6. I was going from 9.2 - 14 but it still worked with some obvious changes to the names of files.

Then after that, I was still getting the error zammad_production database does not exist. At this point, I have to apologize because I can’t remember exactly what I used to fix this but I’m pretty sure I did

su - Postgres

and then as a Postgres user, I created the zammad_production database. I will put some links that were useful to figuring this out below.
Create Database Permissions

Oh, and I did have to manually create the data folder for the new Postgresql-14 so here’s a guide for that. unable-to-start-posgtresql-the-reason-isnt-clear

Sorry if this isn’t as helpful there was a lot of forums I read and it’s a big blur. But before you upgrade PostgreSQL. Back up and then follow someone’s guide who knows what they are doing.

3 Likes

Great to hear that you could rule out your tricky postgresql situation.
I’m sure other users will benefit from your comprehensive sum up - thanks for providing your solution! :rocket:

1 Like

Thank you, a lot of the research I did had to do with things you’ve answered so you’ve definitely helped as well lol. Thanks!

1 Like

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