<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Wsl on kenji.blog</title><link>http://kenji.blog/zh-cn/tags/wsl/</link><description>Recent content in Wsl on kenji.blog</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><copyright>kenjinote</copyright><lastBuildDate>Sun, 31 Mar 2024 16:57:33 +0900</lastBuildDate><atom:link href="http://kenji.blog/zh-cn/tags/wsl/index.xml" rel="self" type="application/rss+xml"/><item><title>在 WSL 中出现“Temporary failure resolving～”时的解决方法</title><link>http://kenji.blog/zh-cn/p/wsl-%E3%81%A7temporary-failure-resolving%E3%81%A8%E8%A1%A8%E7%A4%BA%E3%81%95%E3%82%8C%E3%82%8B%E5%A0%B4%E5%90%88%E3%81%AE%E5%AF%BE%E5%87%A6%E6%96%B9%E6%B3%95/</link><pubDate>Sun, 31 Mar 2024 16:57:33 +0900</pubDate><guid>http://kenji.blog/zh-cn/p/wsl-%E3%81%A7temporary-failure-resolving%E3%81%A8%E8%A1%A8%E7%A4%BA%E3%81%95%E3%82%8C%E3%82%8B%E5%A0%B4%E5%90%88%E3%81%AE%E5%AF%BE%E5%87%A6%E6%96%B9%E6%B3%95/</guid><description>&lt;img src="http://kenji.blog/p/wsl-%E3%81%A7temporary-failure-resolving%E3%81%A8%E8%A1%A8%E7%A4%BA%E3%81%95%E3%82%8C%E3%82%8B%E5%A0%B4%E5%90%88%E3%81%AE%E5%AF%BE%E5%87%A6%E6%96%B9%E6%B3%95/img.png" alt="Featured image of post 在 WSL 中出现“Temporary failure resolving～”时的解决方法" />&lt;h1 id="在-wsl-中出现temporary-failure-resolving时的解决方法">在 WSL 中出现“Temporary failure resolving～”时的解决方法
&lt;/h1>&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">kenji@MyComputer:~$ sudo apt update
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">[sudo] password for kenji:
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Temporary failure resolving &amp;#39;archive.ubuntu.com&amp;#39;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>当在 WSL 中显示上述错误时，可能是 DNS 服务器的设置不正确。
在我的环境中，通过以下步骤解决了该问题。&lt;/p>
&lt;ol>
&lt;li>启动 WSL。&lt;/li>
&lt;li>运行 &lt;code>sudo nano /etc/resolv.conf&lt;/code>。&lt;/li>
&lt;li>将 &lt;code>nameserver&lt;/code> 的行更改如下：&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">nameserver 8.8.8.8
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;ol start="4">
&lt;li>按 &lt;code>Ctrl&lt;/code> + &lt;code>S&lt;/code> 保存，然后按 &lt;code>Ctrl&lt;/code> + &lt;code>X&lt;/code> 退出。&lt;/li>
&lt;li>运行 &lt;code>sudo apt update&lt;/code>。&lt;/li>
&lt;li>如果没有显示错误，说明问题已解决。&lt;/li>
&lt;/ol>
&lt;h2 id="如果上述步骤未能解决问题">如果上述步骤未能解决问题
&lt;/h2>&lt;p>似乎也有上述步骤无法解决问题的情况。请参考以下文章。&lt;/p>
&lt;ul>
&lt;li>&lt;a class="link" href="https://qiita.com/ryosukeYamazaki/items/c04ec3ff78aac6eb8d26" target="_blank" rel="noopener"
>在 WSL 中 apt update 时出现『Temporary failure resolving ～』的解决方法&lt;/a>&lt;/li>
&lt;/ul></description></item></channel></rss>