【WSL】Ubuntuメジャーバージョンのアップグレード方法(22.04 -> 24.04)
投稿日: 更新日:
環境💻
- Windows11 Home 23H2
- WSL2 Ubuntu 22.04
現状
アップグレード前のバージョンは以下の通りです。
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
アップグレード方法
0. バックアップ
仮に失敗してしまっても良いように重要なデータはバックアップを取っておきましょう。
1. パッケージの更新
いつも通りに更新します。
$ sudo apt update -y
$ sudo apt upgrade -y
2. アップグレード
まずは更新可能かどうか確認します。
$ sudo do-release-upgrade -c
Checking for a new Ubuntu release
New release '24.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
New release '24.04.1 LTS' available.
とあるので更新可能であることが分かります。
それでは以下のコマンドで更新します。
$ sudo do-release-upgrade
$ sudo do-release-upgrade
(中略...)
Continue [yN]
Continue [yN]
と出てきたらy
を入力しEnter。
To continue please press [ENTER]
これはEnterを押してください。
Continue [yN] Details [d]
こちらもy
を入力しEnter。
途中で以下のようなものが出てきたときはyes
で構いません。
There are services installed on your system which need to be restarted when certain libraries, such as libpam, libc, and libssl, are upgraded. Since these restarts may cause interruptions of service for the system, you will normally be prompted on each upgrade for the list of services you wish to restart. You can choose this option to avoid being prompted; instead, all necessary restarts will be done for you automatically so you can avoid being asked questions on each library upgrade.
Restart services during package upgrades without asking?
内容としては、「特定のライブラリをアップグレードする際にシステムの再起動が必要になります。その際に毎回警告を表示するかどうかを選択できますが、再起動時に警告を出さずに自動的に進めてもよいですか?」
確認
ちゃんと24.04になっています。
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: noble