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

WSL2でinterop enabled=trueなのにWindows EXEが起動しなくなった場合のメモ

Posted at

概要

WSL2 Linuxシステムを動かしてる環境で
なぜか各種Windows EXEを実行させようとすると
"Invalid argument"になってしまいました

$ /mnt/c/Windows/System32/notepad.exe &
/mnt/c/Windows/System32/notepad.exe : Invalid argument

環境

PS> wsl.exe --status
既定のディストリビューション: Fedora
既定のバージョン: 2
WSL1 は、現在のマシン構成ではサポートされていません。
WSL1 を使用するには、"Linux 用 Windows サブシステム" オプション コンポーネントを有効にしてください。

PS> wsl.exe --version
WSL バージョン: 2.3.26.0
カーネル バージョン: 5.15.167.4-1
WSLg バージョン: 1.0.65
MSRDC バージョン: 1.2.5620
Direct3D バージョン: 1.611.1-81528511
DXCore バージョン: 10.0.26100.1-240331-1435.ge-release
Windows バージョン: 10.0.26100.2454
$ cat /etc/wsl.conf
[boot]
systemd = true

[interop]
enabled = true
appendWindowsPath = false

[automount]
enabled = true
options = "metadata,uid=1000,gid=1000,umask=22,fmask=11,case=off"
mountFsTab = true

[network]
generateHosts = true
generateResolvConf = true

対処方法

  1. WSL2 Linuxシステムにてsystemdを利用している場合は、一旦/etc/wsl.confを書き換え、systemd=falseにして保存し全shellは閉じる
  2. Windows上のCMD or PowerShellからwsl.exe --shutdown
  3. WSL2 Linuxシステムを起動
  4. 一度適当なWindows EXEが動くか確認
  5. 再度 /etc/wsl.confを書き換え、systemd=trueに戻す
  6. Windows上のCMD or PowerShellからwsl.exe --shutdown
  7. 再度WSL2 Linuxシステムを起動
  8. Windows EXEが動くか確認

これで直りました

1の段階では
/proc/sys/fs/binfmt_misc/WSLInterop-late
が存在せず、
8まで進んだところ
/proc/sys/fs/binfmt_misc/WSLInterop-late
が見えるようになりました

固有環境だけの問題かもしれませんが、覚えとして残しておきます

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