DNF update command fails when mirrorlist unreachable

Solution Verified - Updated -

Issue

  • Currently, servers are configured with baseurl and mirrorlist options which should allow guaranteed repo access via baseurl if host serving mirrorlist is unreachable.
  • While trying to use DNF commands, With both mirrorlist and baseurl defined in a repo file, if the mirrorlist cannot be found it does not fall back to baseurl.
  • These options(baseurl and mirrorlist) used to work on RHEL5, RHEL6 and RHEL7 without issues but they seem not working on RHEL8.
  • Example config file used to configure this repo on RHEL8 clients:

    [RHEL-8]
    #BaseOS
    name=RHEL-8
    #fake mirror list to replicate issue
    mirrorlist=http://192.168.122.1:8080/BaseOSXX
    enabled=1
    baseurl=http://192.168.122.1:8080/BaseOS
    gpgcheck=0
    repo_gpgcheck=1
    gpgkey=http://192.168.122.1:8080/BaseOS/my.key
    
  • Following error is showing while trying to use DNF commands (such as update, list,..):

    # dnf  -v --disablerepo=* --enablerepo=RHEL-8 list
    Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, 
    repoclosure, repodiff, repograph, repomanage, reposync, uploadprofile
    DNF version: 4.2.7
    cachedir: /var/cache/dnf
    repo: downloading from remote: RHEL-8
    error: Status code: 404 for http://192.168.122.1:8080/BaseOSXX (http://192.168.122.1:8080/BaseOSXX).
    RHEL-8                               22 kB/s | 195  B     00:00    
    Cannot download 'http://192.168.122.1:8080/BaseOSXX': Cannot prepare internal mirrorlist: Status code: 404 for http://192.168.122.1:8080/BaseOSXX.
    Failed to download metadata for repo 'RHEL-8'
    Error: Failed to download metadata for repo 'RHEL-8'
    

Environment

  • Red Hat Enterprise Linux 8

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