libselinux是Linux系统内的一个十分重要的依赖包,非常多的软件都是依赖此包的,比如,OpenSSL,OpenSSL-devel ,systemd等等。如果缺少此包,将会造成灾难性的后果,比如,ls,cp,mv等等基础命令无法使用,yum命令也不能正常使用,但,cd命令是不受此影响的。
libselinux conflicts with systemd-219-19.el7.x86_64 指的是 libselinux和systemd包有冲突,但,这个错误提示是十分笼统的,而产生这一错误通常是由于yum源所使用的rpm包版本太低或者太高而导致的(比如,服务器的版本是centos7.9,而yum源使用的是centos7.2操作系统镜像文件里的libselinux文件,这样会造成很明显的不适配,从而软件冲突)。
由于此包是Linux系统的基础包,因此,推荐使用安装本服务器时所使用的操作系统镜像文件,比如,某个服务器安装的是centos7.2.1511操作系统,那么,先确保使用的yum源是从centos7.2.1511操作系统镜像文件导出来的文件。
也就是说,正确的搭建一个yum本地源,如何搭建请参阅我的另一个博客:Linux的完全本地仓库搭建指南(科普扫盲贴)_zsk_john的博客-CSDN博客
其次,需要使用xshell登录服务器,服务器有安装ZModem协议软件, 也就是lrzsz 这个软件,当系统的大部分命令不能使用的时候,可以直接从健康的服务器拖拽文件到有问题的服务器上。 该软件的安装命令为: yum install lrzsz -y
libselinux的依赖大体如下:
[root@master lib64]# rpm -e libselinux
error: Failed dependencies:
libselinux >= 1.25.2-1 is needed by (installed) shadow-utils-2:4.1.5.1-24.el7.x86_64
libselinux >= 1.33.2 is needed by (installed) pam-1.1.8-18.el7.x86_64
libselinux >= 1.27.7 is needed by (installed) openssh-7.4p1-11.el7.x86_64
libselinux >= 2.0.64 is needed by (installed) cronie-1.4.11-17.el7.x86_64
libselinux >= 2.1.6-3 is needed by (installed) passwd-0.79-4.el7.x86_64
libselinux(x86-64) = 2.5-11.el7 is needed by (installed) libselinux-utils-2.5-11.el7.x86_64
libselinux(x86-64) = 2.5-11.el7 is needed by (installed) libselinux-python-2.5-11.el7.x86_64
libselinux(x86-64) >= 1.15.2 is needed by (installed) dbus-1:1.6.12-17.el7.x86_64
libselinux(x86-64) = 2.5-11.el7 is needed by (installed) libselinux-devel-2.5-11.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) glibc-common-2.17-196.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) sed-4.2.2-5.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) chkconfig-1.7.4-1.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) findutils-1:4.5.11-5.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) tar-2:1.26-32.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) iproute-3.10.0-87.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) vim-minimal-2:7.4.160-2.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) libselinux-utils-2.5-11.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) libsemanage-2.5-8.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) coreutils-8.22-18.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) krb5-libs-1.15.1-8.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) shadow-utils-2:4.1.5.1-24.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) libmount-2.23.2-43.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) glib2-2.50.3-3.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) pam-1.1.8-18.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) systemd-libs-219-42.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) libselinux-python-2.5-11.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) logrotate-3.8.6-14.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) rpm-libs-4.11.3-25.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) rpm-4.11.3-25.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) libuser-0.60-7.el7_1.x86_64
libselinux.so.1()(64bit) is needed by (installed) util-linux-2.23.2-43.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) policycoreutils-2.5-17.1.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) rpm-build-libs-4.11.3-25.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) rpm-python-4.11.3-25.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) device-mapper-libs-7:1.02.140-8.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) systemd-219-42.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) dbus-1:1.6.12-17.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) NetworkManager-1:1.8.0-9.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) cronie-anacron-1.4.11-17.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) cronie-1.4.11-17.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) net-tools-2.0-0.22.20131004git.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) openssh-server-7.4p1-11.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) parted-3.1-28.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) openssh-clients-7.4p1-11.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) passwd-0.79-4.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) sudo-1.8.19p2-10.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) httpd-tools-2.4.6-67.el7.centos.x86_64
libselinux.so.1()(64bit) is needed by (installed) httpd-2.4.6-67.el7.centos.x86_64
libselinux.so.1()(64bit) is needed by (installed) libselinux-devel-2.5-11.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) krb5-devel-1.15.1-8.el7.x86_64
libselinux.so.1()(64bit) is needed by (installed) vim-enhanced-2:7.4.160-2.el7.x86_64
那么,如果遇到libselinux conflicts with systemd-219-19.el7.x86_64或者类似的问题,先将这个rpm包卸载就可以了。
[root@master lib64]# rpm -e libselinux --nodeps
这样卸载之后,rpm,yum,ls,mv,cp等等大部分的命令都不能使用,但cd命令可以使用。比如:
[root@master lib64]# ls
ls: error while loading shared libraries: libselinux.so.1: cannot open shared object file: No such file or directory
[root@master lib64]# mv
mv: error while loading shared libraries: libselinux.so.1: cannot open shared object file: No such file or directory
[root@master lib64]# cd /usr/lib64/
此时,从正常的机器上将libselinux.so.1 这个文件直接拖拽到 /usr/lib64 这个目录下就可以恢复使用啦。
[root@master lib64]# rpm -qa |grep libselinux
libselinux-devel-2.5-11.el7.x86_64
libselinux-python-2.5-11.el7.x86_64
libselinux-utils-2.5-11.el7.x86_64
如果,没有安装libselinux-devel,此时,使用yum安装libselinux-devel将会同时将libselinux安装好,如果libselinux版本较低,yum也会自动帮你调整好libselinux的版本,正常的系统内,libselinux的相关包应该是如下的(四个,一定不要少了):
安装命令是:yum install libselinux-devel -y
[root@slave1 ~]# rpm -qa |grep libselinux
libselinux-2.5-11.el7.x86_64
libselinux-devel-2.5-11.el7.x86_64
libselinux-python-2.5-11.el7.x86_64
libselinux-utils-2.5-11.el7.x86_64
总结:
libselinux如果有问题,可以曲线安装一下libselinux-devel, 这两个是一对双胞胎。
yum源一定要选择好,不要用不同的操作系统镜像文件制做离线安装包,否则各种依赖报错会让你怀疑人生(一定要搭建有一个符合的本地仓库)。
lrzsz软件还是比较有用处的,像这样的情况,如果没有lrzsz将会是比较麻烦的,至少得进一次救援模式。
|