Amazon Linux 2023のパッケージをアップデートしてみた

Amazon Linux 2023のパッケージをアップデートしてみた

リポジトリバージョンに気をつけながらパッケージをアップデートしよう
Clock Icon2023.04.09

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

Amazon Linux 2023のリポジトリバージョンが追加されていた

こんにちは、のんピ(@non____97)です。

皆さんはAmazon Linux 2023のパッケージのアップデート方法が気になったことはありますか? 私はあります。

ふと、Amazon Linux 2023のリリースノートを見ると、2023/3/15のGA後に2回アップデートがあったようです。

Amazon Linux 2023のパッケージのアップデートは以下記事で紹介している通り、単純にdnf upgradeするだけではなく、リポジトリバージョンを指定する必要があります。

実際にアップデートしてみて、どのような挙動をするのか確認してみます。

リポジトリバージョンを指定せずにアップデート

リポジトリバージョンを指定せずにアップデートしようとすると、どのような動きをするのか確認します。

# system-release のバージョン確認
$ rpm -q system-release
system-release-2023.0.20230315-1.amzn2023.noarch

# オーバーライド変数設定ファイルの確認
$ cat /etc/dnf/vars/releasever
cat: /etc/dnf/vars/releasever: No such file or directory

# パッケージのアップデート
$ sudo dnf upgrade -v
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground,release-notification, repoclosure, repodiff, repograph, repomanage, reposync, supportinfo
DNF version: 4.12.0
cachedir: /var/cache/dnf
User-Agent: constructed: 'libdnf (Amazon Linux 2023; generic; Linux.x86_64)'
repo: using cache for: amazonlinux
amazonlinux: using metadata from Mon Mar 13 18:10:33 2023.
repo: using cache for: kernel-livepatch
kernel-livepatch: using metadata from Fri Mar 10 00:27:59 2023.
Last metadata expiration check: 0:12:15 ago on Sun Apr  9 01:04:29 2023.
========================================================================================================================================================================
WARNING:
  A newer release of "Amazon Linux" is available.

  Available Versions:

  Version 2023.0.20230329:
    Run the following command to upgrade to 2023.0.20230329:

      dnf upgrade --releasever=2023.0.20230329

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes.html

========================================================================================================================================================================
--> Starting dependency resolution
--> Finished dependency resolution
Dependencies resolved.
Nothing to do.
Complete!

パッケージの更新はされませんでしたが、新しいバージョンを指定できるとアナウンスされますね。

リポジトリバージョンを指定してアップデート

続いて、リポジトリバージョンを指定してアップデートしてみます。

まず、最新のリポジトリバージョンを確認します。

$ sudo dnf check-release-update
WARNING:
  A newer release of "Amazon Linux" is available.

  Available Versions:

  Version 2023.0.20230329:
    Run the following command to upgrade to 2023.0.20230329:

      dnf upgrade --releasever=2023.0.20230329

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes.html

2023.0.20230329のようですね。

最新はlatestを指定した際の検証に使いたいので、2023/3/22のリリースであった2023.0.20230322というリポジトリーバージョンを指定してアップデートしたいと思います。

まず、2023.0.20230322というリポジトリーバージョンでアップデートがあるのか確認します。

$ sudo dnf check-upgrade --releasever=2023.0.20230322 -v
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground,release-notification, repoclosure, repodiff, repograph, repomanage, reposync, supportinfo
DNF version: 4.12.0
cachedir: /var/cache/dnf
User-Agent: constructed: 'libdnf (Amazon Linux 2023; generic; Linux.x86_64)'
repo: using cache for: amazonlinux
amazonlinux: using metadata from Tue Mar 21 02:37:01 2023.
repo: using cache for: kernel-livepatch
kernel-livepatch: using metadata from Fri Mar 10 00:27:59 2023.
Last metadata expiration check: 0:01:56 ago on Sun Apr  9 01:23:15 2023.
========================================================================================================================================================================
WARNING:
  A newer release of "Amazon Linux" is available.

  Available Versions:

  Version 2023.0.20230329:
    Run the following command to upgrade to 2023.0.20230329:

      dnf upgrade --releasever=2023.0.20230329

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes.html

========================================================================================================================================================================

amazon-linux-repo-s3.noarch                                                      2023.0.20230322-0.amzn2023                                                  amazonlinux
kernel.x86_64                                                                    6.1.19-30.43.amzn2023                                                       amazonlinux
kernel-livepatch-repo-s3.noarch                                                  2023.0.20230322-0.amzn2023                                                  amazonlinux
kernel-tools.x86_64                                                              6.1.19-30.43.amzn2023                                                       amazonlinux
keyutils.x86_64                                                                  1.6.3-1.amzn2023                                                            amazonlinux
keyutils-libs.x86_64                                                             1.6.3-1.amzn2023                                                            amazonlinux
libgcc.x86_64                                                                    11.3.1-4.amzn2023.0.3                                                       amazonlinux
libgomp.x86_64                                                                   11.3.1-4.amzn2023.0.3                                                       amazonlinux
libstdc++.x86_64                                                                 11.3.1-4.amzn2023.0.3                                                       amazonlinux
python3-setools.x86_64                                                           4.4.1-1.amzn2023                                                            amazonlinux
sudo.x86_64                                                                      1.9.13-1.p2.amzn2023.0.1                                                    amazonlinux
system-release.noarch                                                            2023.0.20230322-0.amzn2023                                                  amazonlinux
update-motd.noarch                                                               2.1-1.amzn2023                                                              amazonlinux
vim-common.x86_64                                                                2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-data.noarch                                                                  2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-enhanced.x86_64                                                              2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-filesystem.noarch                                                            2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-minimal.x86_64                                                               2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux

アップデートがいくつかあるようですね。

changelogも確認してみましょう。

$ sudo dnf check-upgrade --releasever=2023.0.20230322 --changelogs
Amazon Linux 2023 repository                                                                                                             29 MB/s |  14 MB     00:00
Last metadata expiration check: 0:00:03 ago on Sun Apr  9 01:26:50 2023.
========================================================================================================================================================================
WARNING:
  A newer release of "Amazon Linux" is available.

  Available Versions:

  Version 2023.0.20230329:
    Run the following command to upgrade to 2023.0.20230329:

      dnf upgrade --releasever=2023.0.20230329

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes.html

========================================================================================================================================================================

amazon-linux-repo-s3.noarch                                                      2023.0.20230322-0.amzn2023                                                  amazonlinux
kernel.x86_64                                                                    6.1.19-30.43.amzn2023                                                       amazonlinux
kernel-livepatch-repo-s3.noarch                                                  2023.0.20230322-0.amzn2023                                                  amazonlinux
kernel-tools.x86_64                                                              6.1.19-30.43.amzn2023                                                       amazonlinux
keyutils.x86_64                                                                  1.6.3-1.amzn2023                                                            amazonlinux
keyutils-libs.x86_64                                                             1.6.3-1.amzn2023                                                            amazonlinux
libgcc.x86_64                                                                    11.3.1-4.amzn2023.0.3                                                       amazonlinux
libgomp.x86_64                                                                   11.3.1-4.amzn2023.0.3                                                       amazonlinux
libstdc++.x86_64                                                                 11.3.1-4.amzn2023.0.3                                                       amazonlinux
python3-setools.x86_64                                                           4.4.1-1.amzn2023                                                            amazonlinux
sudo.x86_64                                                                      1.9.13-1.p2.amzn2023.0.1                                                    amazonlinux
system-release.noarch                                                            2023.0.20230322-0.amzn2023                                                  amazonlinux
update-motd.noarch                                                               2.1-1.amzn2023                                                              amazonlinux
vim-common.x86_64                                                                2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-data.noarch                                                                  2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-enhanced.x86_64                                                              2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-filesystem.noarch                                                            2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-minimal.x86_64                                                               2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
Changelogs for libgomp-11.3.1-4.amzn2023.0.3.x86_64, libgcc-11.3.1-4.amzn2023.0.3.x86_64, libstdc++-11.3.1-4.amzn2023.0.3.x86_64
* Fri Mar 10 00:00:00 2023 Benjamin Herrenschmidt <benh@amazon.com> 11.3.1-4.al2022.0.3
- Backport fix for aarch64 patchable areas
- Backport a number of fixes to libiberty rust demangler to fix CVE-2022-27943

Changelogs for kernel-tools-6.1.19-30.43.amzn2023.x86_64, kernel-6.1.19-30.43.amzn2023.x86_64
* Wed Mar 15 00:00:00 2023 Builder <builder@amazon.com>
- builder/b577259c90028be01f1340edab7eaf8520fd08f1 last changes:
  + [b577259] [2023-03-15] Rebase to v6.1.19 (linuxci@linux-corp-jenkins-kernel-62001.pdx2.corp.amazon.com)
  + [2cd3288] [2023-03-14] amazon-6.1.y/mainline: Enable fs encryption (shaoyi@amazon.com)

- linux/ae6169004d4c9da77a49ce971789aee8823160af last changes:
  + [ae6169004d4c] [2023-03-07] Revert "nvme: set controller enable bit in a separate write" (samjonas@amazon.com)
  + [d8a83861d5dd] [2023-01-24] Revert "xen/x2apic: enable x2apic mode when supported for HVM" (samjonas@amazon.com)
  + [4a9845cf6b89] [2023-01-20] Revert "PCI/MSI: Let core code free MSI descriptors" (samjonas@amazon.com)
  + [8e1a0afbb50b] [2019-11-27] block/xen-blkfront: bump the maximum number of indirect segments up to 64 (fllinden@amazon.com)
  + [927fe0c922bd] [2019-08-15] xen: Restore xen-pirqs on resume from hibernation (anchalag@amazon.com)
  + [3e54065005b1] [2019-01-31] xen-netfront: call netif_device_attach on resume (fllinden@amazon.com)
  + [67cf9a0d0f9a] [2018-11-10] xen: Only restore the ACPI SCI interrupt in xen_restore_pirqs. (fllinden@amazon.com)
  + [6f06b9c15993] [2018-10-26] xen: restore pirqs on resume from hibernation. (fllinden@amazon.com)
  + [b87408f8b5bc] [2018-10-18] block: xen-blkfront: consider new dom0 features on restore (eduval@amazon.com)
  + [95703c2d7f64] [2018-04-09] x86: tsc: avoid system instability in hibernation (eduval@amazon.com)
  + [78533c012a42] [2018-06-05] xen-blkfront: Fixed blkfront_restore to remove a call to negotiate_mq (anchalag@amazon.com)
  + [c748050b1f7b] [2018-03-27] Revert "xen: dont fiddle with event channel masking in suspend/resume" (anchalag@amazon.com)
  + [c82d9d94353d] [2017-10-27] PM / hibernate: update the resume offset on SNAPSHOT_SET_SWAP_AREA (cyberax@amazon.com)
  + [5298ebf76e6b] [2017-08-24] x86/xen: close event channels for PIRQs in system core suspend callback (kamatam@amazon.com)
  + [dacba9e173d9] [2017-08-24] xen/events: add xen_shutdown_pirqs helper function (kamatam@amazon.com)
  + [e977a7a822e0] [2017-07-21] x86/xen: save and restore steal clock (kamatam@amazon.com)
  + [3234ec68a33c] [2017-07-13] xen/time: introduce xen_{save,restore}_steal_clock (kamatam@amazon.com)
  + [ee38a1bf35d6] [2017-01-09] xen-netfront: add callbacks for PM suspend and hibernation support (kamatam@amazon.com)
  + [f37a2d28ef47] [2017-06-08] xen-blkfront: add callbacks for PM suspend and hibernation (kamatam@amazon.com)
  + [8c4854e342f4] [2017-02-11] x86/xen: add system core suspend and resume callbacks (kamatam@amazon.com)
  + [f7b77526f950] [2018-02-22] x86/xen: Introduce new function to map HYPERVISOR_shared_info on Resume (anchalag@amazon.com)
  + [7203a8a954b8] [2017-07-13] xenbus: add freeze/thaw/restore callbacks support (kamatam@amazon.com)
  + [01408da275a2] [2017-07-13] xen/manage: introduce helper function to know the on-going suspend mode (kamatam@amazon.com)
  + [47fe32b4a2e3] [2017-07-12] xen/manage: keep track of the on-going suspend mode (kamatam@amazon.com)
  + [572bf205f98e] [2017-10-27] Enable Algorithims for Amazon Linux 6.1.y (alakeshh@amazon.com)
  + [4fe2b1358e3d] [2023-01-10] EFA: Update to v2.1.1 (shaoyi@amazon.com)
  + [78128a791324] [2023-01-10] ENA: Update to v2.8.1 (shaoyi@amazon.com)
  + [bfad29fe569c] [2023-01-10] drivers/amazon: import 5.15 drivers (shaoyi@amazon.com)
  + [65bb3591429e] [2018-02-12] drivers: introduce AMAZON_DRIVER_UPDATES (vallish@amazon.com)
  + [f4100c1e398a] [2021-02-22] hwrng: Add Gravition RNG driver (vaerov@amazon.com)
  + [51a16339a340] [2021-02-22] arm64: Export acpi_psci_use_hvc() symbol (vaerov@amazon.com)
  + [c12fafdac421] [2021-05-12] x86: Disable KASLR when Xen is detected (benh@amazon.com)
  + [bc2c9bc3f079] [2022-05-25] Correct read overflow in page touching DMA ops binding (tbarri@amazon.com)
  + [2c174bd99d23] [2021-09-17] Introduce page touching DMA ops binding (jgowans@amazon.com)
  + [f50f984f0ac5] [2021-12-10] virtio-balloon: optionally report offlined memory ranges (fllinden@amazon.com)
  + [8eb8134b4b04] [2022-01-06] virtio: add hack to allow pre-mapped scatterlists (fllinden@amazon.com)
  + [d7d3f623d9e9] [2022-01-06] mm: add offline page reporting interface (fllinden@amazon.com)
  + [5a643f89e521] [2021-12-09] drivers/base/memory: use MHP_MEMMAP_ON_MEMORY from the probe interface (fllinden@amazon.com)
  + [975b7c5ee8c4] [2021-12-31] memory: fix offline_and_remove_memory use (fllinden@amazon.com)
  + [48b79891a181] [2021-07-14] arm64/mm: Enable sysfs based memory hot remove probe (rohiwali@amazon.com)
  + [295accfc800c] [2019-04-03] Sysfs memory probe interface (anshuman.khandual@arm.com)
  + [09bc46247e38] [2021-09-15] mm, memcg: throttle the memory reclaim given dirty/writeback pages to avoid early OOMs (shaoyi@amazon.com)

Changelogs for keyutils-1.6.3-1.amzn2023.x86_64, keyutils-libs-1.6.3-1.amzn2023.x86_64
* Fri Mar 03 00:00:00 2023 Kinjal Thaker <kthaker@amazon.com> - 1.6.3-1.amzn2023
- Sync from Stream9 to update to 1.6.3-1

Changelogs for python3-setools-4.4.1-1.amzn2023.x86_64
* Wed Mar 01 00:00:00 2023 Swathi Panneer Selvam <swatcat@amazon.com> - 4.4.1-1.amzn2023
- Sync with fedora 38 to update to 4.4.1-1

Changelogs for sudo-1.9.13-1.p2.amzn2023.0.1.x86_64
* Mon Mar 06 00:00:00 2023 Bojan Smojver <smojb@amazon.com> - 1.9.13p2-1.amzn2023.0.1
- Merge Fedora 37
- CVE-2023-27320

* Wed Mar 01 00:00:00 2023 Radovan Sroka <rsroka@redhat.com> - 1.9.13-1.p2
- Rebase to sudo 1.9.13p2
- sudo-1.9.13p2 is available Resolves: rhbz#2169840
- sudo: double free with per-command chroot sudoers rules Resolves:
  CVE-2023-27320

Changelogs for amazon-linux-repo-s3-2023.0.20230322-0.amzn2023.noarch, system-release-2023.0.20230322-0.amzn2023.noarch, kernel-livepatch-repo-s3-2023.0.20230322-0.amzn2023.noarch
* Wed Mar 22 00:00:00 2023 Nikhil Dikshit <nikhildi@amazon.com> - 2023.0.20230322.0
- Amazon Linux 2023.0.20230322.0

Changelogs for update-motd-2.1-1.amzn2023.noarch
* Wed Mar 15 00:00:00 2023 Stewart Smith <trawets@amazon.com> 2.1
- Replace update-motd motd part even when it's zero sized
- This fixes https://github.com/amazonlinux/amazon-linux-2023/issues/286

Changelogs for vim-enhanced-2:9.0.1367-1.amzn2023.0.1.x86_64, vim-minimal-2:9.0.1367-1.amzn2023.0.1.x86_64, vim-common-2:9.0.1367-1.amzn2023.0.1.x86_64, vim-data-2:9.0.1367-1.amzn2023.0.1.noarch, vim-filesystem-2:9.0.1367-1.amzn2023.0.1.noarch
* Wed Mar 08 00:00:00 2023 Bojan Smojver <smojb@amazon.com> - 9.0.1367-1.amzn2023.0.1
- Merge Fedora 37
- CVE-2023-1127

* Thu Mar 02 00:00:00 2023 Zdenek Dohnal <zdohnal@redhat.com> - 2:9.0.1367-1
- patchlevel 1367

どのようなアップデートなのか確認できますね。アップストリームであろうFedoraやCentOS Stream 9の存在が伺えます。

また、セキュリティアップデートのみを確認することも可能です。

$ sudo dnf check-upgrade --releasever=2023.0.20230322 --security
Last metadata expiration check: 0:04:41 ago on Sun Apr  9 01:26:50 2023.
========================================================================================================================================================================
WARNING:
  A newer release of "Amazon Linux" is available.

  Available Versions:

  Version 2023.0.20230329:
    Run the following command to upgrade to 2023.0.20230329:

      dnf upgrade --releasever=2023.0.20230329

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes.html

========================================================================================================================================================================

kernel.x86_64                                                               6.1.19-30.43.amzn2023                                                            amazonlinux
kernel-tools.x86_64                                                         6.1.19-30.43.amzn2023                                                            amazonlinux
libgcc.x86_64                                                               11.3.1-4.amzn2023.0.3                                                            amazonlinux
libgomp.x86_64                                                              11.3.1-4.amzn2023.0.3                                                            amazonlinux
libstdc++.x86_64                                                            11.3.1-4.amzn2023.0.3                                                            amazonlinux
sudo.x86_64                                                                 1.9.13-1.p2.amzn2023.0.1                                                         amazonlinux
vim-common.x86_64                                                           2:9.0.1367-1.amzn2023.0.1                                                        amazonlinux
vim-data.noarch                                                             2:9.0.1367-1.amzn2023.0.1                                                        amazonlinux
vim-enhanced.x86_64                                                         2:9.0.1367-1.amzn2023.0.1                                                        amazonlinux
vim-filesystem.noarch                                                       2:9.0.1367-1.amzn2023.0.1                                                        amazonlinux
vim-minimal.x86_64                                                          2:9.0.1367-1.amzn2023.0.1                                                        amazonlinux

今回はsudoをアップデートさせてみます。

# sudo のアップデート
$ sudo dnf upgrade --releasever=2023.0.20230322 sudo
Last metadata expiration check: 0:07:28 ago on Sun Apr  9 01:26:50 2023.
Dependencies resolved.
========================================================================================================================================================================
 Package                          Architecture                       Version                                              Repository                               Size
========================================================================================================================================================================
Upgrading:
 sudo                             x86_64                             1.9.13-1.p2.amzn2023.0.1                             amazonlinux                             1.2 M

Transaction Summary
========================================================================================================================================================================
Upgrade  1 Package

Total download size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
sudo-1.9.13-1.p2.amzn2023.0.1.x86_64.rpm                                                                                                5.8 MB/s | 1.2 MB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   4.5 MB/s | 1.2 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                1/1
  Upgrading        : sudo-1.9.13-1.p2.amzn2023.0.1.x86_64                                                                                                           1/2
  Cleanup          : sudo-1.9.12-1.p2.amzn2023.0.3.x86_64                                                                                                           2/2
  Running scriptlet: sudo-1.9.12-1.p2.amzn2023.0.3.x86_64                                                                                                           2/2
  Verifying        : sudo-1.9.13-1.p2.amzn2023.0.1.x86_64                                                                                                           1/2
  Verifying        : sudo-1.9.12-1.p2.amzn2023.0.3.x86_64                                                                                                           2/2
========================================================================================================================================================================
WARNING:
  A newer release of "Amazon Linux" is available.

  Available Versions:

  Version 2023.0.20230329:
    Run the following command to upgrade to 2023.0.20230329:

      dnf upgrade --releasever=2023.0.20230329

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes.html

========================================================================================================================================================================

Upgraded:
  sudo-1.9.13-1.p2.amzn2023.0.1.x86_64

Complete!

# system-release のバージョン確認
$ rpm -q system-release
system-release-2023.0.20230315-1.amzn2023.noarch

# アップデート可能なパッケージの確認
$ sudo dnf check-upgrade
Last metadata expiration check: 0:10:12 ago on Sun Apr  9 01:26:44 2023.
========================================================================================================================================================================
WARNING:
  A newer release of "Amazon Linux" is available.

  Available Versions:

  Version 2023.0.20230329:
    Run the following command to upgrade to 2023.0.20230329:

      dnf upgrade --releasever=2023.0.20230329

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes.html

========================================================================================================================================================================

sudoのバージョンアップができました。なお、sudoというパッケージを指定したため、system-releaseのバージョンは更新されていません。そのため、dnf check-upgradeを実行しても、リポジトリバージョン2023.0.20230322でアップデート可能なパッケージが表示されません。

無いとは思いますが、「system-releaseは更新しない。だが、参照するポジトリバージョンを統一したい。」という場合はオーバーライド変数設定ファイル/etc/dnf/vars/releaseverにリポジトリバージョンを指定します。

# オーバーライド変数設定ファイルにリポジトリバージョンを指定
$ sudo sh -c 'echo "2023.0.20230322" >> /etc/dnf/vars/releasever'

# オーバーライド変数設定ファイルが作成されたことを確認
$ cat /etc/dnf/vars/releasever
2023.0.20230322

# パッケージのアップデート確認
$ sudo dnf check-upgrade
Last metadata expiration check: 0:13:11 ago on Sun Apr  9 01:26:50 2023.
========================================================================================================================================================================
WARNING:
  A newer release of "Amazon Linux" is available.

  Available Versions:

  Version 2023.0.20230329:
    Run the following command to upgrade to 2023.0.20230329:

      dnf upgrade --releasever=2023.0.20230329

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes.html

========================================================================================================================================================================

amazon-linux-repo-s3.noarch                                                      2023.0.20230322-0.amzn2023                                                  amazonlinux
kernel.x86_64                                                                    6.1.19-30.43.amzn2023                                                       amazonlinux
kernel-livepatch-repo-s3.noarch                                                  2023.0.20230322-0.amzn2023                                                  amazonlinux
kernel-tools.x86_64                                                              6.1.19-30.43.amzn2023                                                       amazonlinux
keyutils.x86_64                                                                  1.6.3-1.amzn2023                                                            amazonlinux
keyutils-libs.x86_64                                                             1.6.3-1.amzn2023                                                            amazonlinux
libgcc.x86_64                                                                    11.3.1-4.amzn2023.0.3                                                       amazonlinux
libgomp.x86_64                                                                   11.3.1-4.amzn2023.0.3                                                       amazonlinux
libstdc++.x86_64                                                                 11.3.1-4.amzn2023.0.3                                                       amazonlinux
python3-setools.x86_64                                                           4.4.1-1.amzn2023                                                            amazonlinux
system-release.noarch                                                            2023.0.20230322-0.amzn2023                                                  amazonlinux
update-motd.noarch                                                               2.1-1.amzn2023                                                              amazonlinux
vim-common.x86_64                                                                2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-data.noarch                                                                  2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-enhanced.x86_64                                                              2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-filesystem.noarch                                                            2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-minimal.x86_64                                                               2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux

最新のリポジトリバージョンに含まれるパッケージにアップデート

最新のリポジトリバージョンに含まれるパッケージにアップデートする場合はlatestを指定します。

$ sudo dnf check-upgrade --releasever=latest
Amazon Linux 2023 repository                                                                                                             29 MB/s |  12 MB     00:00
Last metadata expiration check: 0:00:03 ago on Sun Apr  9 01:44:29 2023.

amazon-linux-repo-s3.noarch                                                      2023.0.20230329-0.amzn2023                                                  amazonlinux
grub2-common.noarch                                                              1:2.06-61.amzn2023.0.5                                                      amazonlinux
grub2-efi-x64-ec2.x86_64                                                         1:2.06-61.amzn2023.0.5                                                      amazonlinux
grub2-pc-modules.noarch                                                          1:2.06-61.amzn2023.0.5                                                      amazonlinux
grub2-tools.x86_64                                                               1:2.06-61.amzn2023.0.5                                                      amazonlinux
grub2-tools-minimal.x86_64                                                       1:2.06-61.amzn2023.0.5                                                      amazonlinux
kernel.x86_64                                                                    6.1.21-1.45.amzn2023                                                        amazonlinux
kernel-livepatch-repo-s3.noarch                                                  2023.0.20230329-0.amzn2023                                                  amazonlinux
kernel-tools.x86_64                                                              6.1.21-1.45.amzn2023                                                        amazonlinux
keyutils.x86_64                                                                  1.6.3-1.amzn2023                                                            amazonlinux
keyutils-libs.x86_64                                                             1.6.3-1.amzn2023                                                            amazonlinux
libgcc.x86_64                                                                    11.3.1-4.amzn2023.0.3                                                       amazonlinux
libgomp.x86_64                                                                   11.3.1-4.amzn2023.0.3                                                       amazonlinux
libstdc++.x86_64                                                                 11.3.1-4.amzn2023.0.3                                                       amazonlinux
python3-setools.x86_64                                                           4.4.1-1.amzn2023                                                            amazonlinux
system-release.noarch                                                            2023.0.20230329-0.amzn2023                                                  amazonlinux
tar.x86_64                                                                       2:1.34-1.amzn2023.0.3                                                       amazonlinux
update-motd.noarch                                                               2.1-1.amzn2023                                                              amazonlinux
vim-common.x86_64                                                                2:9.0.1403-1.amzn2023.0.1                                                   amazonlinux
vim-data.noarch                                                                  2:9.0.1403-1.amzn2023.0.1                                                   amazonlinux
vim-enhanced.x86_64                                                              2:9.0.1403-1.amzn2023.0.1                                                   amazonlinux
vim-filesystem.noarch                                                            2:9.0.1403-1.amzn2023.0.1                                                   amazonlinux
vim-minimal.x86_64                                                               2:9.0.1403-1.amzn2023.0.1                                                   amazonlinux
Obsoleting Packages
grub2-tools-minimal.x86_64                                                       1:2.06-61.amzn2023.0.5                                                      amazonlinux
    grub2-tools.x86_64                                                           1:2.06-61.amzn2023.0.4                                                      @System

いくつかアップデートが増えましたね。

今回はsystem-releaseをアップデートしてみます。

# 最新の system-release にアップデート
$ sudo dnf upgrade --releasever=latest system-release
Last metadata expiration check: 0:02:54 ago on Sun Apr  9 01:44:29 2023.
Dependencies resolved.
========================================================================================================================================================================
 Package                                 Architecture                    Version                                             Repository                            Size
========================================================================================================================================================================
Upgrading:
 system-release                          noarch                          2023.0.20230329-0.amzn2023                          amazonlinux                           29 k

Transaction Summary
========================================================================================================================================================================
Upgrade  1 Package

Total download size: 29 k
Is this ok [y/N]: y
Downloading Packages:
system-release-2023.0.20230329-0.amzn2023.noarch.rpm                                                                                    420 kB/s |  29 kB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   220 kB/s |  29 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                1/1
  Upgrading        : system-release-2023.0.20230329-0.amzn2023.noarch                                                                                               1/2
  Cleanup          : system-release-2023.0.20230315-1.amzn2023.noarch                                                                                               2/2
  Running scriptlet: system-release-2023.0.20230315-1.amzn2023.noarch                                                                                               2/2
  Verifying        : system-release-2023.0.20230329-0.amzn2023.noarch                                                                                               1/2
  Verifying        : system-release-2023.0.20230315-1.amzn2023.noarch                                                                                               2/2

Upgraded:
  system-release-2023.0.20230329-0.amzn2023.noarch

Complete!

# system-release のバージョン確認
$ rpm -q system-release
system-release-2023.0.20230329-0.amzn2023.noarch

アップデート後、リポジトリバージョンを指定せずにdnf check-upgradeを実行します。

$ sudo dnf check-upgrade
Last metadata expiration check: 0:22:12 ago on Sun Apr  9 01:26:50 2023.
========================================================================================================================================================================
WARNING:
  A newer release of "Amazon Linux" is available.

  Available Versions:

  Version 2023.0.20230329:
    Run the following command to upgrade to 2023.0.20230329:

      dnf upgrade --releasever=2023.0.20230329

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes.html

========================================================================================================================================================================

amazon-linux-repo-s3.noarch                                                      2023.0.20230322-0.amzn2023                                                  amazonlinux
kernel.x86_64                                                                    6.1.19-30.43.amzn2023                                                       amazonlinux
kernel-livepatch-repo-s3.noarch                                                  2023.0.20230322-0.amzn2023                                                  amazonlinux
kernel-tools.x86_64                                                              6.1.19-30.43.amzn2023                                                       amazonlinux
keyutils.x86_64                                                                  1.6.3-1.amzn2023                                                            amazonlinux
keyutils-libs.x86_64                                                             1.6.3-1.amzn2023                                                            amazonlinux
libgcc.x86_64                                                                    11.3.1-4.amzn2023.0.3                                                       amazonlinux
libgomp.x86_64                                                                   11.3.1-4.amzn2023.0.3                                                       amazonlinux
libstdc++.x86_64                                                                 11.3.1-4.amzn2023.0.3                                                       amazonlinux
python3-setools.x86_64                                                           4.4.1-1.amzn2023                                                            amazonlinux
update-motd.noarch                                                               2.1-1.amzn2023                                                              amazonlinux
vim-common.x86_64                                                                2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-data.noarch                                                                  2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-enhanced.x86_64                                                              2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-filesystem.noarch                                                            2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux
vim-minimal.x86_64                                                               2:9.0.1367-1.amzn2023.0.1                                                   amazonlinux

latestを指定した時のアップデートにあったtarなどがありませんね。

これはオーバーライド変数設定ファイルでリポジトリバージョン2023.0.20230322を指定しているためです。

オーバーライド変数設定ファイルを削除して、2023.0.20230329のアップデート情報を確認します。

# オーバーライド変数設定ファイルの削除
$ sudo rm /etc/dnf/vars/releasever

# パッケージのアップデート確認
$ sudo dnf check-upgrade
Amazon Linux 2023 repository                                                                                                             38 MB/s |  12 MB     00:00
Last metadata expiration check: 0:00:02 ago on Sun Apr  9 01:49:50 2023.

amazon-linux-repo-s3.noarch                                                      2023.0.20230329-0.amzn2023                                                  amazonlinux
grub2-common.noarch                                                              1:2.06-61.amzn2023.0.5                                                      amazonlinux
grub2-efi-x64-ec2.x86_64                                                         1:2.06-61.amzn2023.0.5                                                      amazonlinux
grub2-pc-modules.noarch                                                          1:2.06-61.amzn2023.0.5                                                      amazonlinux
grub2-tools.x86_64                                                               1:2.06-61.amzn2023.0.5                                                      amazonlinux
grub2-tools-minimal.x86_64                                                       1:2.06-61.amzn2023.0.5                                                      amazonlinux
kernel.x86_64                                                                    6.1.21-1.45.amzn2023                                                        amazonlinux
kernel-livepatch-repo-s3.noarch                                                  2023.0.20230329-0.amzn2023                                                  amazonlinux
kernel-tools.x86_64                                                              6.1.21-1.45.amzn2023                                                        amazonlinux
keyutils.x86_64                                                                  1.6.3-1.amzn2023                                                            amazonlinux
keyutils-libs.x86_64                                                             1.6.3-1.amzn2023                                                            amazonlinux
libgcc.x86_64                                                                    11.3.1-4.amzn2023.0.3                                                       amazonlinux
libgomp.x86_64                                                                   11.3.1-4.amzn2023.0.3                                                       amazonlinux
libstdc++.x86_64                                                                 11.3.1-4.amzn2023.0.3                                                       amazonlinux
python3-setools.x86_64                                                           4.4.1-1.amzn2023                                                            amazonlinux
tar.x86_64                                                                       2:1.34-1.amzn2023.0.3                                                       amazonlinux
update-motd.noarch                                                               2.1-1.amzn2023                                                              amazonlinux
vim-common.x86_64                                                                2:9.0.1403-1.amzn2023.0.1                                                   amazonlinux
vim-data.noarch                                                                  2:9.0.1403-1.amzn2023.0.1                                                   amazonlinux
vim-enhanced.x86_64                                                              2:9.0.1403-1.amzn2023.0.1                                                   amazonlinux
vim-filesystem.noarch                                                            2:9.0.1403-1.amzn2023.0.1                                                   amazonlinux
vim-minimal.x86_64                                                               2:9.0.1403-1.amzn2023.0.1                                                   amazonlinux
Obsoleting Packages
grub2-tools-minimal.x86_64                                                       1:2.06-61.amzn2023.0.5                                                      amazonlinux
    grub2-tools.x86_64                                                           1:2.06-61.amzn2023.0.4                                                      @System

tarkernelのアップデート後のバージョンが変わりましたね。

なお、--releaseverでリポジトリバージョンを指定しない場合のリポジトリバージョンはdnf repolist all -vで確認できます。

$ dnf repolist all -v
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground,release-notification, repoclosure, repodiff, repograph, repomanage, reposync, supportinfo
DNF version: 4.12.0
cachedir: /var/tmp/dnf-ssm-user-8a851tdn
Last metadata expiration check: 0:02:41 ago on Sun Apr  9 01:59:52 2023.
Repo-id            : amazonlinux
Repo-name          : Amazon Linux 2023 repository
Repo-status        : enabled
Repo-revision      : 1680363935
Repo-updated       : Sat Apr  1 15:45:35 2023
Repo-pkgs          : 13139
Repo-available-pkgs: 13139
Repo-size          : 16 G
Repo-mirrors       : https://al2023-repos-us-east-1-de612dc2.s3.dualstack.us-east-1.amazonaws.com/core/mirrors/2023.0.20230329/x86_64/mirror.list
Repo-baseurl       : https://al2023-repos-us-east-1-de612dc2.s3.dualstack.us-east-1.amazonaws.com/core/guids/9a012059ee50d469d8bf3dc5f5c0f682a7f7c933b824b2076489195f91e12b7e/x86_64/
                   : (0 more)
Repo-expire        : 172800 second(s) (last: Sun Apr  9 01:59:49 2023)
Repo-filename      : /etc/yum.repos.d/amazonlinux.repo

Repo-id            : amazonlinux-debuginfo
Repo-name          : Amazon Linux 2023 repository - Debug
Repo-status        : disabled
Repo-mirrors       : https://al2023-repos-us-east-1-de612dc2.s3.dualstack.us-east-1.amazonaws.com/core/mirrors/2023.0.20230329/debuginfo/x86_64/mirror.list
Repo-expire        : 21600 second(s) (last: unknown)
Repo-filename      : /etc/yum.repos.d/amazonlinux.repo

Repo-id            : amazonlinux-source
Repo-name          : Amazon Linux 2023 repository - Source packages
Repo-status        : disabled
Repo-mirrors       : https://al2023-repos-us-east-1-de612dc2.s3.dualstack.us-east-1.amazonaws.com/core/mirrors/2023.0.20230329/SRPMS/mirror.list
Repo-expire        : 21600 second(s) (last: unknown)
Repo-filename      : /etc/yum.repos.d/amazonlinux.repo

Repo-id            : kernel-livepatch
Repo-name          : Amazon Linux 2023 Kernel Livepatch repository
Repo-status        : enabled
Repo-revision      : 1678408079
Repo-updated       : Fri Mar 10 00:27:59 2023
Repo-pkgs          : 13
Repo-available-pkgs: 13
Repo-size          : 49 M
Repo-mirrors       : https://al2023-repos-us-east-1-de612dc2.s3.dualstack.us-east-1.amazonaws.com/kernel-livepatch/mirrors/al2023/x86_64/mirror.list
Repo-baseurl       : https://al2023-repos-us-east-1-de612dc2.s3.dualstack.us-east-1.amazonaws.com/kernel-livepatch/guids/c4e2194319e945435d031a58dba88f38de32e0505acf7bf8561c5d3cb1ca0b1b/x86_64/
                   : (0 more)
Repo-expire        : 172800 second(s) (last: Sun Apr  9 01:59:52 2023)
Repo-filename      : /etc/yum.repos.d/kernel-livepatch.repo

Repo-id            : kernel-livepatch-source
Repo-name          : Amazon Linux 2023 Kernel Livepatch repository - Source packages
Repo-status        : disabled
Repo-mirrors       : https://al2023-repos-us-east-1-de612dc2.s3.dualstack.us-east-1.amazonaws.com/kernel-livepatch/mirrors/al2023/SRPMS/mirror.list
Repo-expire        : 21600 second(s) (last: unknown)
Repo-filename      : /etc/yum.repos.d/kernel-livepatch.repo
Total packages: 13152

リポジトリバージョンに気をつけながらパッケージをアップデートしよう

Amazon Linux 2023でパッケージのアップデートをしてみました。

リポジトリバージョンには気をつけたいですね。常に最新のリポジトリバージョンを参照する場合はオーバーライド変数設定ファイルにlatestを設定するか、dnf upgrade時に--releasever=リポジトリバージョンを指定しましょう。

なお、リポジトリバージョンの追加 = AMIの追加です。リポジトリバージョンが追加されたことを通知したい場合は、以下AWS公式ドキュメントに従ってAMIの追加をAmazon SNSで受け取ります。

この記事が誰かの助けになれば幸いです。

以上、AWS事業本部 コンサルティング部の のんピ(@non____97)でした!

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.