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?

WSLで入れたKali LinuxでGemini CLIのブラウザ認証が起動しない

Posted at

Abstract

WSL2上のKali Linuxにて、Google Gemini CLIを導入した際、gemini コマンド実行後にブラウザ認証が起動しない問題が発生した
色々試したら単にWSL側からWindows側のアプリケーションを起動するinteropの調子が悪いらしいだけだったらしく、一回wsl --shutdownしたら直った


作業環境

ホストOS(Windows側)

  • OS:Windows 11 23H2(ビルド 22631.5624)
  • WSL バージョン:2.4.13.0
  • Linux カーネル:5.15.167.4-1
  • WSLg バージョン:1.0.65

WSL側(Kali Linux)

  • OS:Kali GNU/Linux Rolling 2025.1
  • カーネル:5.15.167.4-microsoft-standard-WSL2

発生した問題

新規にインスタンスを立ててGemini CLIのインストールのみ行った状態のWSL上のKali Linuxにて gemini コマンドを実行し、ブラウザ認証を選択したところ、Windows側のブラウザが起動しないという問題が発生
gemini --debug により認証URLを取得し、手動でブラウザに貼り付けることで認証はできる
WSLのインスタンスを何回か作り直しても同じ事象が起きる


調べたこと

xdg-open の挙動確認

xdg-open https://www.google.com

結果:

/usr/bin/xdg-open: 1050: rundll32.exe: Exec format error

xdg-open が Windows の rundll32.exe を呼び出そうとして失敗してる

powershell.exe の直接呼び出し

powershell.exe /c start https://www.google.com

結果:

cannot execute binary file: Exec format error

→ そもそもWindows側のアプリ開けなくなってそう

ダメ押しでnotepad.exe の呼び出しで確認

notepad.exe

結果:

cannot execute binary file: Exec format error

→ やっぱり.exe呼び出し全般死んでそう


解決手順

色々試したけど結局PowerShellからWSLを停止したら直った

wsl --shutdown

おわりに

interopからのWindows側アプリケーション呼び出しがこんな感じに失敗するの見たことなかったけど最近なんかアプデあったんかな?
最近GeminiCLI色々遊んでるけど無料でこれ使えるのすごい
GUIポチポチアレルギー的にはCLIから操作できるってだけで最高


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?