How to Enable and Disable DNF Repositories on Fedora

Enable or disable Fedora DNF repositories instantly using the dnf config-manager command with --set-enabled or --set-disabled flags.

You upgraded a package and now DNF complains about missing metadata

You run dnf install and the transaction aborts with a metadata retrieval error. Or you notice a package you don't recognize appeared in your last update because a third-party repository is pulling in dependencies. Repository management is the first step in troubleshooting package failures. Fedora gives you fine-grained control over which software sources are active. You can toggle repositories on and off without deleting your configuration.

What's actually happening

Fedora reads repository definitions from /etc/yum.repos.d/. Each file contains one or more sections wrapped in square brackets. The text inside the brackets is the repository ID. DNF uses this ID to identify the source. The enabled parameter inside the section tells DNF whether to fetch metadata and packages from that source.

Setting enabled=0 tells DNF to skip the repo. The file remains on disk. Your base URL, GPG keys, and other settings stay intact. You can restore access instantly by flipping the flag back. Think of disabling a repo like turning off a switch on a circuit breaker. The wiring is still there. The device is still connected. Power just stops flowing until you flip the switch back.

Config files in /etc/yum.repos.d/ are user-modified. Files in /usr/lib/yum.repos.d/ ship with packages. Edit /etc/. Never edit /usr/lib/. Changes in /usr/lib/ get overwritten the next time the owning package updates. If you need to modify a repo that ships in /usr/lib/, copy it to /etc/ first, or use config-manager which handles the override logic automatically.

List repositories and find the ID

You need the exact repository ID before you can enable or disable it. The ID is not always the human-readable name. The ID is the text inside the square brackets in the repo file. IDs are case-sensitive. fedora is different from Fedora.

Run dnf repolist all to see every repository configured on the system, including disabled ones. The output lists the repo ID in the first column. Copy that ID exactly.

Here's how to list all repositories and identify the correct ID for the source you want to manage.

dnf repolist all # Show all repos, enabled and disabled, with their IDs and status

The output looks like this:

repo id                          repo name                          status
fedora                           Fedora 40 - x86_64                 enabled: 39,102
fedora-cisco-openh264            Fedora 40 openh264 (From Cisco)    disabled
updates                          Fedora 40 - x86_64 - Updates       enabled: 12,405

The repo id column contains the value you pass to config-manager. The status column shows whether the repo is currently active. A disabled repo shows disabled or a count of zero.

Run repolist all before every change. Guessing the ID leads to errors that waste time.

Enable and disable repositories

Use dnf config-manager to change the enabled state. This command is part of the dnf-plugins-core package. It modifies the .repo files safely. It preserves formatting and avoids syntax errors that can break DNF.

Here's how to permanently enable or disable a repository by its ID.

dnf config-manager --set-enabled fedora-cisco-openh264 # Enable a repo so DNF includes it in future transactions
dnf config-manager --set-disabled rpmfusion-free-updates # Disable a repo so DNF ignores it going forward

The --set-enabled and --set-disabled flags write changes to the configuration file. The change persists across reboots and future commands. DNF updates its internal state immediately. You do not need to restart the system.

If config-manager is not found, the dnf-plugins-core package is missing. Install it with dnf install dnf-plugins-core. This package provides config-manager, copr, and other essential tools.

Changes take effect on the next DNF command. If you just disabled a repo, run dnf repolist to confirm it no longer appears in the active list.

Temporary exclusion for a single command

Sometimes you only need to exclude a repo for one transaction. Maybe you are installing a package from a different repo that conflicts with a package in the default repo. Or you want to test an upgrade without pulling updates from a specific source.

Use the --disable flag with dnf directly. This applies only to the current transaction. The repo remains enabled for future commands.

Here's how to exclude a repository for a single install or upgrade operation.

dnf install --disable fedora-cisco-openh264 vlc # Install vlc without considering packages from the openh264 repo
dnf upgrade --disable updates # Upgrade all packages except those in the updates repo

The --disable flag accepts a repo ID. You can chain multiple --disable flags. This is useful for troubleshooting dependency conflicts. If a package from repo A conflicts with a package from repo B, disable repo B and install from repo A.

Temporary flags do not modify configuration files. They only affect the running command. This is safe for experimentation. You can revert by simply running the command again without the flag.

Use --disable for one-off exclusions. Use --set-disabled when you want the change to stick.

Verify the change

Check the state after every modification. DNF caches metadata. If you disable a repo, the cache might still contain old data until it expires or you clean it.

Here's how to verify that a repository is enabled or disabled and check package availability.

dnf repolist # List only enabled repositories to confirm the target is absent
dnf repoquery --repo fedora-cisco-openh264 --available # List packages available in a specific repo, even if disabled

The repolist command shows only enabled repos. If the repo you disabled appears here, the change did not apply. Check the ID for typos.

The repoquery command lets you inspect packages in a disabled repo. This is useful for checking what you are missing without re-enabling the source. The --available flag shows packages that would be installable if the repo were active.

Run dnf repolist after every change. Trust the output, not your memory.

Common pitfalls and errors

DNF reports specific errors when repository configuration is wrong. Read the error message. It usually points to the exact problem.

If you see Error: Cannot find a repo with id: wrong-name, the ID is incorrect. Run dnf repolist all and copy the ID exactly. IDs are case-sensitive. Extra spaces or wrong casing cause this error.

If you see Repository 'foo' is missing name in configuration, the .repo file has a syntax error. The section is missing a name= line. Edit the file in /etc/yum.repos.d/ and add the missing parameter. Use config-manager to avoid manual edits when possible.

Re-enabling a repo after a long time can trigger GPG key errors. The key might have expired or the metadata signature might be stale. Run dnf upgrade --refresh to force a metadata reload. This fetches fresh metadata and verifies signatures.

Metadata caching can confuse troubleshooting. If you disable a repo and DNF still offers packages from it, the cache is stale. Run dnf clean all to clear the cache. DNF will rebuild the cache on the next command.

dnf upgrade --refresh is the normal weekly maintenance command. It forces metadata refresh and ensures you have the latest package lists. Use it after changing repository configurations to sync the state.

Clear the cache when behavior doesn't match the configuration. Stale metadata lies.

Decision matrix

Use --set-disabled when you want to permanently turn off a repo across all future commands. Use --disable when you need to exclude a repo for a single transaction, like installing a package from a different source. Use --set-enabled when a repo is dormant and you need to restore access to its packages. Edit /etc/yum.repos.d/ directly only when you need to change the base URL or GPG key, not just the enabled state. Use dnf config-manager --add-repo when you are adding a brand new repository URL from scratch.

Where to go next