We have an error in the %preun script of an RPM we distributed in the past. This has been corrected, but, now, upgrading to the newer version is failing because the previous version is not deinstalling cleanly:

Error in PREUN scriptlet in rpm package perl-perfSONAR-OPPD-MP-server
/var/tmp/rpm-tmp.veW9Jb: line 5: syntax error: unexpected end of file
error: %preun(perl-perfSONAR-OPPD-MP-server-3.4-1.pSPS.noarch) scriptlet
failed, exit status 2

This can be solved by uninstalling the outdated package manually without executing the %preun part and then reinstalling the new one:

rpm -e --nopreun perl-perfSONAR-OPPD-MP-server-3.4-1.pSPS.noarch
rpm -i --replacepkgs perl-perfSONAR-OPPD-MP-server-3.5-0.0.a1.pSPS.noarch.rpm

This is a manual procedure that requires intervention of the system administrator which we'd like to avoid.

Do someone know a way to do the same through yum so that the previous package is removed for the new one to get installed without errors, all that with a single yum command or through yum automatic upgrades?

We're using CentOS 6, if that matters.


There is no known way to automate yum upgrades with buggy scripts: yum doesn't parse nor pass the necessary disablers to rpm lib.

  • 1
    Would make a good plugin though – Petter H Jul 10 '15 at 14:55
  • Sure would, but RPM already supports the necessary --nopreun disabler, so this isn't an RPM issue. Equally useful would be a way to mask a missing dependency rather than the way feeble --skip-broken currently implemented in yum and DNF. But I digress ... there is no known way to automate yum/dnf upgrades with broken %preun scripts at the moment. – Jeff Johnson Jul 11 '15 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.