问题描述
在执行sudo apt-get update时,显示如下错误:
命中:1 http://dl.google.com/linux/chrome/deb stable InRelease
命中:2 http://us.archive.ubuntu.com/ubuntu focal InRelease
命中:3 http://ppa.launchpad.net/system76/pop/ubuntu focal InRelease
命中:4 http://us.archive.ubuntu.com/ubuntu focal-security InRelease
命中:5 http://apt.pop-os.org/proprietary focal InRelease
命中:6 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
命中:7 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
忽略:8 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ InRelease
错误:9 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Release
Could not wait for server fd - select (11: 资源暂时不可用) [IP: 13.224.161.101 443]
正在读取软件包列表… 完成
E: 仓库 “https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Release” 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
查了一下,发现是因为文件库列表中https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/这个源已经不安全了,没有办法用它来进行更新,所以解决办法就是禁用它。
解决办法
找到这个源所在的文件:
sudo grep -e "https://cloud.r-project.org/bin/linux/ubuntu" $(find /etc/apt/ -name "*.list")
注意这里要把源链接替换成自己报错的那个源,我这里是:https://cloud.r-project.org/bin/linux/ubuntu
上面代码运行结果是:
/etc/apt/sources.list:deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/
/etc/apt/sources.list:# deb-src https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/
说明该源在 /etc/apt 目录下的sources.list文件里,因此,需要去这个目录下,用文本编辑器打开该sources.list文件,把含有该源的那行代码注释掉或者删掉:
cd /etc/apt/
sudo gedit sources.list
这样打开了sources.list文件后,找到我报错的源, deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/,在前面加上#号注释掉
#deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/
保存文件关闭后,再执行sudo apt-get update就没问题了。