When working with CentOS 6, you might encounter errors like this when running yum
commands:
file:///media/CentOS/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/CentOS/repodata/repomd.xml Trying other mirror. file:///media/cdrecorder/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrecorder/repodata/repomd.xml Trying other mirror. file:///media/cdrom/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrom/repodata/repomd.xml Trying other mirror. Error: Cannot retrieve repository metadata (repomd.xml) for repository: c6-media. Please verify its path and try again
This occurs because Yum is trying to access the original installation media (CD/DVD) which is no longer available. The c6-media
repository is typically configured during OS installation but becomes problematic when the physical media isn't present.
Many users first try removing the repository through GUI package managers, but this often doesn't solve the problem because:
- Yum maintains its own configuration files separate from GUI tools
- The repository might be defined in multiple configuration files
- Some tools only disable repositories rather than removing them
Here's how to properly remove the c6-media
repository:
Method 1: Directly Edit Yum Configuration
First, check where the repository is defined:
grep -r "c6-media" /etc/yum.repos.d/
Then edit or remove the relevant file(s). Common locations include:
sudo rm /etc/yum.repos.d/CentOS-Media.repo
or
sudo vi /etc/yum.repos.d/CentOS-Base.repo
Method 2: Using Yum-config-manager
If available, use this more elegant solution:
sudo yum-config-manager --disable c6-media sudo yum-config-manager --remove c6-media
Method 3: Clean Yum Cache
After removing the repository, clean the cache:
sudo yum clean all sudo yum makecache
Check that the repository is truly gone:
yum repolist
You should no longer see c6-media
in the list.
If you prefer to keep the repository definition but disable it:
sudo sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/CentOS-Media.repo
To avoid similar problems:
- Always check
/etc/yum.repos.d/
after OS installation - Consider using CentOS vault repositories instead of media repos
- For legacy systems, set up proper local mirrors
Remember that CentOS 6 reached EOL in November 2020, so consider upgrading to a supported version if possible.
When working with CentOS 6 systems, you might encounter Yum errors related to the c6-media
repository, particularly if you've installed the OS from physical media. The error typically appears as:
file:///media/CentOS/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/CentOS/repodata/repomd.xml Trying other mirror. Error: Cannot retrieve repository metadata (repomd.xml) for repository: c6-media.
This occurs because Yum continues to look for installation media that is no longer available in your system.
First, verify which repositories are currently enabled in your system:
yum repolist
To see all repositories (including disabled ones):
yum repolist all
The c6-media
repository is typically defined in one of these files:
/etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Base.repo
There are several ways to handle this:
Method 1: Disable the Repository
Edit the configuration file:
sudo vi /etc/yum.repos.d/CentOS-Media.repo
Change enabled=1
to enabled=0
for the [c6-media]
section.
Method 2: Remove the Repository File
Simply delete the configuration file:
sudo rm /etc/yum.repos.d/CentOS-Media.repo
Method 3: Temporary Disable for Single Command
You can disable the repository just for one Yum operation:
sudo yum --disablerepo=c6-media install package_name
After making changes, clean the Yum cache:
sudo yum clean all sudo yum makecache
For CentOS 6 systems that are still supported (through ELS), consider using vault.centos.org:
sudo sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/CentOS-Base.repo
Check that the repository is no longer causing issues:
sudo yum update