Centos through VM - no URLs in mirrorlist
Solution 1
Check out this article: https://www.centos.org/centos-linux-eol/
Below commands helped me:
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-*
Doing this will make dnf work, but you will no longer receive any updates.
To upgrade to CentOS 8 stream:
sudo dnf install centos-release-stream -y sudo dnf swap centos-{linux,stream}-repos -y sudo dnf distro-sync -y
Optional reboot if your kernel updated (not needed in containers)
Solution 2
CentOS 8 became EOL at the end of 2021. A long term solution is to migrate to a different operating system, like Rocky Linux.
Admin
Updated on July 09, 2022Comments
-
Admin almost 2 years
I am trying to run a Centos 8 server through VirtualBox (6.1.30) (Vagrant), which worked just fine yesterday for me, but today I tried running a
sudo yum update
I am keep getting this error for some reason:[[email protected]] ~ >> 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
I already tried to change the namespaces on
/etc/resolve.conf
, remove the dnf folders and everything. On other computers, this works just fine so I think the problem is with my host machine. Also tried to reset the network settings (I am on win 10 host), without success either. It's not a DNS problem, it works just fine.Update: I reinstalled windows, still has the same error on my vm
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