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

VirtualBox中Ubuntu无法执行apt-get update及网络故障求助

Hey there! No need to apologize at all—we’ve all been the newbie stuck on weird network glitches in VMs before. Let’s walk through fixing your Ubuntu 17.04 connectivity issues step by step, since that’s likely the root cause of both your apt-get update failure and Firefox not opening.

Step 1: Double-Check VirtualBox Network Settings

First, let’s rule out issues with how your VM is connected to your host’s network:

  • Open VirtualBox, select your Ubuntu VM, then click the Settings (gear) icon.
  • Navigate to the Network tab. Confirm:
    • The "Enable Network Adapter" box is checked (it’s easy to accidentally uncheck this!).
    • For most home setups, set Network Connection to NAT—this lets your VM share your host’s internet connection automatically.
    • If NAT isn’t working, try switching to Bridge Adapter (this connects your VM directly to your local network like a separate device).
  • Click OK, then restart your Ubuntu VM to apply changes.
Step 2: Verify Ubuntu’s Network Detection

Next, check if your VM recognizes the network adapter and has an IP address:

  1. Open a terminal (press Ctrl+Alt+T).
  2. Run this command to list available network interfaces:
    ip link show
    
    You should see an interface like enp0s3 (the name might vary). If nothing shows up, your VM isn’t detecting the adapter—install VirtualBox Guest Additions by going to Devices > Insert Guest Additions CD Image in the VM window, then follow the on-screen prompts to install.
  3. Check if you have an active IP address:
    ip addr
    
    Look for an inet entry under your network interface (e.g., 192.168.1.x). If there’s no IP, restart the network service:
    sudo systemctl restart networking.service
    
Step 3: Fix DNS Resolution (If You Can Ping IPs But Not Domains)

If you can ping 8.8.8.8 (Google’s public DNS) but can’t ping google.com, your DNS settings are broken:

  1. Edit the resolv.conf file:
    sudo nano /etc/resolv.conf
    
  2. Add these lines to use Google’s DNS servers:
    nameserver 8.8.8.8
    nameserver 8.8.4.4
    
  3. Save the file (press Ctrl+O, hit Enter, then Ctrl+X to exit).
  4. Test if domain resolution works:
    ping google.com
    
    If this works, try running sudo apt-get update again.
Step 4: Address Ubuntu 17.04’s End-of-Life Repository Issue

Wait a critical note: Ubuntu 17.04 reached End of Life (EOL) in January 2018. The official repositories are no longer hosted on the main servers, which is probably why apt-get update fails even if your network works! To fix this:

  1. Backup your current sources list first:
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
    
  2. Edit the sources file:
    sudo nano /etc/apt/sources.list
    
  3. Replace every instance of archive.ubuntu.com and security.ubuntu.com with old-releases.ubuntu.com. For example, change:
    deb http://archive.ubuntu.com/ubuntu zesty main
    to:
    deb http://old-releases.ubuntu.com/ubuntu zesty main
  4. Save and exit, then run:
    sudo apt-get update
    
Step 5: Troubleshoot Firefox (Once Network is Working)

If your network is fixed but Firefox still won’t open:

  • Launch Firefox from the terminal to see error messages:
    firefox
    
    Look for clues like profile corruption or proxy issues.
  • Check proxy settings: If you can open Firefox, go to Preferences > Network Settings and ensure "Use system proxy settings" or "No proxy" is selected (avoid manual proxy unless you use one).
  • Try a new profile if Firefox crashes:
    firefox -P
    
    Follow the prompts to create a new profile, then launch Firefox with it to test.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 07:22:14