SPEC file builds two RPMs, but dependency makes -Uvh upgrade impossible - linux

I'm working on a spec file (foo.spec) that, when built, results in two RPMs: foo-1-1.i386.rpm (the main program) and libfoo-1-1.i386.rpm (the required library files). The foo.spec file states that foo requires libfoo at the same version and release level:
Requires: libfoo = %{version}-%{release}
foo-1-1 installs just fine with:
rpm -ivh libfoo-1-1.i386.rpm
which installs the dependent library, and then:
rpm -ivh foo-1-1.i386.rpm
But upgrading to a newer version (foo-2-1) doesn't work because of the dependency on the libraries:
$ rpm -Uvh libfoo-2-1.i386.rpm
error: Failed dependencies:
libfoo = 1-1 is needed by (installed) foo-1-1.i386
$ rpm -Uvh foo-2-1.i386.rpm
error: Failed dependencies:
libfoo = 2-1 is needed by foo-2-1.i386
So I'm stuck. I want users to be able to do rpm -Uvh to upgrade the foo package (requiring them to ignore dependencies, etc. is asking too much of novice users).
Any ideas of how I can work around this so that rpm -Uvh can be used to upgrade all parts of the package when a new release is available?
Thanks in advance.

rpm shouldn't and doesn't allow you to update these RPMs individually as the the state between installing the first RPM and the second is not valid.
You can, as Hasturkun points out, install both of them in the same command:
rpm -Uvh libfoo-2-1.i386.rpm foo-1-1.i386.rpm
FWIW, if you creaate a yum repo and used that to update you would find that updating one RPM would automatically drag in the other.

Related

Wind River Linux, Failed Dependency Error

I am working on Wind River Linux. Failed Dependency Error. Can anyone please tell me what I have to do ? I have been trying from past one day
root#AC-04:/home/mysql# rpm -ivh MySQL-server-5.6.33-1.linux_glibc2.5.x86_64.rpm
warning: MySQL-server-5.6.33-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 5072e1f5
error: Failed dependencies:
/sbin/chkconfig is needed by MySQL-server-5.6.33-1.linux_glibc2.5.x86_64
/usr/lib64/mysql/plugin is needed by MySQL-server-5.6.33-1.linux_glibc2.5.x86_64
/usr/lib64/mysql/plugin/debug is needed by MySQL-server-5.6.33-1.linux_glibc2.5.x86_64
First of all, use -Uvh instead of -ivh when installing: -Uvh is almost (kernel is the one exception) the right way to install/upgrade rpm packages.
The final solution will be to find the packages that provide those dependencies using (if all else fails)
rpm -qP /sbin/chkconfig *.rpm
on the WRL packages, and make sure those packages are installed.
Those are all file/directpory dependencies. Try (e.g.)
rpm -qf --whatprovides /sbin/chkconfig
to see if there is a package that provides the file.
(Note: what follows "works" for RPM5 on WRL, not RPM on Fedora/RHEL)
You can stub out dependencies by doing (e.g.)
mkdir -p /etc/rpm/sysinfo
echo "/sbin/chkconfig" >> /etc/rpm/sysinfo/Requirename
Masking the dependencies will permit installation (so will --nodeps) and might help get you further along in debugging your packaging.

Difference between rpm -ivh and rpm -Uvh

Hi i am newbie in linux can anyone explains me the difference between
rpm -ivh
and
rpm -Uvh
Check out documentation (man page) of rpm.
i - install (This installs a new package)
v - verbose (using or expressed in more words than are needed)
h - hash (Print 50 hash marks as the package archive is unpacked)
U - upgrade (This upgrades or installs the package currently installed to a newer version. This is the same as install, except all other version(s) of the package are removed after the new package is installed)

How to specify dependency location in rpm?

While installing Mono using RPM, GLIBC_2.16 is listed as a dependency. Since I'm having an older version of glibc, and didn't want to corrupt my kernel, i installed the newer glibc from sources in my home folder.
I now want the RPM to refer to this newer glibc lib directory in my home folder while installing mono. What is the RPM option for mentioning dependency locations for a package?
I am currently using the following RPM command:
sudo rpm -ivh mono-core-3.2.3-0.x86_64.rpm
I get the following error messages:
libc.so.6(GLIBC_2.14)(64bit) is needed by mono-core-3.2.3-0.x86_64
libc.so.6(GLIBC_2.15)(64bit) is needed by mono-core-3.2.3-0.x86_64
libc.so.6(GLIBC_2.16)(64bit) is needed by mono-core-3.2.3-0.x86_64
My newer glibc path is:
~/Desktop/glibc/glibc1/lib
What option should i include in rpm to reference this path while installing mono?
Thanks
I guess there is no way to install the package without --nodeps unless you install the proper version of glibc in your system.
If your goal is to run mono command completely, it may work fine by the following steps.
Installing the package by adding the --nodeps option to rpm command to ignore any dependencies.
Running mono-related commands with LD_LIBRARY_PATH set to /your/alternative/path/to/glibc.
However, I think that the best solution is to build the mono's source on your machine.

How to ignore conflicts in rpm installs

I have a bunch of rpm files in a folder. I am trying to install them using:
rpm -ivh *.rpm so rpm can take care of the correct installation order.
On some of these rpms I have a newer version installed in my system so I get for example:
package info-5.0-1 (which is newer than info-4.13a-2) is already installed
/opt/freeware/man/man1/infokey.1 from install of info-4.13a-2 conflicts with file from package info-5.0-1
Is there a way to ignore the old .rpm file and resolve the dependency with the new version that is already installed? I thought of the --force option. But how --force resolves the conflicts? Overwrites them with the older version or just ignores them leaving the new version?
Any thoughts are welcome.
The --force option will reinstall already installed packages or overwrite already installed files from other packages. You don't want this normally.
If you tell rpm to install all RPMs from some directory, then it does exactly this. rpm will not ignore RPMs listed for installation. You must manually remove the unneeded RPMs from the list (or directory). It will always overwrite the files with the "latest RPM installed" whichever order you do it in.
You can remove the old RPM and rpm will resolve the dependency with the newer version of the installed RPM. But this will only work, if none of the to be installed RPMs depends exactly on the old version.
If you really need different versions of the same RPM, then the RPM must be relocatable. You can then tell rpm to install the specific RPM to a different directory. If the files are not conflicting, then you can just install different versions with rpm -i (zypper in can not install different versions of the same RPM). I am packaging for example ruby gems as relocatable RPMs at work. So I can have different versions of the same gem installed.
I don't know on which files your RPMs are conflicting, but if all of them are "just" man pages, then you probably can simply overwrite the new ones with the old ones with rpm -i --replacefiles. The only problem with this would be, that it could confuse somebody who is reading the old man page and thinks it is for the actual version. Another problem would be the rpm --verify command. It will complain for the new package if the old one has overwritten some files.
Is this possibly a duplicate of https://serverfault.com/questions/522525/rpm-ignore-conflicts?
From the context, the conflict was caused by the version of the package.
Let's take a look the manual about rpm:
--force
Same as using --replacepkgs, --replacefiles, and --oldpackage.
--oldpackage
Allow an upgrade to replace a newer package with an older one.
So, you can execute the command rpm -Uvh info-4.13a-2.rpm --force to solve your issue.
Try Freshen command:
rpm -Fvh *.rpm

Installing RPM Dependencies

I am trying to install dbus-1.1.2-12.el5.i386 but I get the error
" dbus-libs = 1.1.2-12.el5 is needed by dbus-1.1.2-12.el5.i386" :-(
So I downloaded "dbus-libs-1.1.2-12.el5.i386.rpm" in the same directory and ran the
command rpm -ivh dbus-1.1.2-12.el5.i386 again, but I still got the same error. On searching on Forums I found that RPM takes care of dependecies if they are present in the same Directory. but it does not work with -ivh option ??
Steve B is correct:
yum install dbus-libs
yum install dbus
yum will also allow you to do "whatprovides" for a package:
yum whatprovides dbus-libs
This will show you if you have another version of dbus-libs "installed" on your system, it spools out what repos provide the package and is any are provided (installed) locally.
Also helpful is:
rpm -q dbus
which will show any packages that are locally install as will:
rpm -q dbus-libs
or
rpm -qa | grep 'dbus'
You may find that you already have an eariler version of dbus installed, which case:
yum -y update dbus
Hope this helps.
http://www.of-networks.co.uk
You need to install the dependant RPMs before installing dbus. You should also know that this is the hard way, these days RPM-based distributions usually have a dependancy managment system so that you don't need to do this by hand. e.g. on Redhat/Fedora/Centos you can just type "yum install mypackagename".

Resources