1
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?

Amazon Linux 2023をupgradeできない->再起動->起動しない

1
Posted at

はじめに

Amazon Linux 2023の環境でOSをupgradeしようとしたところ、以下のように「Killed」とだけ表示されて更新処理が中断してしまいました。
今回はこの原因と対応方法を記事としてまとめてみました。

以前の記事:Amazon Linux 2023の更新方法

[root@ip-10-0-1-23 ~]# dnf upgrade --releasever=2023.9.20251208
Amazon Linux 2023 repository                                                                                                                                                                                  33 MB/s |  51 MB     00:01    
Killed

対象の環境

  • OS:Amazon Linux 2023(Amazon Linux 2023.6.20241031)
  • インスタンスサイズ:t3a.nano
  • ディスクサイズ:8GB

原因

  • journalctlを調べたところ、以下のようにOOM Killerが発動していることが分かりました。
  • t3a.nanoと非常にチープな環境なので、物理メモリの量が不足していてOSの更新に失敗したことが分かりました。
[root@ip-10-0-1-23 ~]# journalctl -k --since "30 minutes ago" | grep -Ei 'oom|out of memory|killed process'
Oct 24 12:02:59 ip-10-0-1-23.ap-northeast-1.compute.internal kernel: httpd invoked oom-killer: gfp_mask=0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), order=0, oom_score_adj=0
Oct 24 12:02:59 ip-10-0-1-23.ap-northeast-1.compute.internal kernel:  oom_kill_process.cold+0xb/0x10
Oct 24 12:02:59 ip-10-0-1-23.ap-northeast-1.compute.internal kernel: [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
Oct 24 12:02:59 ip-10-0-1-23.ap-northeast-1.compute.internal kernel: oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/session-21.scope,task=dnf,pid=435381,uid=0
Oct 24 12:02:59 ip-10-0-1-23.ap-northeast-1.compute.internal kernel: Out of memory: Killed process 435381 (dnf) total-vm:803896kB, anon-rss:0kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:788kB oom_score_adj:0

対応策→トラブル

  • EC2インスタンスをシャットダウンして、インスタンスタイプをt3a.nanoからt3a.microに変更して再度EC2インスタンスを"開始"しましたが、インスタンスは正常に起動しませんでした。
    • 「2/3 のチェックに合格しました」で止まってしまいました。
  • 2時間近く待っても正常に起動しなかったので、強制停止してt3a.smallに変更して再度"開始"してみましたが、丸一日近く経っても正常に起動しませんでした。
    • やはり「2/3 のチェックに合格しました」で止まってしまいました。

最終的な対応策

  • EC2インスタンスを終了(terminate)して、新しいインスタンスを作成して再構築しました...

まとめ

  • t3a.nanoやt3a.microなどの「極小サイズのインスタンス」だとアップグレードが正常に進まないようなので、一時的にt3a.mediumくらいまでインスタンスサイズを上げた方が良いのかもしれません。
    • メモリサイズだけでなくディスクサイズも足りていないのかもしれませんが、今回はそこまで確認することができませんでした。
1
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
1
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?