【BUG解决】sudo apt-get update 报错 E: The repository ‘http://xxx Release‘ does not have a Release file.

2023-05-16

BUG描述

前两天在虚拟机Vmware中安装了Ubuntu18.04操作系统,因为需要安装其他工具。所以想着执行命令

sudo apt-get update

更新一下系统,以便进行安装。结果出现“E: The repository ‘http://xxx Release‘ does not have a Release file.”以及“E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache > /dev/null; fi'”的报错。

BUG解决思路

解决办法是:修改系统源文件sources.list的源地址;如果未解决,检查网络是否被监控,切换其他网络试试,例如开一个手机热点;更新过于老旧或者缺少的软件包

BUG详细解决办法

一、修改系统源文件sources.list的源地址;

1、首先,先备份原来源文件sources.list

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bcakup

2、使用gedit编辑,更改源文件sources.list内容

执行命令:

sudo gedit /etc/apt/sources.list

 删除sources.list内容,并将以下内容全部复制到sources.list中

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

保存文件,退出。

3、重新执行更新命令,更新软件列表,检测出可以更新的软件。

sudo apt-get update

如果你那边已经解决了,没有其他bug就可以不用看以下内容了。但我按照上面操作,仍出现“E: The repository 'http://mirrors.aliyun.com/ubuntu bionic-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.”报错,如下所示:

Ign:1 http://mirrors.aliyun.com/ubuntu bionic InRelease
Ign:2 http://mirrors.aliyun.com/ubuntu bionic-security InRelease
Ign:3 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease
Ign:4 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease
Ign:5 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease
Err:6 http://mirrors.aliyun.com/ubuntu bionic Release 
  SECURITY: URL redirect target contains control characters, rejecting. [IP: 119.96.136.238 80]
Err:7 http://mirrors.aliyun.com/ubuntu bionic-security Release
  SECURITY: URL redirect target contains control characters, rejecting. [IP: 119.96.136.238 80]
Err:8 http://mirrors.aliyun.com/ubuntu bionic-updates Release
  SECURITY: URL redirect target contains control characters, rejecting. [IP: 119.96.136.238 80]
Err:9 http://mirrors.aliyun.com/ubuntu bionic-proposed Release
  SECURITY: URL redirect target contains control characters, rejecting. [IP: 119.96.136.238 80]
Err:10 http://mirrors.aliyun.com/ubuntu bionic-backports Release
  SECURITY: URL redirect target contains control characters, rejecting. [IP: 119.96.136.238 80]
appstreamcli: error while loading shared libraries: libxapian.so.22: cannot open shared object file: No such file or directory
Reading package lists... Done
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic-security Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic-proposed Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache > /dev/null; fi'

后来,根据csdn一篇博客,我新建手机热点后,虚拟机中的操作系统改用手机热点连接,发现可以更新完毕。

初步分析,应该是公司的上网管理软件进行了限制,类似运营商的缓存劫持。
 

不过,更新完了之后,还出现了appstreamcli: error while loading shared libraries: libxapian.so.22: cannot open shared object file: No such file or directory
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache > /dev/null; fi'
E: Sub-process returned an error code的报错。

Fetched 70.8 MB in 4min 20s (272 kB/s)                                         
appstreamcli: error while loading shared libraries: libxapian.so.22: cannot open shared object file: No such file or directory
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache > /dev/null; fi'
E: Sub-process returned an error code

这个问题是由于安装包过于老旧或者缺少软件包

解决方法:

sudo apt --fix-broken install

执行该操作以后,所有bug都全部修复。 

希望能帮到你!

参考

1、ubuntu apt update 报错:无法安全地用该源进行更新,所以默认禁用该源

2、dpkg dependency problems prevent configuration - 唐僧公子 - 博客园

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

【BUG解决】sudo apt-get update 报错 E: The repository ‘http://xxx Release‘ does not have a Release file. 的相关文章

随机推荐