Windows & WSL2 & YubiKey

Windows & WSL2 & YubiKey

npiperelay.exe の実行に時間がかかる(2024/03)

事象

2024/03 頃から、WSL2 内で ssh-add -l を叩いて標準出力に出力されるまでに時間がかかるようになった。

1 秒かからないときもあれば、ときどき 5 秒もかかる。

ssh-add -l  0.00s user 0.00s system 0% cpu 0.490 total
ssh-add -l  0.00s user 0.00s system 0% cpu 0.248 total
ssh-add -l  0.00s user 0.00s system 0% cpu 0.249 total
ssh-add -l  0.00s user 0.00s system 0% cpu 0.272 total
ssh-add -l  0.00s user 0.00s system 0% cpu 0.257 total
ssh-add -l  0.00s user 0.00s system 0% cpu 5.253 total

npiperelay.exe は WSL2 側のホームディレクトリ配下にシンボリックリンクではなく素直に配置している状況だった。

socat UNIX-LISTEN:/home/sbdn/.ssh/agent.sock,mode=600,fork EXEC:/home/sbdn/.ssh/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent,nofork

解決

npiperelay.exe を Windows 側に置いて、それを WSL2 側の socat から呼び出すことで解決した。

https://github.com/sobadon/dotfiles/commit/17a489ded597c88b5079046a71fa69ab4fbcb0a7

socat UNIX-LISTEN:/home/sbdn/.ssh/agent.sock,mode=600,fork EXEC:/mnt/c/Users/sbdn/wsl2_tools/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent,nofork
ssh-add -l  0.00s user 0.00s system 5% cpu 0.039 total
ssh-add -l  0.00s user 0.00s system 6% cpu 0.032 total
ssh-add -l  0.00s user 0.00s system 6% cpu 0.032 total
ssh-add -l  0.00s user 0.00s system 6% cpu 0.032 total
ssh-add -l  0.00s user 0.00s system 6% cpu 0.032 total
ssh-add -l  0.00s user 0.00s system 6% cpu 0.032 total
最終更新日