LoginSignup
106
53

More than 3 years have passed since last update.

WSL2が突然動かなくなって公式Issueが荒れてる話

Posted at

概要

WSL2で困ったときに使う魔法の呪文の次の日ぐらいから、突然、会社のPCのWSL2が動かなくなりました。
自分はかなり致命的で、WSL2が動かないと仕事にならないレベルだったのでだいぶ焦りました。
そんな人用への解決方法を書いておきます。

事象

wslを起動しようとすると、bashが起動せず、以下のようなメッセージが出ます。

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

日本語だと、「接続に失敗しました」みたいな文面が表示されます。(スクショを取り忘れた)

解決方法

環境変数のPathを短くする

嘘みたいな解決方法ですが、そんな感じです。

WSL2-Error: A connection attempt failed on Windows 19555.1001 #4860

We were able to debug what the issue is here and are pushing the fix. This issue triggers if you have a somewhat a long %PATH%, so one potential workaround (until a new build comes out with the fix) would be to do some "spring cleaning" on your %PATH% variable to make it shorter.

Windowsの検索窓に「環境変数」と入れて、「環境変数の編集」からPathの環境変数の中から、いらないものを消します。

image.png

公式のドキュメントがないのですが、2048ぐらいが上限っぽいです。

ただ、私の場合は、1004文字ぐらいだったのを、900字ぐらいまで削ると動くようになりました。
(Windows版のPythonを入れて、Pathを通していたのですが、やむなく消しました。)

ことの顛末

2,3日前にこのバグをひき、やべぇやべぇ仕事できねぇ。と一人慌てていましたが、TwitterのTLで騒いでる人がいなくて、アレー?となって、なおかつ、Google先生も解決方法も教えてくれない。
というわけで、Twitterの検索で、最新のツイートから片っ端から見ていったら見つけたのが、先述した、

WSL2-Error: A connection attempt failed on Windows 19555.1001 #4860

でした。で、中の人がPATH削ったら動くよ!と言っていたので、それをまねしたらうごくようになりました。
で、この記事を書くためにフォーラムをのぞき込んでみると・・・(日本語部分は機械翻訳です)

Same Problem here, I really can't believe how you play with our environments. Don't you have a QA department to test all of this things? I'm contractor, who will pay for the hours that I'll have to lose to fix this?.

C'mon, be professional guys, for once in life.

ここで同じ問題がありますが、私たちの環境であなたがどのように遊ぶかは本当に信じられません。このすべてをテストするQA部門はありませんか?私は請負業者です。これを修正するために失う必要がある時間を誰が支払うのですか?

? さあ、人生で一度だけ、プロの男になってください。

とか

The insiders program is part of the testing, for before features are pushed to the masses.

I'd argue that it's irresponsible/unprofessional to depend solely on the stability of insiders to do your job, especially when virtual box + remote-ssh in vscode works just as well as wsl remoting does.

That's not to say that this issue isn't an inconvenience, but the entitlement being displayed here by many is laughable.

Well, after WSL2 was realesed, users tested and loved it, in the way that it works right now. Since it's functionalities proved to be reliable and usable for daily work, we adopted it into our dev-environments. So we expect at least the core features to work, which already have been tested and verified. And we can at least expect that, can't we? It's not like we're whining and crying about some announced and untested nice-to-have features.

機能が大衆にプッシュされる前に、インサイダープログラムはテストの一部です。

特に、vscodeの仮想ボックス+リモートsshがwslリモーティングと同様に機能する場合、インサイダーの安定性だけに頼って仕事をするのは無責任/非専門的だと主張します。

それは、この問題が不便ではないということではありませんが、多くの人がここに表示している権利は笑えるものです。

さて、WSL2が実現された後、ユーザーは今のようにテストし、それを愛しました。この機能は信頼性が高く、日常業務に使用できることが証明されているため、開発環境に採用しました。したがって、少なくともコア機能が動作することを期待しています。これらはすでにテストおよび検証されています。そして、少なくともそれは期待できますよね?発表された未テストの便利な機能について泣き言を言っているわけではありません。

とか。なかなか辛めのことが書かれてるなーと思ってたら、最後にWSLの開発者の方が

Not to split hairs, but WSL2 has still not officially "released" - It is still only in Insider builds.

If you are on the Fast ring you will occasionally be impacted by bugs in WSL or other components. Having insiders test pre release versions of Windows is invaluable, and catches things like this that were missed during testing. Rolling back builds takes minutes, it is no great hardship.

髪を分割しないでください、しかし、WSL2はまだ公式に「リリース」されていません-それはまだインサイダービルドでのみです。

高速リングを使用している場合、WSLまたはその他のコンポーネントのバグの影響を受けることがあります。インサイダーがWindowsのプレリリースバージョンをテストすることは非常に貴重であり、テスト中に見逃したこのようなものをキャッチします。ビルドのロールバックには数分かかりますが、大きな苦労はありません。

となった後、

image.png

アチャー

ところで、WSL2はInsiderプログラムに登録しておかないと使えません。ちょっと前では、Fast Ringという最新版が使える(≒最新版だからちょっとバグを許容してよね!)ものでしか、WSL2は利用できなかったのですが、Slow Ringという比較的安定した版でも使えるようになったようです。なので、これほどリスクを負わず、WSL2の恩恵にあずかれそうです。興味のある方は、Slow Ringから始めてみては?こんなこと書いてますが、私は好きですよ。WSL2。

106
53
1

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
106
53