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?

Windows 11 の SSH 経由で Scoop でインストールしたツールが使えない

0
Posted at

症状

Windows 11 に SSH 接続すると、Scoop で入れたコマンドが見つからなくなる現象が発生する。

  • git: The term 'git' is not recognized ...
  • oh-my-posh のプロンプトが反映されない

同じユーザーでローカルの Windows Terminal から PowerShell を開くと正常である。

原因

Scoop はバージョン切替に current を Junction(reparse point)として作るが、SSH セッションから current がトラバース不能になっていた。

GitHub の報告でも、current 配下を SSH 経由で実行すると「untrusted mount point を含むためパスを辿れない」となり、バージョン番号の付いた実体ディレクトリでは発生しない旨が書かれている。

当該のWindowsアップデートを削除すれば解決する

切り分け

SSH セッションで次を確認すると、実体は見えるのに current だけ壊れていることが分かる。

PS C:\Users\Admin> Test-Path C:\Users\Admin\scoop\apps\git\2.53.0\cmd\git.exe 
True

PS C:\Users\Admin> Test-Path C:\Users\Admin\scoop\apps\git\current\cmd\git.exe 
False

PS C:\Users\Admin> Get-Item C:\Users\Admin\scoop\apps\git\current -Force | Format-List FullName,Attributes,LinkType,Target 
FullName : C:\Users\Admin\scoop\apps\git\current 
Attributes : ReadOnly, Directory, ReparsePoint, NotContentIndexed 
LinkType : Junction 
Target : C:\users\admin\scoop\apps\git\2.53.0

解決手順

管理者権限のターミナル(PowerShell でも cmd でも可)で実行する。

wusa /uninstall /kb:5077181

Windows再起動

wusa /uninstall /kb:5074105

再度Windows を再起動

参考

[Bug] The current junction folder cannot be accessed over SSH since KB5074105 #6594

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?