Upgrade GitLab from Version 10.7.3 to 11.4.7

Today I finally found a bit of time to migrate my GitLab instance from one cloud provider to another. Following my own guide on how to migrate to a new instance, I began by installing Ubuntu 18.04 LTS on my new cloud server and installing the latest version of GitLab (11.4.7). The plan was then to just upgrade my old GitLab instance to the same version on Ubuntu 16.04 LTS. However my previous post failed to realise that apparently its not always as simple as an apt dist-upgrade to upgrade GitLab!

Preparing to unpack .../gitlab-ce_11.4.7-ce.0_amd64.deb ...
gitlab preinstall: It seems you are upgrading from 10.x version series
gitlab preinstall: to 11.x series. It is recommended to upgrade
gitlab preinstall: to the last minor version in a major version series first before
gitlab preinstall: jumping to the next major version.
gitlab preinstall: Please follow the upgrade documentation at https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations
gitlab preinstall: and upgrade to 10.8 first.
dpkg: error processing archive /var/cache/apt/archives/gitlab-ce_11.4.7-ce.0_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/gitlab-ce_11.4.7-ce.0_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Before doing anything else you might want to update the rest of your system, especially if you can’t get around to fixing it right away. You can hold back a single package with the apt-mark command.

root@repo:~# apt-mark hold gitlab-ce
gitlab-ce set on hold.
root@repo:~# 
root@repo:~# apt upgrade
root@repo:~# 
root@repo:~# apt-mark unhold gitlab-ce
Canceled hold on gitlab-ce.

You have to follow the recommended upgrade path, see the official documentation for more information on that. For me this means:

10.7.3 -> 10.8.7 -> 11.4.7

You can use apt-cache to list all the available versions of a given package, including your installed version like so.

root@repo:~# apt-cache policy gitlab-ce

Looking at the output from the above command, I the package I need 10.8.7-ce.0. To install it:

root@repo:~# apt install gitlab-ce=10.8.7-ce.0

Hopefully that worked. You can check by using a browser to log into GitLab and going to the Help menu.

And you should now see the version number.

If you have issues, try issuing a restart.

root@repo:~# gitlab-ctl restart

Now you should be able to upgrade.

root@repo:~# apt upgrade

You should be able to avoid this issue in the future if you upgrade your system at least once a month, which is inline with GitLabs release cycle.

Don’t forget to log in again and check everything seems okay. Assuming that it is and now both hosts have the same version of GitLab installed – I should be good to carry on with migrating my gitlab! 🙂

Be the first to comment

Leave a Reply