CentOS通过虚拟机-镜像列表中没有URL [已关闭]

dnph8jn4  于 2022-11-07  发布在  其他
关注(0)|答案(2)|浏览(225)

**已关闭。**此问题不符合Stack Overflow guidelines。当前不接受答案。

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site相关,您可以留下评论,说明在何处可以找到此问题的答案。
9个月前关闭。
机构群体在9个月前审核了是否重新讨论此问题,并将其关闭:
原始关闭原因未解决
Improve this question
我尝试通过VirtualBox(6.1.30)(Vagrant)运行CentOS 8服务器,昨天运行得还不错,但今天我尝试运行sudo yum update.由于某种原因,我一直收到此错误:

[vagrant@192.168.38.4] ~  >> sudo yum update
CentOS Linux 8 - AppStream                       71  B/s |  38  B     00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

我已经试过改变/etc/resolve.conf上的命名空间,删除DNF文件夹和所有东西。在其他电脑上,这个操作正常,所以我认为问题出在我的主机上。我也试过重置网络设置(我在Windows 10主机上),也没有成功。这不是DNS问题;它工作得很好。
重新安装Windows后,我的虚拟机中仍然出现相同的错误。
文件 dnf.log

2022-01-31T15:28:03+0000 INFO --- logging initialized ---
2022-01-31T15:28:03+0000 DDEBUG timer: config: 2 ms
2022-01-31T15:28:03+0000 DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
2022-01-31T15:28:03+0000 DEBUG YUM version: 4.4.2
2022-01-31T15:28:03+0000 DDEBUG Command: yum update
2022-01-31T15:28:03+0000 DDEBUG Installroot: /
2022-01-31T15:28:03+0000 DDEBUG Releasever: 8
2022-01-31T15:28:03+0000 DEBUG cachedir: /var/cache/dnf
2022-01-31T15:28:03+0000 DDEBUG Base command: update
2022-01-31T15:28:03+0000 DDEBUG Extra commands: ['update']
2022-01-31T15:28:03+0000 DEBUG User-Agent: constructed: 'libdnf (CentOS Linux 8; generic; Linux.x86_64)'
2022-01-31T15:28:05+0000 DDEBUG Cleaning up.
2022-01-31T15:28:05+0000 SUBDEBUG
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 574, in load
    ret = self._repo.load()
  File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 397, in load
    return _repo.Repo_load(self)
libdnf._error.Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 67, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 106, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 122, in cli_run
    cli.run()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1050, in run
    self._process_demands()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 740, in _process_demands
    load_available_repos=self.demands.available_repos)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 394, in fill_sack
    self._add_repo_to_sack(r)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 137, in _add_repo_to_sack
    repo.load()
  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 581, in load
    raise dnf.exceptions.RepoError(str(e))
dnf.exceptions.RepoError: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
2022-01-31T15:28:05+0000 CRITICAL Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
rwqw0loc

rwqw0loc1#

查看这篇文章:****
下面的命令对我有帮助:

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*

这样做将使DNF工作,但您将不再收到任何更新。
要升级到CentOS 8流:

sudo dnf install centos-release-stream -y
sudo dnf swap centos-{linux,stream}-repos -y
sudo dnf distro-sync -y

如果内核已更新(在container中不需要),可以选择重新启动。

xj3cbfub

xj3cbfub2#

CentOS 8于2021年底停产。一个长期的解决方案是迁移到不同的操作系统,如Rocky Linux

相关问题