2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

概要

Raspberry Pi Zero2にRaspberryPi OS(64Bit/Bookworm)
をインストール直後、アップデートを実施すると、”apt-listchanges: Reading changelogs...”と表示されて以降、フリーズしてウンともスンとも言わなくなりました。

$ sudo apt update
$ sudo apt full-upgrade -y
apt-listchanges: Reading changelogs...

原因

Raspberry Pi Zero W 2は、物理メモリが512MBなのですが、
RaspberryPi OS(64Bit/Bookworm)はスワップ領域を100MBに設定しており、64Bit RaspberryPi OSでは、OSインストール直後のアップデートではメモリ不足が発生します。

対策

Raspberry Pi OSでスワップ領域(swap space)のサイズを変更します。スワップはシステムの物理メモリ(RAM)が不足した際に、ディスク上の仮想メモリ領域として利用されます。

1.スワップファイルの現在のサイズを確認する

現在のスワップファイルのサイズを確認するには、次のコマンドを使います。

sudo swapon --show

2.スワップファイルのサイズを変更する

2-1./etc/dphys-swapfile ファイルを編集し、スワップファイルのサイズを設定します。

sudo vim /etc/dphys-swapfile

このファイル内にある CONF_SWAPSIZE パラメータを編集し、希望のメガバイト単位でサイズを設定します。例えば、スワップサイズを1GBに設定する場合は、CONF_SWAPSIZE=1024 とします。

2-2. スワップファイルを再生成します。

sudo dphys-swapfile setup

2-3. スワップを再有効にします。

sudo dphys-swapfile swapon

3. スワップファイルの設定を確認する

最後に、変更が適用されたかを確認するために、再びスワップ情報を表示させます。

sudo swapon --show

これで、Raspberry Pi OS上でスワップサイズを変更する手順が完了しました。安心して、アップデートを実施します。
スワップが発生するため、時間がとてもかかりますが、アップデートが終わるまでしばらく待ちます。

$ sudo apt update
$ sudo apt full-upgrade -y
apt-listchanges: Reading changelogs...
2
3
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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?