Visual Studio Code version 1.86.0-insiderで引数password-store=gnomeが機能しない

Visual Studio Code version 1.86.0-insiderで引数password-store=gnomeが機能しない

Visual Studio Code version 1.86.0-insidersではpassword-store引数に対するgnomeおよびgnome-keyringの指定が機能しない.調べたところ,これはVS Codeの依存するElectronのバージョンが25.9.7から27.1.3に更新されたことに起因しているようだ.この更新によりChromiumのバージョンも上がり,password-storeが受け入れる引数が変更された.libsecretを使用している場合,この問題はpassword-storeにgnome-libsecretを指定することで解決することができる.

Tags: vscode
Takafumi Asano · 9 minute read

TL;DR

VS Code 1.86.0から引数password-storeに指定できる引数gnomegnome-keyringが廃止されるようだ.

libsecretを使っているのなら,password-store=gnome-libsecretを指定することで解決する.

  • VS Code 1.86.0-insiders - commit: 4caba0473af34a2b128cedc46f6b13316aae9226でコマンドライン引数password-store=gnomeが機能しない現象を確認した
  • VS Codeが依存しているElectronのバージョンが25.9.7から27.1.3に更新されたことに起因

VS Code 1.86が正式リリースされれば多分リリースノートに記載されるだろうし,Troubleshootingの記事も修正されると思うので,困る人は少ないだろう.

導入

私はNixOS上でVisual Studio Code Insidersを使用している.

何気なくversion 1.86.0-insiders(commit: 4caba0473af34a2b128cedc46f6b13316aae9226)に更新したところ,以前の記事にも記載した,OSのキーリングが特定できないことに起因するエラーが出るようになった.

前提

使用しているVS Codeのバージョン情報は以下の通りである.

Version: 1.86.0-insider
Commit: 4caba0473af34a2b128cedc46f6b13316aae9226
Date: 2024-01-08T05:36:26.930Z
Electron: 27.1.3
ElectronBuildId: 25612240
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Linux x64 6.6.7

~/.vscode-insiders/argv.jsonは以下の通り.

// This configuration file allows you to pass permanent command line arguments to VS Code.
// Only a subset of arguments is currently supported to reduce the likelihood of breaking
// the installation.
//
// PLEASE DO NOT CHANGE WITHOUT UNDERSTANDING THE IMPACT
//
// NOTE: Changing this file requires a restart of VS Code.
{
        // Use software rendering instead of hardware accelerated rendering.
        // This can help in cases where you see rendering issues in VS Code.
        // "disable-hardware-acceleration": true,

        // Allows to disable crash reporting.
        // Should restart the app if the value is changed.
        "enable-crash-reporter": true,

        // Unique id used for correlating crash reports sent from this instance.
        // Do not edit this value.
        "crash-reporter-id": "********-****-****-****-************",

        "password-store": "gnome"
}

対処

さて,前述の通り,password-storにはgnomeが設定されている.以前はこれで問題なかったのだが,なぜだろうか.ログを見てみよう.

$ code --password-store="gnome" --verbose --vmodule="*/components/os_crypt/*=1" .
[...]
[3016789:0108/192814.394438:VERBOSE1:key_storage_util_linux.cc(52)] Password storage detected desktop environment: (unknown)
[3016789:0108/192814.394469:VERBOSE1:key_storage_linux.cc(118)] Selected backend for OSCrypt: BASIC_TEXT
[3016789:0108/192814.394510:VERBOSE1:key_storage_linux.cc(137)] OSCrypt did not initialize a backend.
[...]

注目すべきは,Password storage detected desktop environment: (unknown)となっているところだ.

実行時に引数で--password-store="gnome"を設定している場合,ここはGNOME_ANYになることが期待値なのだが,どうやらこの引数が認識されずBASIC_TEXTしてしまっている.

以前の記事のYou're running in a GNOME Environment but the OS keyring is not available for encryptionという項目でも書いた通り,この部分の処理はChromiumにあるOSCryptというコンポーネントである.

おそらく,VS Codeが依存するElectronのバージョンが更新されたことで,Chromiumのバージョンが上がり,password-storeが受け入れることのできる引数が変わったのだろう.

VS CodePRを見てみると,それっぽいものを見つけた.

chore: update to electron 27 #197539

Electronのバージョンが25.9.7から27.1.3にバージョンアップされている.メジャーバージョンで2つ上がっているので,破壊的な変更もありそうだ.

次に,それぞれが依存しているChromiumのバージョンを調べてみる.

それぞれ,

  • Chromium 118.0.5993.159
  • Chromium 114.0.5735.289

に依存している.

該当するバージョンのドキュメントを見ると,114.0.5735.289ではpassword-store="gnome"をサポートしているが,118.0.5993.159ではgnomegnome-keyringが廃止され,gnome-libsecretのみとなっている

gnome-keyringの使用が非推奨であったことを考えると,gnome-keyringの廃止とともにgnomeが廃止されるのは当然であろう.

原因がわかれば対処は簡単で,password-storegnome-libsecretを指定すれば良い.

~/.vscode-insiders/argv.jsonは最終的に以下のようになった.

// This configuration file allows you to pass permanent command line arguments to VS Code.
// Only a subset of arguments is currently supported to reduce the likelihood of breaking
// the installation.
//
// PLEASE DO NOT CHANGE WITHOUT UNDERSTANDING THE IMPACT
//
// NOTE: Changing this file requires a restart of VS Code.
{
        // Use software rendering instead of hardware accelerated rendering.
        // This can help in cases where you see rendering issues in VS Code.
        // "disable-hardware-acceleration": true,

        // Allows to disable crash reporting.
        // Should restart the app if the value is changed.
        "enable-crash-reporter": true,

        // Unique id used for correlating crash reports sent from this instance.
        // Do not edit this value.
        "crash-reporter-id": "********-****-****-****-************",

        "password-store": "gnome-libsecret"
}

Appendix

Chromiumでいつこの引数が変更になったのかを調べてみた.

どうやら,116.0.5834.0で廃止されたようだ.