Skip to content

Backup fails on Omnibus minimal CentOS 8.3 because of missing tar dependency

Summary

Gitlab is an incredible project and I am personally grateful for the work all of the developers have done.

This is a very small but confusing bug, it wasn't difficult to figure out but hopefully filling this out as an issue can save the next person some grief. I see a fair number of backup failed issues filed without resolution; I suspect this isn't the underlying issue for most of them but it was in my case.

The underlying root cause is that a minimal installation of CentOS 8 current does not appear to include the tar utility. The problem manifest as a failure during the gitlab-backup command with the slightly misleading native ruby error Errno::ENOENT: No such file or directory - tar

The resolution is a simple dnf install tar

Steps to reproduce

  1. Install Gitlab Omnibus on a minimal CentOS 8 installation (without tar installed) following the instructions https://about.gitlab.com/install/#centos-8

  2. Have gitlab running and with some data in it

  3. Run sudo gitlab-backup create --trace

What is the current bug behavior?

2021-01-04 11:21:22 -0500 -- Dumping uploads ...
rake aborted!
Errno::ENOENT: No such file or directory - tar
/opt/gitlab/embedded/lib/ruby/2.7.0/open3.rb:729:in `spawn'                                                                                                                                /opt/gitlab/embedded/lib/ruby/2.7.0/open3.rb:729:in `block in pipeline_run'
/opt/gitlab/embedded/lib/ruby/2.7.0/open3.rb:703:in `each'
/opt/gitlab/embedded/lib/ruby/2.7.0/open3.rb:703:in `each_with_index'
/opt/gitlab/embedded/lib/ruby/2.7.0/open3.rb:703:in `pipeline_run'
/opt/gitlab/embedded/lib/ruby/2.7.0/open3.rb:686:in `pipeline'
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/files.rb:95:in `run_pipeline!'
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/files.rb:48:in `dump'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:184:in `block (4 levels) in <top (required)>'                                                                       /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:12:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:160:in `invoke_task'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'

Results of GitLab environment info

Expand for output related to GitLab environment info

System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   2.7.2p137
Gem Version:    3.1.4
Bundler Version:2.1.4
Rake Version:   13.0.1
Redis Version:  5.0.9
Git Version:    2.29.0
Sidekiq Version:5.2.9
Go Version:     unknown

GitLab information
Version:        13.7.1
Revision:       c97c8073a0e
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     12.4
URL:            https://gitlab.astinc.services
HTTP Clone URL: https://gitlab.astinc.services/some-group/some-project.git
SSH Clone URL:  git@gitlab.astinc.services:some-group/some-project.git
Using LDAP:     yes
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version:        13.14.0
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell
Git:            /opt/gitlab/embedded/bin/git

Possible fixes

The easiest fix might just be to update the CentOS installation instructions to include tar as a dependency, or if it's possible to have the omnibus rpm require tar.

The actual tar command gets assembled in Line 47 of files.rb, which in turn calls a function named tar that is already performing some system checking and could perhaps be made to throw a more descriptive error if tar isn't found?