A group of Amazon Linux 2 instances have duplicate instances of
name=packages-microsoft-com-prod
in redundantyum repositories
with different names. What is a safe way to remove the duplicate references to the same package without causing other things that run in the same operating system to break?
Here is how the problem is illustrated by a grep:
[user-name@host-name ~]$ sudo grep name=packages-microsoft-com-prod /etc/yum.repos.d/*
/etc/yum.repos.d/microsoft-prod.repo:name=packages-microsoft-com-prod
/etc/yum.repos.d/msprod.repo:name=packages-microsoft-com-prod
The two instances of the package are causing other programs in the instances to return errors indicating that they do not know which of the two identically named packages to use.
I tried yum update
, but the problem persists. I could write some bash script to check for duplicate names and delete one repo until there are no duplicates. But I am concerned that deleting repos might be a hack approach that might cause collateral damage elsewhere in the machines.
User Requests:
Per @JeffSchaller 's comment, I am adding the following terminal output to elaborate the situation:
[user-name@host-name ~]$ grep -c ^name= /etc/yum.repos.d/microsoft-prod.repo /etc/yum.repos.d/msprod.repo
/etc/yum.repos.d/microsoft-prod.repo:1
/etc/yum.repos.d/msprod.repo:1
[user-name@host-name ~]$ rpm -qf /etc/yum.repos.d/microsoft-prod.repo /etc/yum.repos.d/msprod.repo
packages-microsoft-prod-1.0-1.el7.noarch
file /etc/yum.repos.d/msprod.repo is not owned by any package
[user-name@host-name ~]$ sudo cat /etc/yum.repos.d/microsoft-prod.repo
[packages-microsoft-com-prod]
name=packages-microsoft-com-prod
baseurl=https://packages.microsoft.com/rhel/7/prod/
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
[user-name@host-name ~]$ sudo cat /etc/yum.repos.d/msprod.repo
[packages-microsoft-com-prod]
name=packages-microsoft-com-prod
baseurl=https://packages.microsoft.com/rhel/7/prod/
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc