<?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-tw/tags/wsl/</link><description>Recent content in Wsl on kenji.blog</description><generator>Hugo -- gohugo.io</generator><language>zh-tw</language><copyright>kenjinote</copyright><lastBuildDate>Sun, 31 Mar 2024 16:57:33 +0900</lastBuildDate><atom:link href="http://kenji.blog/zh-tw/tags/wsl/index.xml" rel="self" type="application/rss+xml"/><item><title>解決在 wsl 中顯示「Temporary failure resolving～」錯誤的方法</title><link>http://kenji.blog/zh-tw/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-tw/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>