LINUX rpm -e --nodeps危险命令之卸载elfutils-libelf导致rpm工具不可用

    2018年4月24日,一新手练习mysql数据库安装其中有一步骤需要安装 elfutils-libelf-devel-0.164-2.el6.x86_64.rpm elfutils-libelf-0.164-2.el6.x86_64.rpm包,在安装过程中报错版本冲突:
[root@centos ~]# rpm -ivh elfutils-libelf-devel-0.164-2.el6.x86_64.rpm elfutils-libelf-0.164-2.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
file /usr/lib64/libelf.so.1 from install of elfutils-libelf-0.164-2.el6.x86_64 conflicts with file from package elfutils-libelf-0.152-1.el6.x86_64
file /usr/share/locale/de/LC_MESSAGES/elfutils.mo from install of elfutils-libelf-0.164-2.el6.x86_64 conflicts with file from package elfutils-libelf-0.152-1.el6.x86_64
file /usr/share/locale/en@boldquot/LC_MESSAGES/elfutils.mo from install of elfutils-libelf-0.164-2.el6.x86_64 conflicts with file from package elfutils-libelf-0.152-1.el6.x86_64
file /usr/share/locale/en@quot/LC_MESSAGES/elfutils.mo from install of elfutils-libelf-0.164-2.el6.x86_64 conflicts with file from package elfutils-libelf-0.152-1.el6.x86_64
file /usr/share/locale/es/LC_MESSAGES/elfutils.mo from install of elfutils-libelf-0.164-2.el6.x86_64 conflicts with file from package elfutils-libelf-0.152-1.el6.x86_64
file /usr/share/locale/ja/LC_MESSAGES/elfutils.mo from install of elfutils-libelf-0.164-2.el6.x86_64 conflicts with file from package elfutils-libelf-0.152-1.el6.x86_64
file /usr/share/locale/pl/LC_MESSAGES/elfutils.mo from install of elfutils-libelf-0.164-2.el6.x86_64 conflicts with file from package elfutils-libelf-0.152-1.el6.x86_64
file /usr/share/locale/uk/LC_MESSAGES/elfutils.mo from install of elfutils-libelf-0.164-2.el6.x86_64 conflicts with file from package elfutils-libelf-0.152-1.el6.x86_64
[root@centos ~]#
    然后他就卸载了本地低版本的elfutils-libelf:
[root@centos ~]# rpm -e --nodeps elfutils-libelf
    接着,再执行  rpm -ivh elfutils-libelf-devel-0.164-2.el6.x86_64.rpm elfutils-libelf-0.164-2.el6.x86_64.rpm 报错:
[root@centos ~]# rpm -ivh elfutils-libelf-devel-0.164-2.el6.x86_64.rpm elfutils-libelf-0.164-2.el6.x86_64.rpm 
rpm: error while loading shared libraries: libelf.so.1: cannot open shared object file: No such file or directory
    这时,rpm已经被破坏缺失 libelf.so.1而不能用。
    要修复rpm包也很简单,从别的机器上赋值
 libelf.so.1放在/usr/lib64/下(我是从rhel5的机器上复制过来的):
[root@centos ~]# cp libelf.so.1 /usr/lib64/
    再执行rpm命令有如下输出表示rpm工具已经修复:
[root@centos ~]# rpm 
RPM version 4.8.0
Copyright (C) 1998-2002 - Red Hat, Inc.
This program may be freely redistributed under the terms of the GNU GPL
Usage: rpm [-aKfgpWHqVcdilsKiv?] [-a|--all] [-f|--file] [-g|--group] [-p|--package] [-W|--ftswalk] [--pkgid] [--hdrid] [--fileid] [--specfile] [--triggeredby]
        [--whatrequires] [--whatprovides] [--nomanifest] [-c|--configfiles] [-d|--docfiles] [--dump] [-l|--list] [--queryformat=QUERYFORMAT] [-s|--state]
        [--nofiledigest] [--nomd5] [--nofiles] [--nodeps] [--noscript] [--comfollow] [--logical] [--nochdir] [--nostat] [--physical] [--seedot] [--xdev]
        [--whiteout] [--addsign] [-K|--checksig] [--delsign] [--import] [--resign] [--nodigest] [--nosignature] [--initdb] [--rebuilddb] [--aid] [--allfiles]
        [--allmatches] [--badreloc] [-e|--erase <package>+] [--excludedocs] [--excludepath=<path>] [--fileconflicts] [--force] [-F|--freshen <packagefile>+]
        [-h|--hash] [--ignorearch] [--ignoreos] [--ignoresize] [-i|--install] [--justdb] [--nodeps] [--nofiledigest] [--nomd5] [--nocontexts] [--noorder]
        [--nosuggest] [--noscripts] [--notriggers] [--oldpackage] [--percent] [--prefix=<dir>] [--relocate=<old>=<new>] [--replacefiles] [--replacepkgs]
        [--test] [-U|--upgrade <packagefile>+] [--quiet] [-D|--define 'MACRO EXPR'] [-E|--eval 'EXPR'] [--macros=<FILE:...>] [--nodigest] [--nosignature]
        [--rcfile=<FILE:...>] [-r|--root ROOT] [--querytags] [--showrc] [--quiet] [-v|--verbose] [--version] [-?|--help] [--usage] [--scripts] [--setperms]
        [--setugids] [--conflicts] [--obsoletes] [--provides] [--requires] [--info] [--changelog] [--xml] [--triggers] [--last] [--dupes] [--filesbypkg]
        [--fileclass] [--filecolor] [--fscontext] [--fileprovide] [--filerequire] [--filecaps]
[root@centos ~]#
    总结:LINUX rpm -e --nodeps危险,一定要慎用,否则主机内核被破坏。


猜你喜欢

转载自blog.csdn.net/www_xue_xi/article/details/80067645
今日推荐