rpm installation fails due to depencency /bin/sh not found - linux

i am trying to install a package using rpm, for which i have created a different database using rpmdb --initdb --dbpath $HOME/myrpmdb and specifying that path in the --dbpath while insatlling.
The error i am getting is
root#jason:su rpm --dbpath $HOME/myrpmdb -ivh XXX.rpm
error: Failed dependencies:
/bin/sh is needed by XXX
and /bin/sh exist
Is there some way that i can specify this to the installer?
Is there something i missed during the creation of different rpm database cause of which now it not able to fine the default commands?

Right way install rpm via alien:
alien -i my_rpm_name.rpm
If alien is not installed:
sudo apt-get install alien

error: Failed dependencies:
/bin/sh is needed by XXX
This happens because bash rpm is not available in the new rpmdb path. You would have to use following to get the rpm installed.
# rpm --dbpath $HOME/myrpmdb --nodeps -ivh XXX.rpm

Because you've told it to use a completely different database, rpm doesn't look at the system database which is where /bin/sh would be found.

Why use a different rpm database? There should be a really good reason to go this route...
If you must have a private rpm db, you can copy the system db into your private one
cp /var/lib/rpm/* ~/myrpmdb/.
installing with --nodeps may be the easiest way... copying the rpm db is really sub-optimal, it will soon be out of date and not reflect the state of the system.

Related

Need to install rpm package inside docker container without internet connectivity

I have a machine which has no internet connectivity and no access to any docker repository (so no image pulls are possible). I want to install memcached and I have the .rpm file available.
When I want to install on the host machine I execute the command rpm -ivh memcached-1.4.15-10.el7_3.1.x86_64.rpm . But I suppose that is because the rpm package manager comes pre-installed on the host OS.
In the docker container I load the .rpm file and in the dockerfile I include the command RUN rpm -ivh memcached-1.4.15-10.el7_3.1.x86_64.rpm. After that I get the following error:
/bin/sh: 1: rpm: not found
The command '/bin/sh -c rpm -ivh /home/memcached-1.4.15-10.el7_3.1.x86_64.rpm' returned a non-zero code: 127
I suppose that is because in a docker container the OS has the bare minimum installation. So how do I install the rpm package manager inside the container without internet connection? Is there an installable file for it.
I understand it is not the best practice to not use a central repository for images. Want to know if installing without internet is even possible?
I am creating the container on a CentOS machine right now. And following is the dockerfile:
FROM microsoft/dotnet:2.0-runtime
WORKDIR /home
#mempkgtest folder contains the .rpm file
COPY ${source:-mempkgtest} .
RUN rpm -ivh /home/memcached-1.4.15-10.el7_3.1.x86_64.rpm
ENTRYPOINT ["dotnet", "--info"]
Docker image microsoft/dotnet is build on top of buildpack-deps:jessie-scm (from here) which is build on top debian:jessie (from here and here).
debian does not use rpm package manager, it uses deb format for packages. /bin/sh kindly informs you, that is hasn't found rpm manager by saying /bin/sh: 1: rpm: not found. You can read how to install rpm packages on debian here.
Anyway, why don't you use deb file and dpkg package manager? You can find memcached pacakge for debian jessie here. You can do smth like this in your dockerfile:
ADD http://ftp.us.debian.org/debian/pool/main/m/memcached/memcached_1.4.21-1.1+deb8u1_amd64.deb
RUN dpkg -i memcached_1.4.21-1.1+deb8u1_amd64.deb
And remember, you will need to copy dependencies too.
Why don't you make your docker image on machine with internet access, than export docker image using docker export and then copy and import it on your destination machine? Such way is simpler and apt-get will resolve and install all memcached dependencies for you.

zypper: command not found in SUSE linux

I was not aware that zypper is like yum for SUSE. I deleted that file from bin, now I am not able to install any application through it. I throws an error that
sudo: zypper: command not found
How do I install zypper back and make it work like as normal?
Depending on your system and architecture, find Zypper package file (RPM) in online repository (i.e. http://download.opensuse.org/distribution/13.2/repo/oss/suse/i586/ ), download it (wget) and install it (rpm -i) :
wget http://download.opensuse.org/distribution/13.2/repo/oss/suse/i586/zypper-1.11.14-2.1.i586.rpm
sudo rpm -ivh zypper-1.11.14-2.1.i586.rpm

xz compression install on centos

Any installation or update using yum command I ended up error: Error: xz compression not available. On website I read that Python library is missing. When you try to install a library (sudo yum update pyliblzma) again failed with error. Do not know how? Thanks.
This problem comes if you installed a wrong epel release on your machine. If so, then you need to remove the epel release by
yum remove epel-release
Sometimes that is not enough, you need to remove the cache as well by:
rm -rf /var/cache/yum/x86_64/6/epel
Then you can install the epel-release again
yum -y install epel-release
You need install the EPEL repository by downloading the appropriate RPM package for your system and installing it. For example, for CentOS and Red Hat Enterprise Linux 6.x:
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm
If you get a File Not Found error message when trying to download the package, the version number might have changed. You can access the latest version of the RPM installer from the Fedora EPEL wiki page. The wiki page also includes additional instructions for Red Hat Network subscribers who are installing the EPEL repository.
Finally, install the Python library:
yum install pyliblzma
This works perfecly in my CentOS 6.x.
I've found a solution on this page of stackexchange, working in CentOS 6.X:
https://unix.stackexchange.com/a/314756
sudo rpm -e epel-release-7-5.noarch
wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -ivh epel-release-6-8.noarch.rpm
sudo yum clean all
sudo rpmdb -v --rebuilddb
sudo yum -y install libselinux-python
I was also suffering from this issue..
If you are installing packages but it is already available on your system.
Remove existing packages and then try to install new.
It will work properly...
I was able to solve this problem by installing pyliblzma using rpm instead of yum as yum is not working.
Find pyliblzma rpm package according to your architecture and install it using the command.
rpm -Uvh pyliblzma-version-release.architecture.rpm
I used the following command to install pyliblzma for my 64 bit Redhat 6.8 machine. Please check URL in the command and make changes accordingly.
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/pyliblzma-0.5.3-3.el6.x86_64.rpm
In my case the issue was caused by missing modules in python's site-packages directory. Here's what I did:
$ rpm -Va
to get a list of all files belonging to all rpms that do not verify. I got a bunch of messages about missing modules:
missing /usr/lib64/python2.7/site-packages/...
Luckily, I had an identical CentOS version elsewhere with all these packages present, so I just copied them over and ran
$ rpmdb -v --rebuilddb
to rebuild rpm database.

How do I install PDFTK on VPS for cPanel or CentOS?

I tried using the following commands. However when I reach the last step to install pdftk the console is giving me the error below. I am using a hostgator VPS server. any possible suggestions would be great.
NB: I tried installing libgcj.so.7rh()(64bit) but it already exists. maybe I am doing something wrong.
**Error:** Package: pdftk-1.44-2.el5.rf.x86_64 (rpmforge)
Requires: libgcj.so.7rh()(64bit)
You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
sendmail-cf-8.14.4-8.el6.noarch has missing requires of sendmail = ('0', '8.14.4', '8.el6')
These are the steps that I followed.
# Log in as root
cd /usr/local/src
# Type
uname -i
#To see which package you need
#Pick one of the below vdepending on the output of uname -i
i386<br>
wegt packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
x86_64 <br>
wget packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
#Then type
rpm --import apt.sw.be/RPM-GPG-KEY.dag.txt
Verify the downloaded package
rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
#Install RPM
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
#Then
yum install pdftk
Note: I had to remove the http:// from the links in the commands above before posting.
It seems like you might have a 32-bit OS installed? If you ran through each of those commands in order, you would be trying to use the 64-bit rpmforge repository, which is incorrect for a 32-bit OS.
If that is an accurate supposition, do this..
cd /etc/yum.repos.d/
ls -al
rm <each-rpmforge-file>
Then...
cd /usr/local/src
yum clean
wget packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
yum update
yum install pdftk

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