问题原因: 卸载过程中的chkconfig --del mysoft需要使用到/sbin/insserv相关工具,缺失工具时,语句执行不成功,因此返回error: %preun错误。
修改办法: 卸载时检测系统上是否安装了insserv工具(机器上的版本为insserv-compat-0.1-2.15.noarch.rpm),没有则提示“Uninstall failed, you need install 'insserv' tools before retry.”,并返回一个错误码-1(即255),使后续的其它卸载操作不再进行。
对于暂时无法找到此工具的用户,可以执行如下两条命令进行卸载,两条命令按先后执行。
rpm -e --noscripts mytest-mysoft
rpm -e mytest-mysoft
更正后没有安装工具的卸载报错提示: linux-m8wg:~ # rpm -e mytest-mysoft Uninstall failed, you need install 'insserv' tools before retry. error: %preun(mytest-mysoft-1.2.2008-sles.15sp1.x86_64) scriptlet failed, exit status 255 error: mytest-mysoft-1.2.2008-sles.15sp1.x86_64: erase failed
附问题分析记录: %preun killall -9 HaDetector if [ $1 == 0 ] ;then /etc/init.d/mysoft stop > /dev/null 2>&1 chkconfig --del mysoft > /dev/null 2>&1 fi
rpm -e --noscripts mytest-mysoft
linux-8jx7:~ # chkconfig --del mysoft /sbin/insserv: No such file or directory
Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'.
mysoft 0:off 1:off 2:off 3:off 4:off 5:off 6:off