'failed to synchronize cache for repo AppStream

My centos machine has no connection to internet. I need to install make utility to compile some modules from source code. I am getting this error while i run yum install make. Even if i run yum module list , it gives me same error. need help at earliest.



Solution 1:[1]

There could be multiple reasons for this issue. The most common ones are:

  • Incorrect date and time settings
  • Old dnf cache available or expired
  • CentOS baseURL

How to fix Incorrect date and time settings:

The timedatectl command is a new utility tool in CentOS 7/8. It is a replacement for old traditional date command used in sysvinit daemon-based Linux distributions.

Find the current date and time of your system. Make sure it is correct with the proper time zone.

[root@centos ~]# timedatectl
[root@centos ~]# timedatectl set-timezone "America/Chicago"
[root@centos ~]# date

How to clear Old/expired dnf cache:

[root@centos ~]# dnf clean all
[root@centos ~]# rm -rf /var/cache/dnf

https://dnf.readthedocs.io/en/latest/command_ref.html#clean-command-label

How to change CentOS baseURL from mirror.centos.org to vault.centos.org:

/etc/yum.repos.d/

CentOS Linux 8 had reached the End Of Life (EOL) on December 31st, 2021. It means that CentOS 8 will no longer receive development resources from the official CentOS project. After Dec 31st, 2021, if you need to update your CentOS, you need to change the mirrors to vault.centos.org where they will be archived permanently. Alternatively, you may want to upgrade to CentOS Stream or migrate from CentOS to Rocky Linux. Or AlmaLinux, which I'd recommend.

https://mirrors.almalinux.org/isos.html

Solution 2:[2]

It needs to contact the internet to be able to access the Centos Software Repository so that it can download make. If you are still seeing this when you machine has internet then it may be the same as this https://stackoverflow.com/a/61522502/288022

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Tim Hughes