RPM package requirements in a special order - require

I am facing the problem, that I need to install two other RPM's in a special order before installing myRPM.
In detail in my RPM I install some config files for sudo and ldap. So, I need these packages to be installed first Requires(pre). Although the pre required package sudo has a required file in /usr/bin/.
This file will be installed with the ldap package.
So, I need the ldap package to be installed first, then sudo and at least myRPM.
My spec file has:
Requires(pre): myldap_rpm sudo
But yum is not going to install the package because sudo needs ldap first. Yum seems to check the dependencies of the pre-required sudo package before installing myldap_rpm
Is there any chance to resolve this???
Thanks a lot in advance for sharing your ideas and knowledge.

requires(pre) is a scriptlet dependency. This means that dependency (eg sudo) is only required to run the %pre script. When your package is installed sudo can then safely be uninstalled. This is not what you want here.
Afaik you cannot change the dependencies of other packages. You can tell what your package depends on, and those dependencies will be installed before your package, but you cannot insert a myldap_rpm dependency to sudo.
Probably you don't need to reinstall sudo though, probably it would suffice to run some kind of "reload" or "configuration" step after the installation of myldap_rpm.

Related

python3: can't install psycopg2 [duplicate]

I cannot figure this out for the life of me.
When I pip install django-tenant-schemas it tries to install the dependency psycopg2 which requires the Python headers and gcc. I have all this installed and still keep getting this error!
./psycopg/psycopg.h:35:10: fatal error: libpq-fe.h: No such file or directory
So to install libpq-fe-h I need to sudo apt-get install libpq-dev..
..which returns..
libpq-dev is already the newest version (10.10-0ubuntu0.18.04.1).
Then when I sudo find / libpq-fe.h it doesn't seem to be in my OS.
I am lost at this point. If anyone can help I would highly appreciate it.
For some reason, the file is missing on the system.
As you're using apt-get, the system is dpkg based, presumably Debian or it's derivative. You can try the Ubuntu's package search to get which package contains a file with name ending in libpq-fe.h.
I found the package is libpq-dev and file's absolute path is /usr/include/postgresql/libpq-fe.h.
FWIW, on a dpkg based system, you can check which package gives a file if you know the file's absolute path:
% dpkg -S /usr/include/postgresql/libpq-fe.h
libpq-dev: /usr/include/postgresql/libpq-fe.h
Also, unlike find, locate keeps a cache of found files (mlocate.db) that is created everyday via cron; so if the file happens to be removed after the last run, you can run locate libfq-fe.h to get the absolute path to the file without needing to check the Ubuntu package search online.
So the package is libpq-dev. Now, reinstalling it will get everything to the default state i.e. all relevant files will be copied to the right places. As it is only a library package, no user/system level configurations will be overridden (and dpkg will prompt you for action for any package that does that).
To reinstall the package:
sudo apt-get install --reinstall libpq-dev
For me, I realized it was trying to use the deprecated setup.py so I installed wheel (pip install wheel) and that sorted it all out.
Well after installing these libraries
sudo dnf install python-virtualenv openssl-devel gcc libffi-devel libxslt-devel issue was not gone.
I used mlocate to find where libpq-fe.h file is located. On my system (Fedora 32) it was located at /usr/pgsql-10/include/libpq-fe.h
yum install mlocate
sudo updateb
locate libpq-fe.h
After all added this line to ~/.bash_profile
nano ~/.bash_profile
export PATH=/usr/pgsql-10/bin/:$PATH
Works fine, I can easily install psycopg2 without any trouble.
You need to create a LD_LIBRARY_PATH that indicates the path of your library /user/pgsql-11/lib
Source: The 3rd point of build prerequisites at https://www.psycopg.org/docs/install.html#build-prerequisites

How do I uninstall Erlang R16B-03.18.el7 so I can install Erlang 25.0.3?

The R16B version isn't working with the latest version of RabbitMQ I'm trying to install on my VM (needs 23.3 or later) and I already tried to install 25.0.3 but it won't install because it's conflicting with the R16B files that exist.
file /usr/bin/typer from install of esl-erlang-25.0.3-1.x86_64 conflicts with file from package erlang-typer-R16B-03.18.el7.x86_64
That's the error I get. I tried rm -r erlang*.rpm and it asks for a reboot after completing but still gives the same errors.
With this command you just delete the rpm. What you want is to deinstall the rpm. You could use
dnf uninstall PACKAGENAME
where, in your case, PACKAGENAME whould be something like erlang-typer-R16B-03.18.el7.

Yum doesn't show all installed packages

I have logstash installed on one of my CentOS 7 hosts. When I run the sudo yum list installed command, it is not on the list. When I try to install logstash, yum offers me a fresh install. What could be the reason for this behavior?
Probably logstash was installed manually then, and not by yum/rpm. You can check this by asking rpm (which is used by yum under the hood):
rpm -qf /path/to/logstash-binary
translation: to which package does /path/to/logstash-binary belong. Then you'll know if it belongs to an rpm package. If not, that means the binary was installed in some other way (unzipping, ...). rpm (and hence yum) has no knowledge of any files not installed by an rpm package.

Disable yum transaction check for file conflict

How do I disable yum transaction check for a file ?
Transaction check error:
file /usr/local/xenco/backend/current from install of xenco-rr-1.9.6-104.x86_64 conflicts with file from package xenco-server-1.9.6-104.x86_64
Replacing files from another RPM package is bad idea in most cases and I strongly advise against what you're trying to do. That said, apply following at your own risk.
Yum does not provide an option to install conflicting files, I think. However, that does not prevent you from installing a RPM package with rpm(1) which does provide an option to override existing files from another package, namely --replacefiles.
So, first get the RPM of the package you want to install on a local filesystem (/usr/local/xenco... makes me suspect that is the case already). Next install the RPM with rpm -i --replacefiles <your_rpm_file>.
This method worked for me, when I faced similar issue
Simply get the existing package with below command
rpm -qa | grep xenco
Remove those conflicting package with
yum remove packageNameFromTheList
what i always do is remove the package that is on the right hand side. In your case it would be -
yum remove xenco-server-1.9.6-104.x86_64
yum remove <> can work with any package error, i have encountered many such transactions errors when working on vm on cloud, i always remove the package that causes conflicts and always has worked for me.
My two cents:
yum erase ${old_package}
yum install ${new_package_with_same_files}
The exclusion of --replacefiles is intentional. Yum is a package manager, let it manage the packages.
(This answer adds a yum-only solution to the accepted answer.)

How to make Debian package install dependencies?

I want to make a simple Debian package to install a simple tool that depends on Qt4 libs.
In control file I have defined that it depends on Qt4 libs however, by the time I'm testing the package it says that the dependency could not be met.
Question:
How can I make Debian trigger apt to install the dependencies as well?
Can't find that the documentation however I know that apt-get does that.
If you want to avoid creating a local APT repository, you can do:
dpkg -i mypackage.deb
apt-get install --fix-missing
If you do want to create a local repository, you can use reprepro for this.
If you install it via dpkg it won't work because dkpg doesn't know where to find additional dependencies. You could do it via apt-get if you build your own repo, but it's kind of time-consuming the first time (it's not difficult, just something "new" the first time that needs some time to be learnt).
On the other hand, and the solution you are probably looking for is gdebi (you may need to install it: apt-get install gdebi-core). It's a tool that checks the dependencies for a package and calls apt-get to fetch and install them, and then calls dpkg to install your package.
Per #textshell in this answer:
starting with apt 1.1 (available in Xenial (16.04), stretch) apt install also allows local files:
sudo apt install ./foo-1.2.3.deb
So much simpler and cleaner.
See the release
announcment
This will also install dependencies, just like a normal apt install or apt-get install.
If you're creating the Debian package, you specify its dependencies in the debian/ directory control files; I believe debian/control takes Depends: directives for that purpose.
I don't know the details too clearly, myself, but there are instructions at http://www.debian.org/doc/manuals/maint-guide/ ; in particular, http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#control seems to be the right place to start looking.
One way would be to create a local package repository on your computer and add it to /etc/apt/sources.list. Then you could install the package from your local repository with apt-get and have the dependencies resolved automatically.
There's probably an easier way to do it, but I don't know what that would be.

Resources