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?

Jenkinsが乗っているAmazon Linux 2023のOSをアップデートする

0
Posted at

概要

Jenkinsを動かしているOSのアップデートを試みたのですが、Jenkinsでコケてしまってサクッと終わらなかったのでメモを残しておきます。

▼基本はこちらの過去記事に従います

環境

  • Amazon Linux 2023.7.20250623
  • Jenkins 2.528.3
  • Java 21

OSアップデートを実行

早速現状を確認してアップデートします。

$ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2023"
ID="amzn"
ID_LIKE="fedora"
VERSION_ID="2023"
PLATFORM_ID="platform:al2023"
PRETTY_NAME="Amazon Linux 2023.7.20250623"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023"
HOME_URL="https://aws.amazon.com/linux/amazon-linux-2023/"
DOCUMENTATION_URL="https://docs.aws.amazon.com/linux/"
SUPPORT_URL="https://aws.amazon.com/premiumsupport/"
BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023"
VENDOR_NAME="AWS"
VENDOR_URL="https://aws.amazon.com/"
SUPPORT_END="2029-06-30"

$ dnf check-release-update
$ sudo dnf upgrade --releasever=2023.10.20260330

するとどうやらJenkinsの更新がコケている模様。この時は「まぁJenkinsは後で手動更新すればいいや~」なんて思ってました。

jenkins-2.555.1-1.noarch.rpm: Downloading successful, but checksum doesn't match.
Cannot download, all mirrors were already tried without success
[FAILED] jenkins-2.555.1-1.noarch.rpm: No more mirrors to try - All mirrors were already tried without success

(他にも何行か出てたのですが、閉じちゃったので残っておらず…)

手順通りに再起動が必要かどうか確認したところ不要判定。

$ sudo needs-restarting -s
$ sudo needs-restarting -r
No core libraries or services have been updated since boot-up.
Reboot should not be necessary.

kernelの更新があったのでどう考えても再起動が必要なはず…ということで、OSのアップデートごとコケていることが判明しました。

リポジトリの情報が怪しい

[FAILED] jenkins-2.555.1-1.noarch.rpm: No more mirrors to try - All mirrors were already tried without success

ログの内容からしてリポジトリの情報が怪しいなと踏んだので設定を見に行きます。

$ cat /etc/yum.repos.d/jenkins.repo 
[jenkins]
name=Jenkins-stable
baseurl=https://pkg.jenkins.io/redhat-stable
gpgcheck=1

URLが怪しいなぁと思ってアクセスしたら https://pkg.jenkins.io/rpm-stable/ にリダイレクトされました。案の定URLが変更されてそうです。

手動で書き換えても良いのですが、公式に情報があったのでそちらに従います。Amazon Linux 2023はFedoraベースなので、Fedoraのところを参照します。

$ sudo wget -O /etc/yum.repos.d/jenkins.repo \
    https://pkg.jenkins.io/rpm-stable/jenkins.repo

$ cat /etc/yum.repos.d/jenkins.repo
[jenkins]
name=Jenkins-stable
enabled=1
type=rpm-md
baseurl=https://pkg.jenkins.io/rpm-stable
gpgkey=https://pkg.jenkins.io/rpm-stable/repodata/repomd.xml.key
gpgcheck=1
repo_gpgcheck=1

# Only for SUSE/openSUSE distributions with zypper
autorefresh=1
keeppackages=0

リポジトリの情報が書き換わりました。

$ sudo dnf upgrade --releasever=2023.10.20260330
$ sudo reboot

$ cat /etc/os-release 
NAME="Amazon Linux"
VERSION="2023"
ID="amzn"
ID_LIKE="fedora"
VERSION_ID="2023"
PLATFORM_ID="platform:al2023"
PRETTY_NAME="Amazon Linux 2023.10.20260330"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023"
HOME_URL="https://aws.amazon.com/linux/amazon-linux-2023/"
DOCUMENTATION_URL="https://docs.aws.amazon.com/linux/"
SUPPORT_URL="https://aws.amazon.com/premiumsupport/"
BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023"
VENDOR_NAME="AWS"
VENDOR_URL="https://aws.amazon.com/"
SUPPORT_END="2029-06-30"

無事にOSアップデートが正常に完了したので再起動して完了です。

Jenkinsを起動する

Jenkinsを起動します。

$ sudo systemctl daemon-reload
$ sudo systemctl start jenkins

どうやら設定が初期状態になっているようなのでポート番号とtmpdirを変更します。

$ sudo vi /usr/lib/systemd/system/jenkins.service

Environment="JENKINS_PORT=8082"
Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.io.tmpdir=$JENKINS_HOME/tmp"

$ sudo systemctl daemon-reload
$ sudo systemctl restart jenkins

ちなみに2.555.1以降はJava 21 or Java 25が必要なので要注意です。また、2.541.1以降はGPGキーが変わっているようです。詳しい変更は公式のChangelogをどうぞ。

releaseverからお察しかと思いますが、久々に更新するとこういうことになるので定期的に更新した方が安全ですね(笑)

参考

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?