Weird RPM Dependency Error; ‘/bin/sh’ Needed, But Is Provided

Home » CentOS » Weird RPM Dependency Error; ‘/bin/sh’ Needed, But Is Provided
CentOS 3 Comments

First off, I have to admit that I’m uncertain if this is the appropriate forum; I’d be happy for suggestions about where else to look.

I’m doing this work on a stock install of CentOS-7-x86_64-Minimal-1810.iso, with no updates.

I’m trying to create an RPM database from a custom set of RPMs.

One RPM (‘openLDAP-ltb’ from the LDAP Tool Box project (ltb-project.org)
has a dependency on ‘/bin/sh’. The bash RPM is demonstratedly present, yet the the ‘rpm’ utility thinks this dependency is not met.

I’m open to any advice as to how to progress.

It pretty easy to demonstrate what’s going wrong, rather than trying to describe it.

Straightforward to reproduce:

Here, I collect the misc bits from the net:

$ wget –quiet http://mirrors.mit.edu/CentOS/7/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso
$ wget –quiet http://mirrors.mit.edu/CentOS/7/os/x86_64/Packages/libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm
$ wget –quiet https://ltb-project.org/archives/berkeleydb-ltb-4.6.21.NC-4.el7.patch4.x86_64.rpm
$ wget –quiet https://ltb-project.org/archives/openLDAP-ltb-2.4.47-1.el7.x86_64.rpm

Now, I try to make an RPM database of these packages. The last step fails with an unmet dependency:

$ sudo mount ~/CentOS-7-x86_64-Minimal-1810.iso -r -t iso9660 -o loop /mnt
$ mkdir -p ~/local_rpm_db
$ rpm –initdb –dbpath ~/local_rpm_db
$ rpm –justdb –ignoresize –dbpath ~/local_rpm_db -Uvh /mnt/Packages/*.rpm *.rpm
warning: /mnt/cdrom/Packages/acl-2.2.51-14.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
warning: berkeleydb-ltb-4.6.21.NC-4.el7.patch4.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 6d45bfc5: NOKEY
error: Failed dependencies:
/bin/sh is needed by openLDAP-ltb-2.4.47-1.el7.x86_64

Which is weird, as the ‘bash’ RPM is clearly part of the set, and ‘provides’
the needed feature:

$ rpm -q -provides -p /mnt/Packages/bash-4.2.46-31.el7.x86_64.rpm | egrep ‘sh$’
/bin/bash
/bin/sh

Further, it’s not among the list of files in the payload of the RPM:

$ rpm -q -l -p /mnt/Packages/bash-4.2.46-31.el7.x86_64.rpm | egrep ‘sh$’
/usr/bin/bash
/usr/bin/sh

These tactics did work with the related bits for CentOS 6.

Here are some details of my environment; I’m happy to provide more, if anyone has any questions:

$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
$ rpm -qf /usr/bin/rpm
rpm-4.11.3-35.el7.x86_64

3 thoughts on - Weird RPM Dependency Error; ‘/bin/sh’ Needed, But Is Provided

  • I’m no expert on binary formats, but I think openLDAP-ltb-2.4.47-1.el7.x86_64.rpm is broken. Try this against a base rpm, e.g.,

    rpm -q –requires -p ./cpio-2.11-27.el7.x86_64.rpm | od -c warning: ./cpio-2.11-27.el7.x86_64.rpm: Header V3 RSA/SHA256
    Signature, key ID f4a80eb5: NOKEY
    0000000 / b i n / s h \n / b i n / s h \n
    0000020 / s b i n / i n s t a l l – i n
    0000040 f o \n / s b i n / i n s t a l l
    0000060 – i n f o \n l i b c . s o . 6 (
    0000100 ) ( 6 4 b i t ) \n l i b c . s o

    Then run the same thing against the openLDAP-ltb package:

    warning: ./openLDAP-ltb-2.4.47-1.el7.x86_64.rpm: Header V4 DSA/SHA1
    Signature, key ID 6d45bfc5: NOKEY
    0000000 / b i n / b a s h \n / b i n / s
    0000020 h \n / b i n / s h \n / b i n / s
    *
    0000060 h \n / s b i n / l d c o n f i g
    0000100 \n b e r k e l e y d b – l t b

    That asterick where 0000040 (and its contents) should be is worrisome to me. To my eye, something is amiss.

  • In the ‘hexdump’ and ‘od’ utilities, the ‘*’ means a duplicate line was suppressed. From od(1):

    -v, –output-duplicates
    do not use * to mark line suppression

    To wit:

    $ rpm -q -requires -p openLDAP-ltb-2.4.47-1.el7.x86_64.rpm | od -c | head -5
    warning: openLDAP-ltb-2.4.47-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature,
    key ID 6d45bfc5: NOKEY
    0000000 / b i n / b a s h \n / b i n / s
    0000020 h \n / b i n / s h \n / b i n / s
    *
    0000060 h \n / s b i n / l d c o n f i g
    0000100 \n b e r k e l e y d b – l t b
    $ rpm -q -requires -p openLDAP-ltb-2.4.47-1.el7.x86_64.rpm | od -cv | head -5
    warning: openLDAP-ltb-2.4.47-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature,
    key ID 6d45bfc5: NOKEY
    0000000 / b i n / b a s h \n / b i n / s
    0000020 h \n / b i n / s h \n / b i n / s
    0000040 h \n / b i n / s h \n / b i n / s
    0000060 h \n / s b i n / l d c o n f i g
    0000100 \n b e r k e l e y d b – l t b

    And indeed, for whatever reason, openLDAP-ltb lists ‘/bin/sh’ several times:

    $ rpm -q -requires -p openLDAP-ltb-2.4.47-1.el7.x86_64.rpm | head -5
    warning: openLDAP-ltb-2.4.47-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature,
    key ID 6d45bfc5: NOKEY
    /bin/bash
    /bin/sh
    /bin/sh
    /bin/sh
    /bin/sh

  • I’m circling back to this topic:

    http://CentOS.1050465.n5.nabble.com/CentOS-weird-RPM-dependency-error-bin-sh-needed-but-is-provided-td5755402.html#a5755405

    I’ve asked the LTB folks about the symptoms I report, and they can’t find anything mysterious going on.

    They directed me to their SPEC file:

    https://github.com/ltb-project/openLDAP-rpm/blob/master/SPECS/openLDAP-ltb.spec

    Further, I tried a rebuild of their source RPM on my CentOS 7.6.1810
    host, and the resulting RPM yielded the same symptoms:

    http://ltb-project.org/archives/openLDAP-ltb-2.4.47-1.el7.src.rpm

    I can directly install the related RPMs on a CentOS 7.6.1810 host;
    it seems specific to my effort to building a private RPM database.

    I don’t see any updates to the ‘rpm’ package itself that might address what I’m seeing.