Ubuntu 16.04.4 LTS下apt update卡在0% Working问题求助
解决Ubuntu 16.04.4 LTS apt update卡在"0% Working"的问题
我之前在Ubuntu 16.04上也碰到过一模一样的apt update卡0%的情况,结合你提供的系统和网络信息,给你几个针对性的排查和解决步骤,你可以挨个试试:
1. 切换到国内Ubuntu源(优先尝试)
虽然你能ping通Ubuntu官方站点,但官方源在国内的访问速度或者稳定性可能不够,导致卡住。建议换成国内镜像源:
- 先备份当前源配置,避免出错:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak - 编辑源文件:
sudo nano /etc/apt/sources.list - 把文件里的内容全部替换成阿里云的16.04专属源:
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse - 按
Ctrl+O保存,Ctrl+X退出,然后重新执行:sudo apt update
2. 检查并清除apt代理配置
有时候残留的代理设置会导致apt无法正常连接源,即使你系统全局没设代理:
- 查看是否有apt代理配置文件:
cat /etc/apt/apt.conf.d/00proxy - 如果文件里有代理相关内容,先备份再清空:
sudo cp /etc/apt/apt.conf.d/00proxy /etc/apt/apt.conf.d/00proxy.bak sudo echo "" > /etc/apt/apt.conf.d/00proxy - 也可以临时跳过代理执行update:
sudo apt -o Acquire::http::Proxy="" update
3. 清理apt缓存并修复缺失的索引
缓存损坏也可能导致卡住,试试清理后重新生成:
sudo apt clean sudo apt update --fix-missing
4. 测试源地址的HTTP连通性
虽然能ping通站点,但HTTP请求可能有问题,用curl测试源的索引文件:
curl -I http://mirrors.aliyun.com/ubuntu/dists/xenial/InRelease
如果返回HTTP/1.1 200 OK说明连通正常,要是返回超时或者其他错误,可能是网络层面的问题(比如防火墙、ISP限制)。
内容的提问来源于stack exchange,提问作者Amaroc
相关产品推荐
相关产品推荐

