I have been running a personal GitLab instance for many years now. Today GitLab 13 with many great improvements and new features was released. While the update process of GitLab is normally so stable that I had no issues with enabled auto-updates for years, this time it failed. But of course it wasn’t even GitLabs fault… they deprecated a few config options in 12.3 and I missed that change for straight eight months 🤦♂️. I am using the GitLab Omnibus package to maintain my instance, so to check out the update issue I tried to manually update GitLab:
# apt upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: gitlab-ce 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 2 not fully installed or removed. Need to get 0 B/737 MB of archives. After this operation, 263 MB disk space will be freed. Do you want to continue? [Y/n] (Reading database ... 184482 files and directories currently installed.) Preparing to unpack .../gitlab-ce_13.0.0-ce.0_amd64.deb ... * gitlab_monitor['enable'] has been deprecated since 12.3 and was removed in 13.0. Use gitlab_exporter['enable'] instead. * gitlab_monitor['listen_address'] has been deprecated since 12.3 and was removed in 13.0. Use gitlab_exporter['listen_address'] instead. * gitlab_monitor['listen_port'] has been deprecated since 12.3 and was removed in 13.0. Use gitlab_exporter['listen_port'] instead. Deprecations found. Please correct them and try again. dpkg: error processing archive /var/cache/apt/archives/gitlab-ce_13.0.0-ce.0_amd64.deb (--unpack): new gitlab-ce package pre-installation script subprocess returned error exit status 1 Errors were encountered while processing: /var/cache/apt/archives/gitlab-ce_13.0.0-ce.0_amd64.deb needrestart is being skipped since dpkg has failed E: Sub-process /usr/bin/dpkg returned an error code (1)
The error message was pretty clear: I was still using some
gitlab_monitor options which have been replaced by
gitlab_exporter since GitLab 12.3. So far, so good, my bad. Sounded like an easy fix and I updated
/etc/gitlab/gitlab.rb to update the settings. To my surprise running
apt upgrade again did not succeed and running it a third time didn’t work either (who would have guessed).
After some trial and error I figured out that I had to run
gitlab-ctl reconfigure to apply my configuration changes before the update. Afterwards the update was as smooth as always. So the lesson here isn’t really about this specific deprecation and more a general note to myself that I need to run
gitlab-ctl reconfigure after modifying
/etc/gitlab/gitlab.rb, especially when I try to fix a failed upgrade due to removed options. In hindsight it seems pretty obvious because you always need to run
gitlab-ctl reconfigure to apply config changes 😅.