dnf fails with "- Curl error (3): URL using bad/illegal format or missing URL" for custom repository with basic access authentication

Solution Verified - Updated -

Issue

dnf commands fail on downloading custom repository metadata protected with basic access authentication with one of the following errors:

Errors during downloading metadata for repository 'custom-repository'
  - Curl error (3): URL using bad/illegal format or missing URL for http://user:123abc#@example.com/pub/repos/rhel-X/repodata/repomd.xml []
Errors during downloading metadata for repository 'custom-repository'
  - Curl error (3): URL using bad/illegal format or missing URL for http://user:123abc/ [Port number ended with 'a']

Environment

  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • custom repository is protected with basic access authentication
  • custom repository login and/or password contains special characters (such as ? # @ % & : etc) which are supplied in baseurl within yum repository configuration

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