Unable to upgrade GitLab successfully

Hi,

I upgraded from 11.11.8 to 12.0.12 and executed the “gitlab-ctl reconfigure” command, it returns error message as follows:

Starting Chef Client, version 14.13.11
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
  - redis (0.1.0)
  - postgresql (0.1.0)
  - registry (0.1.0)
  - package (0.1.0)
  - gitlab (0.0.1)
  - monitoring (0.1.0)
  - gitaly (0.1.0)
  - letsencrypt (0.1.0)
  - nginx (0.1.0)
  - runit (4.3.0)
  - acme (4.0.0)
  - crond (0.1.0)
  - mattermost (0.1.0)
  - consul (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...

================================================================================
Recipe Compile Error in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb
================================================================================

NoMethodError
-------------
undefined method `[]' for nil:NilClass

Cookbook Trace:
---------------
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb:100:in `block in from_file'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/config_mash.rb:28:in `auto_vivify'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb:100:in `from_file'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/config.rb:23:in `from_file'
  /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:26:in `from_file'

Relevant File Content:
----------------------
/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/helpers/settings_helper.rb:

 93:    def ee_attribute(name, **config)
 94:      config = { ee: true }.merge(config)
 95:      attribute(name, **config)
 96:    end
 97:
 98:    def from_file(_file_path)
 99:      # Allow auto mash creation during from_file call
100>>     Gitlab::ConfigMash.auto_vivify { super }
101:    end
102:
103:    def method_missing(method_name, *arguments) # rubocop:disable Style/MethodMissing
104:      # Give better message for NilClass errors
105:      # If there are no arguments passed, this is a 'GET' call, and if
106:      # there is no matching key in the configuration, then it has not been set (not even to nil)
107:      # and we will output a nicer error above the exception
108:      if arguments.length.zero? && !configuration.key?(method_name)
109:        breaktxt = '=' * 80

System Info:
------------
chef_version=14.13.11
platform=ubuntu
platform_version=16.04
ruby=ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
program_name=/opt/gitlab/embedded/bin/chef-client
executable=/opt/gitlab/embedded/bin/chef-client


Running handlers:
There was an error running gitlab-ctl reconfigure:

undefined method `[]' for nil:NilClass

Running handlers complete
Chef Client failed. 0 resources updated in 02 seconds

And then I upgraded from 12.1.17 to 12.9.5, it returns error messages as follows:

[18:24:32] root@linux_server:~# apt-get install gitlab-ce=12.9.5-ce.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  gitlab-ce
1 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
Need to get 0 B/760 MB of archives.
After this operation, 219 MB of additional disk space will be used.
(Reading database ... 296413 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_12.9.5-ce.0_amd64.deb ...
Malformed configuration JSON file found at /opt/gitlab/embedded/nodes/git88new.json.
This usually happens when your last run of `gitlab-ctl reconfigure` didn't complete successfully.
This file is used to check if any of the unsupported configurations are enabled,
and hence require a working reconfigure before upgrading.
Please run `sudo gitlab-ctl reconfigure` to fix it and try again.
dpkg: error processing archive /var/cache/apt/archives/gitlab-ce_12.9.5-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_12.9.5-ce.0_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
[18:26:17] root@linux_server:~#

I have no idea how to resolve the errors.
Could you please give me the solution to upgrade the GitLab successfully?

Many thanks,
YJ

Just so that everyone knows, this was solved - posted here: Unable to restore GitLab backup successfully - #10 by hyj1116

I deleted the malformed configuration JSON file found at /opt/gitlab/embedded/nodes/git88new.json. And then executing “apt-get install gitlab-ce=12.9.5-ce.0” again, the malformed configuration JSON file will be recreated and GitLab is upgraded successfully.

1 Like