PREIN failing when using yum api to update a package

Karthik Ram listaction at gmail.com
Tue Nov 12 16:30:03 UTC 2013


I am trying to use the yum api to patch a package.

It works in most cases but in some cases it does fails and gives strange
errors.

When I look at the yum cli source code, it appears that it uses the
rpmtrans directly and not the yum api to perform updates.

here's a test code:
#cat test.py
import yum;
updates = ['initscripts']
yumb = yum.YumBase()
pl = yumb.doPackageLists('updates')
exactmatch, matched, unmatched = yum.packages.parsePackages(pl.updates,
updates)
yb = yum.YumBase()
yb.doUnlock()
yb.conf.assumeyes = True
for po in exactmatch:
    yb.update(po)
yb.buildTransaction()
yb.processTransaction() #omitting callbacks for illustration
yb.closeRpmDB()

and here's the error:
# python test.py
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.ndchost.com
 * extras: mirrors.easynews.com
 * updates: mirror.rackspace.com
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.ndchost.com
 * extras: mirrors.easynews.com
 * updates: mirror.rackspace.com
Running rpm_check_debug
Error in PREIN scriptlet in rpm package
initscripts-9.03.38-1.el6.centos.2.x86_64
/var/tmp/rpm-tmp.JGu9SX: line 1: /usr/sbin/groupadd: Permission denied
error: %pre(initscripts-9.03.38-1.el6.centos.2.x86_64) scriptlet failed,
exit status 126
error:   install: %pre scriptlet failed (2), skipping
initscripts-9.03.38-1.el6.centos.2
initscripts-9.03.38-1.el6.centos.x86_64 was supposed to be removed but is
not!
Verify: 1/2: initscripts.x86_64 0:9.03.38-1.el6.centos - ud
Verify: 2/2: initscripts.x86_64 0:9.03.38-1.el6.centos.2 - u


The same thing works if I call the yum cli - and I believe ud flag  - where
it is trying to remove it is not getting removed (and yum cli appears to
use the rpmtransaction directly and not this api).

My understanding is that buildtransaction does depsolve and process will do
whatever has to be done to each package in the transaction set (if
something has to be deprecated).


os info:
 uname -a
Linux CentOS6464b 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux

cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
This does not happen on all centos 6.4s but in this case - the fact that
yum cli works and the api does not is the main issue.
Any ideas on how to resolve this?

thanks in advance
K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.baseurl.org/pipermail/yum-devel/attachments/20131112/9af3e64b/attachment.html>


More information about the Yum-devel mailing list