Removing an RPM with bad %postun script

Once I have forgotten to close bash `if` statement with `fi` in my spec:

%preun
if [ $1 -eq 0 ] ; then
/sbin/service %{name} stop >/dev/null 2>&1
/sbin/chkconfig --del %{name}-heart
/sbin/chkconfig --del %{name}-os-amqp

So, an non-uninstallable RPM was created!

rpm fails to uninstall it:

[root@alessio-hp noarch]# rpm -e nova-billing
/var/tmp/rpm-tmp.ov3Rqg: line 5: syntax error: unexpected end of file
error: %preun(nova-billing-2.0.0-0.20120420.1017.el6.noarch) scriptlet failed, exit status 2

yum ended with mutually exclusive statements:

[root@alessio-hp noarch]# yum erase nova-billing
...
nova-billing-2.0.0-0.20120420.1017.el6.noarch was supposed to be removed but is not!
duration: 648(ms)
Installed products updated.

Removed:
nova-billing.noarch 0:2.0.0-0.20120420.1017.el6

Complete!

And here is the solution:

[root@alessio-hp rpm]# rpm -e --noscripts nova-billing
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s