[转]rpm出现"error: %preun( ) scriptlet failed, exit status 1问题

from http://blog.sina.com.cn/s/blog_49451df101000969.html

在linux里安装程序有两种方法,一种是源程序安装,按照安装包里的readme或者install文件指示,一步步地进行,通常是configure,
make, install三部曲。另一种就是rpm包,这个类似windows里常见的安装程序,既可在xwin里双击运行,也可以在终端里输入
rpm -ivh packagename开始安装。

卸装时,用源程序安装的运行make uninstall, 用rpm安装的则仍是使用rpm。

对于接触linux不久的我来说,总感觉这些过程挺麻烦的,时不时会遇到点问题。

今天安装wine的时候,就出了一点岔子,记录下来以为后鉴。

第一次装的wine 版本过高,而且下载的时候一不小心当了for Federa Core的,
结果安装失败。随后重新下载了一个版本低一些的,而再执行安装时由于与前一个安装包的文件冲突,报出许多如下的出错信息。
"file /usr/lib/wine/shdocvw.dll.so from install of
wine-20040716-1rh9winehq conflicts with file from package
wine-20050310-1fc1winehq"

这时,只能用rpm先卸载原先安装的wine。
$rpm -e wine-20050310-1fc1winehq

不料又出现错误:
"error: %preun(wine-20050310-1fc1winehq) scriptlet failed, exit status 1"

经搜索,其解决方法为加 --noscripts 标记来删除RPM。 --noscripts 相当于 --nopre --nopost
--nopreun --nopostun。

即卸载命令变为:
$rpm -e --noscripts wine-20050310-1fc1winehq

若要查看与RPM关联的scripts,使用--script查询RPM包。
$rpm -q --scripts package

卸载时,若系统里有同一程序的多个安装版本要一起删除,可使用--allmatches标记,如
$ rpm -e --noscripts --allmatches wine


卸载成功后,重新安装新的wine包
$rpm -ivh wine-20040716-1rh9winehq.i386.rpm
现在,通过wine可以在linux里运行for windows的程序了。
 
 
 
 
 
 
 
 
 
 
 
 
 删除rpm包报错
[root@vm-10-152-4-47 ~]# rpm -e flume
Failed to stop zabbix_agentd.service: Unit zabbix_agentd.service not loaded.
error: %preun(flume-3.0.3-1.el7.centos.x86_64) scriptlet failed, exit status 5
error: flume-3.0.3-1.el7.centos.x86_64: erase failed
 
解决方法:
rpm -e --noscripts flume 添加参数 --noscripts
 
 
原文地址:https://www.cnblogs.com/openstack-elk/p/6826560.html