めも。Ubuntu 24.04で、php2shellが対応されているPHPのパッケージバージョン。(Ubuntuの他のVerのPHPも対応されてる。)
Noble (24.04) php8.3 Fixed in 8.3.6-0ubuntu0.24.04.13
https://ubuntu.com/blog/php2shell-vulnerability-fixes-available
めも。Ubuntu 24.04で、php2shellが対応されているPHPのパッケージバージョン。(Ubuntuの他のVerのPHPも対応されてる。)
Noble (24.04) php8.3 Fixed in 8.3.6-0ubuntu0.24.04.13
https://ubuntu.com/blog/php2shell-vulnerability-fixes-available
ちょっと、GitLabのアップデートをサボっていたところ、GitLab 17.7.2-ceからGitLab 17.10.3へのapt upgradeがエラーになった。
エラーの内容(↓)
.../gitlab-ce_17.10.3-ce.0_amd64.deb を展開する準備をしています ...
gitlab preinstall: It seems you are upgrading from 17.7 to 17.10.
gitlab preinstall: It is required to upgrade to the latest 17.8.x version first before proceeding.
gitlab preinstall: Please follow the upgrade documentation at https://docs.gitlab.com/ee/update/index.html#upgrade-paths
dpkg: アーカイブ /var/cache/apt/archives/gitlab-ce_17.10.3-ce.0_amd64.deb の処理中にエラーが発生しました (--unpack):
new gitlab-ce package pre-installation script subprocess returned error exit status 1
処理中にエラーが発生しました:
/var/cache/apt/archives/gitlab-ce_17.10.3-ce.0_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
GitLab 17.10.xへのアップデートするために、一度、GitLab 17.8.xに上げる必要があるとのこと。厳密なアップグレードのパスを調べるために、下記の公式サイトで、アップグレードパスをチェックした。
https://gitlab-com.gitlab.io/support/toolbox/upgrade-path
これによると、「GitLab 17.8.6」に一度上げる必要があるということで、apt upgradeでバージョン指定をして、実行。コマンドは下記。
sudo apt upgrade gitlab-ce=17.8.6-ce.0
GitLab 17.8.6へのアップデートが成功したのを確認して、もう一度、apt update、apt upgradeを行った。
sudo apt update
apt list --upgradable
sudo apt upgrade
正常終了したらGitlabをリスタートさせて終了。
sudo gitlab-ctl restart
Windows11のWSLのUbuntuでapt updateがエラーになる。エラーとしては下記で、外部への接続ができなくてエラーになる。なお、PINGを外部にむけて打つと、ちゃんと返ってくる。
timed out Could not connect to security.ubuntu.com:80 (185.125.190.83), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.83), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.81), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.
WSLの設定としては、八方ふさがりな状態になった。ふと思いついて、Windows11にインストールされているアンチウィルスソフト(Symantec Endpoint Security)を無効化してみたところ、apt updateが成功した。
原因: アンチウィルスのファイアウォール機能が通信を止めていた。
わかってしまえば、とても単純な理由だった。いっそ、WSLからの通信を全部とめてくれたのならば、わかりやすかったのだが、中途半端に止められていたので気が付くまで試行錯誤をしてしまった。
今回のアップグレードは、Gitlab 17.0.1-ce から Gitlab 17.1.0-ce 。アップグレードパスとしては、問題はないはずだったのだが、下記のエラーが出た。
Running handlers:
[2024-06-25T18:47:40+09:00] ERROR: Running exception handlers
There was an error running gitlab-ctl reconfigure:
redis_service[redis] (redis::enable line 19) had an error: RuntimeError: ruby_block[warn pending redis restart] (redis::enable line 88) had an error: RuntimeError: Execution of the command `/opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket INFO` failed with a non-zero exit code (1)
stdout:
stderr: Could not connect to Redis at /var/opt/gitlab/redis/redis.socket: No such file or directory
Running handlers complete
[2024-06-25T18:47:40+09:00] ERROR: Exception handlers complete
Infra Phase failed. 11 resources updated in 37 seconds
[2024-06-25T18:47:40+09:00] FATAL: Stacktrace dumped to /opt/gitlab/embedded/cookbooks/cache/cinc-stacktrace.out
[2024-06-25T18:47:40+09:00] FATAL: ---------------------------------------------------------------------------------------
[2024-06-25T18:47:40+09:00] FATAL: PLEASE PROVIDE THE CONTENTS OF THE stacktrace.out FILE (above) IF YOU FILE A BUG REPORT
[2024-06-25T18:47:40+09:00] FATAL: ---------------------------------------------------------------------------------------
[2024-06-25T18:47:40+09:00] FATAL: RuntimeError: redis_service[redis] (redis::enable line 19) had an error: RuntimeError: ruby_block[warn pending redis restart] (redis::enable line 88) had an error: RuntimeError: Execution of the command `/opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket INFO` failed with a non-zero exit code (1)
stdout:
stderr: Could not connect to Redis at /var/opt/gitlab/redis/redis.socket: No such file or directory
===
There was an error running gitlab-ctl reconfigure. Please check the output above for more
details.
===
dpkg: パッケージ gitlab-ce の処理中にエラーが発生しました (--configure):
installed gitlab-ce package post-installation script subprocess returned error exit status 1
xxd (2:8.1.2269-1ubuntu5.23) を設定しています ...
vim-common (2:8.1.2269-1ubuntu5.23) を設定しています ...
vim-tiny (2:8.1.2269-1ubuntu5.23) を設定しています ...
dbus (1.12.16-2ubuntu2.3) のトリガを処理しています ...
desktop-file-utils (0.24-1ubuntu3) のトリガを処理しています ...
mime-support (3.64ubuntu1) のトリガを処理しています ...
hicolor-icon-theme (0.17-2) のトリガを処理しています ...
gnome-menus (3.36.0-1ubuntu1) のトリガを処理しています ...
man-db (2.9.1-1) のトリガを処理しています ...
処理中にエラーが発生しました:
gitlab-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
zen@LAB:~$
もう一度、sudo apt upgrade を実行したところ、正常に終了した。
sudo gitlab-ctl restart を実行するように出ていたので、実行した。
GitLabのウェブ画面上からも確認したが、最新(17.1.0)にアップグレードができており、問題はなかった。
油断すると、GitLab CEのアップデートがapt updateで失敗するので、メモ。
GitLab 16.9.2-ceからGitLab 16.10.3-ceへはapt updateでアップデートできた。
Ubuntu 20.04 LTSで、apt updateでgitlab-ceの更新で、GPGキーのエラーが出た。エラーの原因は、GPGキーの有効期限が2024年3月1日までで、切れたため。その対応メモ。
出力されたエラーメッセージ
以下の署名が無効です: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <packages@gitlab.com>
GPGキーの有効期限が2024年3月1日で切れているので、延長するために、下記のコマンドで更新を行った。
curl -s "https://packages.gitlab.com/gpg.key" | sudo apt-key add -
apt updateを実行してみると、同じようにエラーが表示された(前回と同じ方法では、うまくいかなかった)。公式の手順の内容を参考にして実行したところ、うまくいった。
https://docs.gitlab.com/omnibus/update/package_signatures#update-keys-after-expiry-extension
「signed-by」の機能を使用しているか、コマンドで確認する。
grep 'deb \[signed-by=' /etc/apt/sources.list.d/gitlab_gitlab-?e.list
Grepの結果が返される場合は、「signed-by」 を使用しているので、次のAWKコマンドを実行する。これで、GitLabリポジトリの公開鍵を更新する。要root権限。
sudo awk '/deb \[signed-by=/{
pubkey = $2;
sub(/\[signed-by=/, "", pubkey);
sub(/\]$/, "", pubkey);
print pubkey
}' /etc/apt/sources.list.d/gitlab_gitlab-?e.list | \
while read line; do
curl -s "https://packages.gitlab.com/gpg.key" | gpg --dearmor > $line
done
これで、あとはapt updateを行って、問題が解消しているか確認する。
以下は、実行ログの抜粋。
zen@LABO:~$ sudo apt update
[sudo] zen のパスワード:
ヒット:2 http://security.ubuntu.com/ubuntu focal-security InRelease
ヒット:3 http://jp.archive.ubuntu.com/ubuntu focal InRelease
取得:4 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
ヒット:5 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease
取得:1 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal InRelease [23.3 kB]
エラー:1 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal InRelease
以下の署名が無効です: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <packages@gitlab.com>
137 kB を 2秒 で取得しました (59.7 kB/s)
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
パッケージはすべて最新です。
W: 署名照合中にエラーが発生しました。リポジトリは更新されず、過去のインデックス ファイルが使われます。GPG エラー: https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal InRelease: 以下の署名が無効です: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <packages@gitlab.com>
W: https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/dists/focal/InRelease の 取得に失敗しました 以下の署名が無効です: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <packages@gitlab.com>
W: いくつかのインデックスファイルのダウンロードに失敗しました。これらは無視され るか、古いものが代わりに使われます。
zen@LABO:~$
zen@LABO:~$ curl -s "https://packages.gitlab.com/gpg.key" | sudo apt-key add -
OK
zen@LABO:~$
zen@LABO:~$ sudo apt update
[sudo] zen のパスワード:
ヒット:2 http://jp.archive.ubuntu.com/ubuntu focal InRelease
ヒット:3 http://security.ubuntu.com/ubuntu focal-security InRelease
取得:4 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
ヒット:5 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease
取得:1 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal InRelease [23.3 kB]
エラー:1 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal InRelease
以下の署名が無効です: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <packages@gitlab.com>
137 kB を 3秒 で取得しました (46.3 kB/s)
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
パッケージはすべて最新です。
W: 署名照合中にエラーが発生しました。リポジトリは更新されず、過去のインデックス ファイルが使われます。GPG エラー: https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal InRelease: 以下の署名が無効です: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <packages@gitlab.com>
W: https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/dists/focal/InRelease の 取得に失敗しました 以下の署名が無効です: EXPKEYSIG 3F01618A51312F3F GitLab B.V. (package repository signing key) <packages@gitlab.com>
W: いくつかのインデックスファイルのダウンロードに失敗しました。これらは無視され るか、古いものが代わりに使われます。
zen@LABO:~$
zen@LABO:~$ grep 'deb \[signed-by=' /etc/apt/sources.list.d/gitlab_gitlab-?e.list
deb [signed-by=/usr/share/keyrings/gitlab_gitlab-ce-archive-keyring.gpg] https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ focal main
zen@LABO:~$
zen@LABO:~$
zen@LABO:~$
zen@LABO:~$ sudo su
root@LABO:/home/zen#
root@LABO:/home/zen#
root@LABO:/home/zen# awk '/deb \[signed-by=/{
> pubkey = $2;
> sub(/\[signed-by=/, "", pubkey);
> sub(/\]$/, "", pubkey);
> print pubkey
> }' /etc/apt/sources.list.d/gitlab_gitlab-?e.list | \
> while read line; do
> curl -s "https://packages.gitlab.com/gpg.key" | gpg --dearmor > $line
> done
root@LABO:/home/zen#
root@LABO:/home/zen# apt update
ヒット:2 http://security.ubuntu.com/ubuntu focal-security InRelease
ヒット:3 http://jp.archive.ubuntu.com/ubuntu focal InRelease
ヒット:4 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease
ヒット:5 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease
取得:1 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal InRelease [23.3 kB]
取得:6 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal/main amd64 Packages [54.6 kB]
78.0 kB を 3秒 で取得しました (22.6 kB/s)
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
アップグレードできるパッケージが 1 個あります。表示するには 'apt list --upgradable' を実行してください。
root@LABO:/home/zen#
また、小まめにGitLab CEのアップデートをやり忘れて、apt updateでのアップデートでエラーになった。今回は、GitLab CE 16.2から、GitLab CE 16.4.1へのアップデートだ。
apt upgradeで発生したエラー(一部抜粋)は下記。
gitlab preinstall: It seems you are upgrading from 16.2 to 16.4.
gitlab preinstall: It is required to upgrade to the latest 16.3.x version first before proceeding.
gitlab preinstall: Please follow the upgrade documentation at https://docs.gitlab.com/ee/update/index.html#upgrade-paths
dpkg: アーカイブ /tmp/apt-dpkg-install-33WUrh/15-gitlab-ce_16.4.1-ce.0_amd64.deb の処理中にエラーが発生しました (--unpack):
new gitlab-ce package pre-installation script subprocess returned error exit status 1
処理中にエラーが発生しました:
/tmp/apt-dpkg-install-33WUrh/15-gitlab-ce_16.4.1-ce.0_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
まずは、GitLabのサイトで、アップグレードできるパスを調べる。
これによると、一度、16.3.5にアップグレードしてから、この時点の最新にアップグレードする必要があるとのこと。
アップグレードパス : 16.2 → 16.3.5 → 16.4.1
これを実行したコマンドは下記。段階的にアップデートして、最後に、GitLabを再起動する。
sudo apt update
sudo apt upgrade gitlab-ce=16.3.5-ce.0
sudo apt upgrade gitlab-ce=16.4.1-ce.0
sudo gitlab-ctl restart
何度もやっているので、作業自体はこなれた感じだ。
“sudo do-release-upgrade” を実行したところ、”Please install all available updates for your release before upgrading.” が表示された。先にパッケージを最新にしろというので、”sudo apt update” “sudo apt upgarade” でパッケージを最新化した。
その後、”sudo do-release-upgrade” を実行したところ、rebootを求められたので、再起動を実施した。
再起動後に、”sudo do-release-upgrade” して、OSはUbuntu 18.04 から Ubuntu 20.04 にアップグレードできた。アップグレードのときに、サードパーティのaptリポジトリが対象から外された。外れたリポジトリは、GitLab CEのリポジトリ。
Ubuntu 20.04に無事にアップグレードされた後に、apt update を行ったが、gitlab用のリポジトリは対象には入っていなかった。そのため、下記のコマンドで、リポジトリを再登録した。
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
その後に、apt update を行い、対象にGitLabのリポジトリが含まれていることを確認した。このとき、アップデート対象に、GitLab CEが含まれていたので、apt upgradeでインストールした。このときの動作は、16.2.0-ce.0から16.2.0-ce.0の同じバージョンでの上書きインストールだった。
gitlab-ce/focal 16.2.0-ce.0 amd64 [16.2.0-ce.0 からアップグレード可]
これで無事にアップグレード完了。
すでに何度目かのミス。GitLab CEはアップデートのタイミングが早いので、小まめにアップデートを行っておかないと、アップグレードパスから外れて、apt updateでアップデートできなくなる。下記は、おきまりのエラー表示。
dpkg: アーカイブ /var/cache/apt/archives/gitlab-ce_16.1.2-ce.0_amd64.deb の処理 中にエラーが発生しました (--unpack):
new gitlab-ce package pre-installation script subprocess returned error exit status 1
処理中にエラーが発生しました:
/var/cache/apt/archives/gitlab-ce_16.1.2-ce.0_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
今回は、GitLab-ce-15.6.0から、最新のGitLab-ce-16.1.2なので、下記のアップグレードパスを踏んでアップグレードした。
GitLab-ce-15.6.0
↓
GitLab-ce-15.11.11 ・・・15系の最終バージョン
↓
GitLab-ce-16.1.2
コマンドは、次の順番で実行。これで、無事に16系の最新(作業時最新の16.1.2)にアップデートできた。
sudo apt update
sudo apt upgrade gitlab-ce=15.11.11-ce.0
sudo apt upgrade gitlab-ce=16.1.2-ce.0
sudo gitlab-ctl restart
GitLab CEのアップグレードパスについては、下記を参照。
https://docs.gitlab.com/ee/update/index.html#upgrading-to-a-new-major-version
無料版のUbuntu Server 18.04のサポートが4月ごろに終わる可能性があるので、Ubuntu Server 20.04、Ubuntu Server 22.04 にアップグレードを試した。
do-release-upgrade を実行して、ダイアログで聞かれる内容に答えていくことで、OSバージョンのアップグレードはできた。
アップデートは、SSHからでもできるが、途中で再起動が入ることから、別ポートでSSHが立ち上がり、そこが非常用のアクセスで使われる。推奨は、されていないようなので、コンソールからやるのがよい。
アップグレード中は、途中でダイアログでいろいろと聞かれる。それを答えていくことで、アップグレードされる。インストールされているパッケージも新しくなっていく。バージョン固定のパッケージのコマンドを使っていると、アップグレード後はエラーになるので、注意は必要。
do-release-upgrade は、単純実行で1つ新しいLTSバージョンにしてくれる。18.04からは20.04になるので、22.04にするには、20.04にしてから、もう一度、実行すると、22.04にできた。