0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ubuntu 24.04.5 → 26.04.1 アップグレード後の GitLab APT / PostgreSQL 修正

0
Posted at

Ubuntu 24.04.5 → 26.04.1 アップグレード後の GitLab APT / PostgreSQL 修正

Ubuntu 24.04.5 から 26.04.1 へアップグレードした後、GitLab の APT リポジトリ設定と PostgreSQL の Collation に問題が発生しました。

今回必要だった対応は、以下の2点です。

  1. GitLab APT リポジトリの再登録
  2. PostgreSQL の Collation バージョンの更新

環境

  • Ubuntu 24.04.5 → 26.04.1
  • GitLab CE 19.4
  • PostgreSQL 16 → 18

1. GitLab APT リポジトリを修復

発生したエラー

apt update 実行時に、以下の Notice が表示されました。

Notice: ディレクトリ '/etc/apt/sources.list.d/' の
'gitlab_gitlab-ce.list.migrate' が無効なファイル名拡張子を持っているため、無視します

Ubuntu のアップグレードによって GitLab の APT リポジトリ設定が正常に移行されず、古い設定ファイルが残っていました。

古い設定を削除

以下のファイルを削除します。

sudo rm -f /etc/apt/sources.list.d/gitlab_gitlab-ce.list.disabled
sudo rm -f /etc/apt/sources.list.d/gitlab_gitlab-ce.list.distUpgrade
sudo rm -f /etc/apt/sources.list.d/gitlab_gitlab-ce.list.migrate

GitLab 公式 APT リポジトリを再登録

curl -fsSL https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

その後、APT を更新します。

sudo apt update

これで GitLab の APT リポジトリが正常に認識されるようになります。


2. PostgreSQL の Collation を修復

発生した警告

GitLab の PostgreSQL で、以下の警告が発生しました。

database "gitlabhq_production" has a collation version mismatch

The database was created using collation version 2.39,
but the operating system provides version 2.43.

これは Ubuntu 24.04.5 → 26.04.1 のアップグレードによって、OS 側の Collation バージョンが、

2.39 → 2.43

へ変更されたためです。

データベース作成時の Collation バージョンと、現在の OS が提供するバージョンが一致しなくなっています。

GitLab を停止

まず GitLab を停止します。

sudo gitlab-ctl stop

PostgreSQL だけ起動

PostgreSQL を起動します。

sudo gitlab-ctl start postgresql

データベースのインデックスを再構築

GitLab のデータベースに対して REINDEX DATABASE を実行します。

sudo gitlab-psql -d gitlabhq_production -c "REINDEX DATABASE gitlabhq_production;"

Collation バージョンを更新

続いて、データベースに記録されている Collation バージョンを現在の環境へ更新します。

sudo gitlab-psql -d gitlabhq_production -c "ALTER DATABASE gitlabhq_production REFRESH COLLATION VERSION;"

今回の環境では、以下の結果が表示されました。

NOTICE:  changing version from 2.39 to 2.43
ALTER DATABASE

これで Collation バージョンが更新されました。


3. GitLab を起動

修復が完了したら、GitLab を起動します。

sudo gitlab-ctl start

その後、ブラウザから GitLab にアクセスし、正常に動作することを確認しました。

まとめ

今回の Ubuntu 24.04.5 → 26.04.1 アップグレードで、GitLab の修正に必要だった対応は主に2つでした。

① GitLab APT リポジトリを再登録

sudo rm -f /etc/apt/sources.list.d/gitlab_gitlab-ce.list.disabled
sudo rm -f /etc/apt/sources.list.d/gitlab_gitlab-ce.list.distUpgrade
sudo rm -f /etc/apt/sources.list.d/gitlab_gitlab-ce.list.migrate

curl -fsSL https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

sudo apt update

② PostgreSQL の Collation を修復

sudo gitlab-ctl stop
sudo gitlab-ctl start postgresql

sudo gitlab-psql -d gitlabhq_production -c "REINDEX DATABASE gitlabhq_production;"

sudo gitlab-psql -d gitlabhq_production -c "ALTER DATABASE gitlabhq_production REFRESH COLLATION VERSION;"

最後に GitLab を起動します。

sudo gitlab-ctl start

今回のケースでは、この対応によって Ubuntu 26.04.1 へのアップグレード後に発生していた GitLab の問題を修正できました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?