How to fix "systemd[1]: dnf-makecache.service: Failed with result 'exit-code'."

Solution Verified - Updated -

Issue

  • The /var/log/messages log shows error messages as below:
[warning] systemd[1]: dnf-makecache.service: Failed with result 'exit-code'.
[err] systemd[1]: Failed to start dnf makecache.
  • The yum command or /var/log/dnf.log shows the following error: "Curl error (37): Couldn't read a file:// file for file:///mnt/BaseOS/repodata/repomd.xml [Couldn't open file /mnt/BaseOS/repodata/repomd.xml]"

Environment

  • Red Hat Enterprise Linux 8 and later
  • systemd
  • dnf-makecache.service

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content