问题描述
在下载安装包的时候一直卡在0% [Waiting for headers],报错信息
如下:
Get:1 file:/var/cudnn-local-repo-ubuntu1804-8.5.0.96 InRelease [1,575 B]
Get:1 file:/var/cudnn-local-repo-ubuntu1804-8.5.0.96 InRelease [1,575 B]
Get:2 file:/var/cudnn-local-repo-ubuntu1804-8.5.0.96 Packages [950 B]
Get:3 https://dl.google.com/linux/chrome/deb stable InRelease [1,825 B]
Get:4 https://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1,088 B]
Get:5 https://packages.microsoft.com/repos/edge stable InRelease [3,569 B]
Ign:6 https://ppa.launchpadcontent.net/jonathonf/ffmpeg-4/ubuntu jammy InRelease
Get:7 https://packages.microsoft.com/repos/edge stable/main amd64 Packages [8,803 B]
Err:8 https://ppa.launchpadcontent.net/jonathonf/ffmpeg-4/ubuntu jammy Release
404 Not Found [IP: 2620:2d:4000:1::3e 443]
0% [Waiting for headers]
解决方案
sudo rm -rf /var/lib/apt/lists/*
sudo rm -rf /var/lib/apt/lists/partial/*
cd /var/cache/apt/archives
sudo rm -rf partial
以上命令都是清理缓存文件。
如果清除缓存文件之后还是遇到waiting for headers,那就更换国内源
#备份现有源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
#查看当前版本
cat /etc/issue
#修改文件,替换下面软件源,删除文件所有内容,替换对应版本的源,见Ubuntu国内源
sudo vim /etc/apt/sources.list
#更新列表
sudo apt-get update
即在sudo vim /etc/apt/sources.list
的这一步,将其中的内容全部注释掉。如下:
在前面没打#
的地方加上#
。
然后在最前面加上:(注意我的版本是ubuntu-22.04,其余版本参加下面链接。或者试一下也可以。)
deb http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse
Ubuntu镜像使用帮助:https://mirrors.163.com/.help/ubuntu.html文章来源:https://www.toymoban.com/news/detail-634605.html
大功告成!文章来源地址https://www.toymoban.com/news/detail-634605.html
到了这里,关于成功解决ubuntu-22.04的sudo apt-get update一直卡在【0% [Waiting for headers]】的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!