You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu Server更新时出现es.archive.ubuntu.com解析失败DNS问题求助

Fixing "Temporary failure resolving 'es.archive.ubuntu.com'" on Ubuntu (No resolvconf installed)

Hey there, I’ve dealt with this exact DNS issue a few times on Ubuntu servers without resolvconf, so let’s walk through the fixes step by step.

First: Verify Your /etc/network/interfaces Config

First off, double-check that your DNS settings are correctly added in /etc/network/interfaces. You should have a dns-nameservers line under your network interface block, like this:

Example valid config snippet:

auto eth0
iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 8.8.8.8 8.8.4.4  # Google Public DNS servers

If this line is missing or has invalid DNS addresses, add correct ones first.

Step 1: Temporary DNS Fix (Test If It Works)

Since you don’t have resolvconf, Ubuntu won’t automatically populate /etc/resolv.conf from your interfaces file. Let’s manually set it up to test:

  • Back up your empty resolv.conf first:
    sudo cp /etc/resolv.conf /etc/resolv.conf.bak
    
  • Edit the file with a text editor:
    sudo nano /etc/resolv.conf
    
  • Add these lines (use any reliable DNS servers you prefer):
    nameserver 8.8.8.8
    nameserver 8.8.4.4
    
  • Save and exit (Ctrl+O, Enter, then Ctrl+X in nano).
  • Test if resolution works:
    ping es.archive.ubuntu.com
    

If you get responses, the DNS issue is resolved temporarily. Now let’s make this permanent.

Step 2: Permanent Fix (Prevent resolv.conf From Being Overwritten)

Ubuntu might use tools like systemd-resolved that overwrite /etc/resolv.conf automatically. Here’s how to lock in your static DNS:

  1. Check if systemd-resolved is running:
    systemctl status systemd-resolved
    
  2. If it’s active, disable and stop it:
    sudo systemctl disable --now systemd-resolved
    
  3. If /etc/resolv.conf is a symbolic link (common with systemd-resolved), remove it:
    sudo rm /etc/resolv.conf
    
  4. Recreate the static resolv.conf file with your DNS servers (same as step 1):
    sudo nano /etc/resolv.conf
    
  5. Make the file immutable so no service can overwrite it:
    sudo chattr +i /etc/resolv.conf
    

Step 3: Reload Network Settings

Finally, restart your network service to ensure all changes take effect:

sudo systemctl restart networking
# Or for older Ubuntu versions:
# sudo /etc/init.d/networking restart

Test the update command again:

sudo apt update

It should now resolve the repository URL without errors.

内容的提问来源于stack exchange,提问作者Yus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:43:20