3
1

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.

wsl2で、systemdを使う(2022年10月21日)

Last updated at Posted at 2022-10-21

まず、WSLをMicrosoft Store経由でアップデートする

※ Windows 11 Professional 22H2 で確認。Windows10 や 21H2 とかだと不明

  • 予めWSLそのものはインストールしておくこと。
  • Microsoft Store経由でアップデートできるようにする(wsl.exe --updateコマンドでアップデートさせる)
  • wsl,exe --versionコマンドで、以下のバージョンになったことを確認する
  • WSL バージョン: 0.70.0.0(もしくはこれより最新版)
  • お好きなディストリビューションをインストールする(自分はAlmaLinux9で確認)
  • AlmaLinux9など、ディストリビューションを立ち上げ入る
  • vi /etc/wsl.conf で開き
[boot]
systemd=true

を追加しておく

  • とりあえず、wsl.exe --shutdownwsl.exe --start AlmaLinux9 として再起動させ、wslのlinuxに入って systemctl status hogehoge として、PID1 hoge みたいなのが出なければ使えるようになったよ判定できるかと。

将来的には、この wsl.conf に書かなくてもよくなるとかありましたが、0.70では、入れないと systemctl を実行しようとすると PID1 エラーが出る状態でした

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?