ひゃまだのblog

ひゃまだ(id:hymd3a)の趣味のブログ

WSL2のDebianをBullseye(11)からBookworm(12)へアップグレードする

(2025-01-18 初稿)

Window11のWSL2に、Debian Bullseye(11)を入れてかなり経った。

特に不都合な点が無かったため、そのまま放置しており、インストールしたBullseyeのままアップグレードはしていなかった。

Bookwormが出てからもかなり経ち、先日12.9になったので、この際、WSL2の中のDebianをBullseye(11)からBookworm(12)へアップグレードすることにした。

アップグレードの方法は、以下のサイトを参照するのが良いが、試しにChatGPTに聞いてみたところ、ほぼ正確なアップブレードの方法を教えてくれた。ChatGPTすごい!!

以下に、筆者が実際に行った方法を示す。

まずは、現在のバージョンを最新のものにしておく。

$ sudo apt update && sudo apt upgrade

/etc/apt/sources.listの更新

nanoやvi等で以下のとおり編集。

deb http://deb.debian.org/debian bookworm main contrib non-free
deb http://security.debian.org/debian-security bookworm-security main contrib non-free
deb http://deb.debian.org/debian bookworm-updates main contrib non-free

ちなみに、Bookwormからは、non-freeがnon-freeとnon-free-firmware の2つになるので、正確には、以下のようになる。

deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware

パッケージリストの更新

$ sudo apt update

パッケージ更新のシミュレーション

以下は必須ではないが、心配な方は実行して、エラーがでるか確認すると良い。

$ sudo apt upgrade --simulate
$ sudo apt full-upgrade --simulate

システムの最小アップグレード

$ sudo apt upgrade --without-new-pkgs

システムのアップグレード

$ sudo apt full-upgrade

不要なパッケージの削除

$ sudo apt autoremove --purge 

システムの再起動

WSL2からexitで抜け、Powershell または terminal 等のアプリで、以下を実行。

> wsl --shutdown

単にPCを再起動しても可。

WSL2のDebianがアップグレードした

WSLのアップグレードの参考になれば幸い。

関連ページ