“Failed to Synchronize Cache for Repo appstream” Error in CentOS 8

The very recently I had encounterd the “Failed to synchronize cache for repo ‘appstream‘” error in CentOS 8 which is frustrating, but it’s a common issue with multiple potential causes. Here, in this guide I will provide steps to resolve this problem.

Before diving into the solution, let’s understand the common reasons behind this error:

Identifying Common Causes:

Before diving into the solution, let’s understand the common reasons behind this error:

1. Incorrect Date and Time Settings: Ensure your system’s date and time settings are accurate, including the correct time zone.

2. Old or Expired DNF Cache: Stale DNF cache can lead to synchronization issues. Cleaning the cache is often necessary.

3. CentOS BaseURL: Since CentOS 8 reached its End Of Life (EOL) on December 31, 2021, you may need to switch from “mirror.centos.org” to “vault.centos.org” for updates.

Fixing Incorrect Date and Time Settings:

CentOS 7/8 introduced the `timedatectl` command. Check your system’s date and time settings and ensure they are correct for your time zone.

[root@nayana ~]# timedatectl
               Local time: Mon 2023-10-09 01:13:43 EDT
           Universal time: Mon 2023-10-09 05:13:43 UTC
                 RTC time: Mon 2023-10-09 05:13:42
                Time zone: America/New_York (EDT, -0400)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no

Set to your timezone
[root@nayana ~]# timedatectl set-timezone "Asia/Kolkata"
[root@nayana ~]# date
Mon Oct  9 10:45:19 IST 2023

Clearing Old/Expired DNF Cache:

Here is an article to clean each kind of cache. To clean all of it, run the below command:

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

Changing CentOS BaseURL to vault.centos.org:

CentOS Linux 8 was decommissioned on December 31, 2021. It means that the official CentOS project will no longer provide development resources for CentOS 8. If you need to update CentOS after December 31st, 2021, you must change the mirrors to vault.centos.org, where they will be archived permanently. You could also upgrade to CentOS Stream or migrate from CentOS to Rocky Linux.

1. Navigate to the `/etc/yum.repos.d/` directory:

[root@nayana ~]#
 cd /etc/yum.repos.d/

2. Modify the repository files using the following commands:

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

3. Update your system:

[root@nayana yum.repos.d]# dnf update

Resolving the “Failed to synchronize cache for repo ‘appstream'” error in CentOS 8 is crucial to maintain a well-functioning system. By following these steps, you can troubleshoot the issue effectively. Remember to adapt these solutions to your specific environment, and stay updated with the latest CentOS news for any migration considerations.

 

 

 
  • centos, centos 8, appstream, error, update
  • 0 Los Usuarios han Encontrado Esto Útil
¿Fue útil la respuesta?

Artículos Relacionados

Install GUI In CentOS

While there are many different graphical user interfaces available for Linux, in this example we...

Windows Trail Reset - Windows Server shuts down unexpectedly

Problem: Some of the virtual servers in my infrastructure kept shutting down unexpectedly. All...

Ubuntu E: Failed to fetch .. Hash Sum Mismatch

Ubuntu E: Failed to fetch .. Hash Sum Mismatch, failed to update ubuntu 18.04 OS. nano...

Create or Increase or Remove swap file size on cPanel WHM

Generally, you would want to have a dedicated partition for swap however, a swap file can also be...

How To Add Swap on CentOS 7

Prerequisites Before you begin with this guide, there are a few steps that need to be completed...

Powered by WHMCompleteSolution