Is there a way to turn off %pretrans?

Panu Matilainen pmatilai at
Tue Apr 5 09:06:37 UTC 2016

On 04/04/2016 12:42 PM, Thierry Vignaud wrote:
> On 3 April 2016 at 03:21, doc <drplastic99 at> wrote:
>> A customer is using RedHat Kickstart to install packages on bare metal
>> machines.  Unfortunately, the %pretrans in the first package fails because
>> /bin/sh hasn't been installed.   What I'm being told is that the following
>> %pretrans scriptlet is not supported by RedHat Kickstart.
>> %pretrans
>> [ -n "$VERBOSE" ] && set -x ; :
>> Am I missing something?
> If's RHEL7, then using sg like "Requires(pretrans): coreutils bash" should work.
> (actually anything using rpm-4.9+ would support this)
> Though rpm should emits such requires automatically (well for the
> shell, not for the commands you'll actually be using)
> eg:
> $ rpm -qpR -v RPMS/x86_64/foobar-1-1.x86_64.rpm
> interp,posttrans: /bin/sh
> interp,pretrans: /bin/sh
> With that, rpmlib should order packages installation such as bash is
> installed prior to this package.

No amount of ordering can satisfy Requires(pretrans) dependencies that 
are not already installed. By definition, pretrans scriptlets run before 
the transaction has started, so Requires(pretrans) provider has to be 
already installed, it cannot come from the transaction that is about to 

Newer rpm can correctly express this: a pretrans dependency on a 
non-installed package will simply always fail on dependency check. Older 
versions just ignore the unsatisfiable dependency.

In practise this means that something like "Requires(pretrans): /bin/sh" 
can only ever work on an already installed system (including system 
upgrade), but never on a fresh installation. Which of course is rather 
useless, and which is why all %pretrans scriptlets have to be written 
using the embedded Lua interpreter (ie %pretrans -p <lua>) in practise.

	- Panu -

More information about the Rpm-list mailing list