[備忘録]GitLab15 => GitLab16へのアップデートでエラー

GitLab16がリリースされました！
ということで、さっそく運用中のGitLabをアップデートしてみましたのですが、いつものようにエラーが発生したので備忘録として残しておきます。

# GitLabの構築について

GitLabはEC2上にdocker-composeで構築しています。
詳しくは以下の投稿を参照。

https://qiita.com/teracy55/items/2f9ecaafc0a042c1f6df

また、v14からv15に上げた時の備忘録は以下の投稿を参照

https://qiita.com/teracy164/items/7ec901432236c929e3b7

# v15.10 => v15.11

v15.10以下のバージョンから直接v16にアップデートできないので、いったんv15の最新にアップデートします。

# v15.11 => v16.0

v15.11からv16.0.1にアップデートしたところ、エラーが起きました。

```shell
gitlab           |   ================================================================================
gitlab           |   Error Syncing Cookbooks:
gitlab           |   ================================================================================
gitlab           |
gitlab           |   Unexpected Error:
gitlab           |   -----------------
gitlab           |   ThreadError: can't create Thread: Operation not permitted
gitlab           |
gitlab           |   System Info:
gitlab           |   ------------
gitlab           |   chef_version=17.10.0
gitlab           |   platform=ubuntu
gitlab           |   platform_version=22.04
gitlab           |   ruby=ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]
gitlab           |   program_name=/opt/gitlab/embedded/bin/cinc-client
gitlab           |   executable=/opt/gitlab/embedded/bin/cinc-client
gitlab           |
gitlab           |
gitlab           |   Running handlers:
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: Running exception handlers
gitlab           | There was an error running gitlab-ctl reconfigure:
gitlab           |
gitlab           | can't create Thread: Operation not permitted
gitlab           |
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: Report handler GitLabHandler::Exception raised #<NameError: uninitialized constant GitLabHandler::Exception::OmnibusHelper>
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/cookbooks/package/libraries/handlers/gitlab.rb:30:in `report'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/handler.rb:296:in `run_report_unsafe'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/handler.rb:284:in `run_report_safely'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/handler.rb:155:in `block in run_exception_handlers'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/handler.rb:153:in `each'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/handler.rb:153:in `run_exception_handlers'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/handler.rb:164:in `block in <class:Handler>'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/client.rb:443:in `block in run_failed'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/client.rb:442:in `each'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/client.rb:442:in `run_failed'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/client.rb:306:in `rescue in run'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/client.rb:299:in `run'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/application.rb:305:in `run_with_graceful_exit_option'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/application.rb:281:in `block in run_chef_client'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/local_mode.rb:42:in `with_server_connectivity'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/application.rb:264:in `run_chef_client'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/application/base.rb:352:in `run_application'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/application.rb:67:in `run'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-bin-17.10.0/bin/cinc-client:25:in `<top (required)>'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/bin/cinc-client:25:in `load'
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: /opt/gitlab/embedded/bin/cinc-client:25:in `<main>'
gitlab           |   Running handlers complete
gitlab           | [2023-05-24T12:11:27+00:00] ERROR: Exception handlers complete
gitlab           |   Infra Phase failed. 0 resources updated in 01 seconds
gitlab           | [2023-05-24T12:11:28+00:00] FATAL: Stacktrace dumped to /opt/gitlab/embedded/cookbooks/cache/cinc-stacktrace.out
gitlab           | [2023-05-24T12:11:28+00:00] FATAL: ---------------------------------------------------------------------------------------
gitlab           | [2023-05-24T12:11:28+00:00] FATAL: PLEASE PROVIDE THE CONTENTS OF THE stacktrace.out FILE (above) IF YOU FILE A BUG REPORT
gitlab           | [2023-05-24T12:11:28+00:00] FATAL: ---------------------------------------------------------------------------------------
gitlab           | [2023-05-24T12:11:28+00:00] FATAL: ThreadError: can't create Thread: Operation not permitted
gitlab exited with code 1

```


# やってみたこと

```shell
$ docker-compose up -d

$ docker exec -it gitlab update-permissions

```

だめでした


# 起動できた

[こちらの投稿](https://gitlab.com/gitlab-org/gitlab/-/issues/412886#note_1404371746)でDockerのバージョンは20.10.10以降のバージョンで動かす必要があるとのこと

なお、インストール済みのDockerのバージョンは18系でした

```shell
# インストール済みのDockerをアンインストール
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine

# EC2に最新のDockerをインストール
sudo yum update -y
sudo amazon-linux-extras install -y docker
sudo systemctl start docker
sudo systemctl enable docker

# 再度docker-compose起動
docker-compose up -d
```

ブラウザからもアクセスでき、ちゃんとv16になってます！

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/325108/c90e6c0a-bf97-8877-bffd-17795237997a.png)


GitLabのメジャーバージョンアップの時は毎回なにかしら起きますね。。。


# 参考

- https://forum.gitlab.com/t/updating-from-15-11-to-latest-docker-build-fails/86981/6
- https://gitlab.com/gitlab-org/gitlab/-/issues/412886
- https://kacfg.com/aws-ec2-docker/