一次安装rpcbind失败引发的思考

时间:2023-03-09 05:22:26
一次安装rpcbind失败引发的思考

问题:

yum install rpcbind -y

出现如下错误:

Error in PREIN scriptlet in rpm package rpcbind-0.2.-.el6.x86_64
error: %pre(rpcbind-0.2.-.el6.x86_64) scriptlet failed, exit status
error: install: %pre scriptlet failed (), skipping rpcbind-0.2.-.el6
Verifying : libtirpc-0.2.-.el6.x86_64 /
Verifying : libgssglue-0.1-.el6.x86_64 /
Verifying : rpcbind-0.2.-.el6.x86_64 / Dependency Installed:
libgssglue.x86_64 :0.1-.el6 libtirpc.x86_64 :0.2.-.el6 Failed:
rpcbind.x86_64 :0.2.-.el6

解决:

错误提示安装软件的时候执行什么脚本出现了错误,经百度之后知道在安装rpm软件包的时候,会先执行rpm包中的预处理脚本,应该是执行这个脚本的时候出现了错误,所以我尝试查看这个脚本都执行了什么内容;

那么如何获取到这个脚本呢?

取对应的rpm包
yum install xxxxpackage  --downloadonly --downloaddir=/root
取得rpm对应的安装预处理脚本
rpm --scripts -qp xxxxpackage  > x-scripts.log

详见:

http://xifan.blog.51cto.com/632768/372307/

发现该脚本中有用到useradd/userdel命令来添加rpc的用户,由此想起之前使用chattr +i /etc/passwd对passwd文件做了加锁处理,所以会造成useradd/userdel命令不能正常执行,这应该就是造成预处理脚本不能正常执行的原因了吧,使用chattr -i /etc/passwd解锁之后软件可以正常安装。

注:从出现错误,到发现预处理脚本这一概念,再到想起passwd锁定一共花费了将近2个小时。

总结:

1.要了解软件安装的原理

2.只要是对系统有做过任何修改,一定要有相关的记录档案,包括执行了什么命令。