Upgrade failed. Could not check for unmigrated data on legacy storage

I try to upgrade my gitlab server from gitlab-ce 14.4.1 to gitlab-ce 14.4.2 on Debian Buster but I get following error

gitlab preinstall: Checking for unmigrated data on legacy storage
gitlab preinstall:
gitlab preinstall: Upgrade failed. Could not check for unmigrated data on legacy storage.
gitlab preinstall:
gitlab preinstall: rake aborted!
LoadError: cannot load such file – mini_magick/tool/compare
/opt/gitlab/embedded/service/gitlab-rails/config/application.rb:15:in <top (required)>' /opt/gitlab/embedded/service/gitlab-rails/Rakefile:9:in require’
/opt/gitlab/embedded/service/gitlab-rails/Rakefile:9:in <top (required)>' /opt/gitlab/embedded/bin/bundle:23:in load’
/opt/gitlab/embedded/bin/bundle:23:in `’
(See full trace by running task with --trace)
gitlab preinstall:
gitlab preinstall: If you want to skip this check, run the following command and try again:
gitlab preinstall:
gitlab preinstall: sudo touch /etc/gitlab/skip-unmigrated-data-check
gitlab preinstall:

Any idea why?
Till now I never had any issue to upgrade.
Thanks!

Hi @Wforumw , welcome to the GitLab Community Forum!

We can check whether you have data still on legacy storage with the following commands

sudo gitlab-rake gitlab:storage:legacy_projects
sudo gitlab-rake gitlab:storage:list_legacy_projects
sudo gitlab-rake gitlab:storage:legacy_attachments
sudo gitlab-rake gitlab:storage:list_legacy_attachments

If nothing shows up there, you can safely upgrade by running sudo touch /etc/gitlab/skip-unmigrated-data-check followed by sudo apt upgrade or sudo apt install gitlab-ee=14.4.2-ee.0.

Let us know how it goes!

Hi,
Thanks for the reply,
I get for every command

rake aborted!
LoadError: cannot load such file -- mini_magick/tool/compare
/opt/gitlab/embedded/service/gitlab-rails/config/application.rb:15:in `<top (required)>'
/opt/gitlab/embedded/service/gitlab-rails/Rakefile:9:in `require'
/opt/gitlab/embedded/service/gitlab-rails/Rakefile:9:in `<top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)

If I run gitlab-rails console
I got at the end the same error

Traceback (most recent call last):
	29: from bin/rails:4:in `<main>'
	28: from bin/rails:4:in `require'
	27: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.4.1/lib/rails/commands.rb:18:in `<top (required)>'
	26: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.4.1/lib/rails/command.rb:48:in `invoke'
	25: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.4.1/lib/rails/command/base.rb:69:in `perform'
	24: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
	23: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
	22: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
	21: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.4.1/lib/rails/commands/console/console_command.rb:101:in `perform'
	20: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.4.1/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
	19: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.4.1/lib/rails/command/actions.rb:22:in `require_application!'
	18: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.1.4.1/lib/rails/command/actions.rb:22:in `require'
	17: from /opt/gitlab/embedded/service/gitlab-rails/config/application.rb:15:in `<top (required)>'
	16: from /opt/gitlab/embedded/lib/ruby/site_ruby/2.7.0/bundler.rb:174:in `require'
	15: from /opt/gitlab/embedded/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:58:in `require'
	14: from /opt/gitlab/embedded/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:58:in `each'
	13: from /opt/gitlab/embedded/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:69:in `block in require'
	12: from /opt/gitlab/embedded/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:69:in `each'
	11: from /opt/gitlab/embedded/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:74:in `block (2 levels) in require'
	10: from /opt/gitlab/embedded/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:74:in `require'
	 9: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/mini_magick-4.10.1/lib/mini_magick.rb:63:in `<top (required)>'
	 8: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
	 7: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
	 6: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
	 5: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
	 4: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/mini_magick-4.10.1/lib/mini_magick/tool.rb:286:in `<top (required)>'
	 3: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
	 2: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
	 1: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require': **cannot load such file -- mini_magick/tool/compare (LoadError)**

This error might’ve been introduced by an incomplete or interrupted upgrade.

Can you try downgrading to 14.4.1 and then trying to run those commands?

sudo apt install --reinstall gitlab-ce=14.4.1-ce.0
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:storage:legacy_projects
sudo gitlab-rake gitlab:storage:list_legacy_projects
sudo gitlab-rake gitlab:storage:legacy_attachments
sudo gitlab-rake gitlab:storage:list_legacy_attachments

Txs for the quick reply.
The problem stil exist

Preparing to unpack …/gitlab-ce_14.4.1-ce.0_amd64.deb …
gitlab preinstall: Checking for unmigrated data on legacy storage
gitlab preinstall:
gitlab preinstall: Upgrade failed. Could not check for unmigrated data on legacy
storage.
gitlab preinstall:
gitlab preinstall: rake aborted!
LoadError: cannot load such file – mini_magick/tool/compare
/opt/gitlab/embedded/service/gitlab-rails/config/application.rb:15:in <top (req uired)>' /opt/gitlab/embedded/service/gitlab-rails/Rakefile:9:in require’
/opt/gitlab/embedded/service/gitlab-rails/Rakefile:9:in <top (required)>' /opt/gitlab/embedded/bin/bundle:23:in load’
/opt/gitlab/embedded/bin/bundle:23:in `’
(See full trace by running task with --trace)
gitlab preinstall:
gitlab preinstall: If you want to skip this check, run the following command and
try again:
gitlab preinstall:
gitlab preinstall: sudo touch /etc/gitlab/skip-unmigrated-data-check
gitlab preinstall:
dpkg: error processing archive /var/cache/apt/archives/gitlab-ce_14.4.1-ce.0_amd
64.deb (–unpack):
new gitlab-ce package pre-installation script subprocess returned error exit st
atus 1
Errors were encountered while processing:
/var/cache/apt/archives/gitlab-ce_14.4.1-ce.0_amd64.deb

Any other ideas how we can solve this?

Many thanks in advance!!

Reinstall did not work.
I removed gitlab-ce and installed the latest working version. I have imported the database.
Than I did the upgrade to gitlab-ce_14.4.2-ce.0
Now it works again

It sais:

If you would like to restart the instance without perfming this check check, add the following to your docker command:

-e GITLAB_SKIP_UNMIGRATED_DATA_CHECK=true

To add this line if you run gitlab docker with docker-compose, add the line in your docker-compose.yml file in the environment section like:

environment:
      GITLAB_SKIP_UNMIGRATED_DATA_CHECK: "true"
      GITLAB_OMNIBUS_CONFIG: |
      ...

then the container will start without restarting and you can check whether you have data still on legacy storage with the following commands

docker exec -it gitlab-ce  gitlab-rake gitlab:storage:legacy_projects
docker exec -it gitlab-ce  gitlab-rake gitlab:storage:list_legacy_projects
docker exec -it gitlab-ce  gitlab-rake gitlab:storage:legacy_attachments
docker exec -it gitlab-ce  gitlab-rake gitlab:storage:list_legacy_attachments

in my case it sais in all four tests in green:

Found 0 projects using Legacy Storage

If so, you can now comment out the line again in your `docker-compose.yml and restart the container with

docker-compose up -d