Upgrading from 15.11.9

The current version of GitLab-CE is 15.11.9.
Is there any problem if I run sudo gitlab-ctl pg-upgrade?
The current PostgreSQL version is displayed as “PostgreSQL (main)12.14”.
I am looking for a way to address the following error message

gitlab preinstall: Your version of PostgreSQL is no longer supported. Please upgrade your PostgreSQL version to 13.
gitlab preinstall: Check https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server for details.
gitlab preinstall: Please upgrade your PostgreSQL version to 13. 
Retry the upgrade after upgrading your PostgreSQL version.
Error: %pre(gitlab-ce-16.0.0-ce.0.el7.x86_64) scriptlet failed, exit status 1

No it isn’t. The current version is 16.1.1.
15.11.9 is not even the latest in the 15.11 series - that would be 15.11.10.
I think you mean that the version you’re currently running is 15.11.9.

There shouldn’t be.

It’s well documented that GitLab version 16 requires at least PostgreSQL version 13 (there are plenty of positive reports of using PostgreSQL 14).
I assume you encounter that error when trying to upgrade GitLab, (I can’t see any other reasonable ways to do so, and that’s why I have that guess on what your first sentence means).
Then upgrade PostgreSQL using the command that you seem to know (as you mentioned it above). You basically have no other choice, but as before any other major change, you should make sure you have a working backup, and knowledge of how to restore it.

1 Like

Thanks for the advice.
I had overlooked the last version. I updated to 15.11.10 with the following command.

$ sudo yum install gitlab-ce-15.11.10-ce.0.el7.x86_64

However, I still get an error when upgrading to 16.0.6. I will try to implement the PostgreSQL upgrade.
Am I correct that I should run the following command?

$ sudo gitlab-ctl pg-upgrade

Upgrading to 16.0.6 results in the following run.

$ date;sudo yum install gitlab-ce-16.0.6-ce.0.el7.x86_64;date
Resolving dependencies
→ Running transaction check
—> Package gitlab-ce.x86_64 0:15.11.10-ce.0.el7 will be updated
—> Package gitlab-ce.x86_64 0:16.0.6-ce.0.el7 will be an update
→ Finished Dependency Resolution
Dependencies Resolved

Package Arch Version Repository Size
gitlab-ce x86_64 16.0.6-ce.0.el7 gitlab_gitlab-ce 1.2 G

Transaction Summary
Upgrade 1 Package

Total download size: 1.2 G
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for gitlab_gitlab-ce
gitlab-ce-16.0.6-ce.0.el7.x86_64.rpm | 1.2 GB 00:20
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
gitlab preinstall:
gitlab preinstall: Your version of PostgreSQL is no longer supported. Please upgrade your PostgreSQL version to 13.
gitlab preinstall: Check Database settings | GitLab for details.
gitlab preinstall:
gitlab preinstall: Upgrade failed. Retry the upgrade after upgrading your PostgreSQL version.
error: %pre(gitlab-ce-16.0.6-ce.0.el7.x86_64) scriptlet failed, exit status 1
Error in PREIN scriptlet in rpm package gitlab-ce-16.0.6-ce.0.el7.x86_64
Verifying : gitlab-ce-16.0.6-ce.0.el7.x86_64 1/2
gitlab-ce-15.11.10-ce.0.el7.x86_64 was supposed to be removed but is not!
Verifying : gitlab-ce-15.11.10-ce.0.el7.x86_64 2/2

gitlab-ce.x86_64 0:15.11.10-ce.0.el7 gitlab-ce.x86_64 0:16.0.6-ce.0.el7

Tue Jul 4 09:46:34 JST 2023

As I said:

It’s well documented that GitLab version 16 requires at least PostgreSQL version 13


1 Like

Normally postgres upgrades should happen automatically when they are required in Gitlab. Do you happen to have a file that exists like below:


if that file exists in /etc/gitlab then perhaps you need to remove it. That should only stop automatic postgres upgrades though. Manual ones should still work when you use the command that @grove confirmed is the correct one to use.

1 Like

Thank you all. Appreciated.
I could not find the following file.


$ ls /etc/gitlab/
gitlab-secrets.json  gitlab.rb  skip-auto-migrations  skip-auto-reconfigure  trusted-certs

However, I was able to upgrade PostgreSQL using the commands I was given. Thanks everyone. I will try again later to upgrade GitLab.
(It took about two minutes in our environment.)

$ sudo gitlab-ctl pg-upgrade
Checking for an omnibus managed postgresql: OK
Checking if postgresql['version'] is set: OK
Checking if we already upgraded: NOT OK
Checking for a newer version of PostgreSQL to install
Upgrading PostgreSQL to 13.11
Toggling services: OK
==== Upgrade has completed ====
Please verify everything is working and run the following if so
sudo rm -rf /var/opt/gitlab/postgresql/data.12
sudo rm -f /var/opt/gitlab/postgresql-version.old

Thank you all.
I was able to do a major upgrade.

$ date;sudo yum install gitlab-ce-16.0.6-ce.0.el7.x86_64;date
Mon 10 Jul 2023 09:18:33 AM JST
Verifying: gitlab-ce-16.0.6-ce.0.el7.x86_64 1/2
Verifying: gitlab-ce-15.11.10-ce.0.el7.x86_64 2/2
Updating: gitlab-ce.x86_64 0:16.0.6-ce.0.el7
Mon 10 Jul 2023 09:25:35 AM JST

However, 16.0.6 has been released with a strongly recommended Security Release, so I will upgrade to 16.1.2 or later in a hurry.

Hi @iwalker I dont have a file like


in /etc/gitlab folder. I have only these files

[root@dev-pat-sp-gitlab2 ~]# ls /etc/gitlab
config_backup  gitlab.rb           gitlab.rb.2022.05.09         gitlab.rb.template   trusted-certs
gitlab.back    gitlab.rb.20220302  gitlab.rb.bkp_25052020_smtp  gitlab-secrets.json  version-manifest.txt

Also @iwalker
Neither its using patroni or geo. Its also not having any postgresql version pinned in gitlab.rb. But when I upgrade my Gitlab server from 15.9.7 to 15.11.13 the postgresql version doesn’t go from 12.12 to 13 automatically. Its just going to 12.14. What could be the reason for this? I also have another instance with similar configuration but there the postgresql version moves to 13.11. Im not sure why this is happening. Could you please help? Thanks.

There were two environments, one where postgresql was automatically upgraded with the Gitlab upgrade, and the other where postgresql was upgraded by executing a command. I looked into the differences between the environments, but I too could not figure out why.

Ohh is it @tsuchikura , you also faced the same issue?

That’s right. In the test environment, PostgreSQL was upgraded along with the GitLab upgrade.
Then we did a GitLab upgrade in the production environment.
At that time, an error occurred depending on the PostgreSQL version.
I did not know the cause, but I upgraded PostgreSQL separately.

Hi @tsuchikura ,
Were you find out the reason as to why the Postgresql is not upgrading automatically on one of the instances.

It’s in the docs: PostgreSQL versions shipped with the Linux package | GitLab

You can clearly see, that it will stay on 12.12 under the default version for upgrades. It only goes to 13 from 16.0.0 onwards.

It even was said here in @grove post in this exact same thread: Upgrading from 15.11.9 - #5 by grove

Hi @iwalker,
I have seen the document for the PostgreSQL versions shipped with Omnibus Gitlab. But on one of the instance where the PostgreSQL version was on 12.12 in Gitlab 15.9.7 it moved to 13.11 when I upgraded to Gitlab 15.11.13. I was confused as to why is this happening.


Sometimes Gitlab will upgrade postgres if it needs to.