The installation (or the upgrade) of a RPM package can fail with a conflict error when a specific path is already "in use" by another package.
Let's assume you have two packages:
If the foo package is installed and you want to install the bar package (or upgrade bar package which contains an update with /opt/scripts/myscript.pl), the rpm command runs into a conflict:
[root@rhel9 ~]# rpm -Uvh bar-1.1.0-1.el9.noarch.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
file /opt/scripts/myscript.pl from install of bar-1.1.0-1.el9.noarch.rpm conflicts with file from package foo-3.5.0.1-1.el9.noarch
There are two ways to handle this situation when building the bar RPM package. In the bar.spec file you can:
Which one to chose heavily depends what purpose or what script versions both packages contain. You probably don't want to get on the nerves of the other package maintainer, so discuss this.
In my situation, the "foo" package has been abandoned for a while. It's just still in the repositories for legacy reasons. The scripts in the "bar" package replace the outdated scripts, including /opt/scripts/myscript.pl. Therefore, in my situation, defining the "foo" package under "Obsoletes" in the bar.spec file is the way to go.
As mentioned above, I updated bar.spec and added the Obsoletes definition:
ck@mint ~/Git/packages/bar $ cat bar.spec
Name: bar
Version: 1.1.1
Release: 1%{dist}
Summary: bar package contains handy scripts
Packager: Claudio Kuenzler, <ck@claudiokuenzler.com>
Vendor: Infiniroot GmbH
Group: Application/System
License: GPLv3
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
%if 0%{?rhel} == 6
Requires: nc bind-utils perl
%endif
%if 0%{?rhel} == 7
Requires: nmap-ncat bind-utils perl
%endif
%if 0%{?rhel} == 8
Requires: nmap-ncat bind-utils perl
%endif
%if 0%{?rhel} == 9
Requires: nmap-ncat bind-utils perl
%endif
Obsoletes: foo
[...]
After building a new RPM package, it's time to test the new version.
Now with a new bar package at hand, let's try the package installation/upgrade once more.
[root@rhel9 ~]# rpm -Uvh bar-1.1.1-1.el9.noarch.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:bar-1.1.1-1.el9 ################################# [ 33%]
Cleaning up / removing...
2:foo-3.5.0.1-1.el9 ################################# [ 67%]
3:bar-1.0.99-1.el9 ################################# [100%]
The conflict is automatically resolved by removing the obsolete package "foo" and the package installation/upgrade of "bar" was successful.
No comments yet.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Database Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera Git GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Influx Internet Java KVM Kibana Kodi Kubernetes LVM LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Office OpenSearch PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder