LINUX rpm -e --nodeps危險命令之解除安裝elfutils-libelf導致rpm工具不可用

清風艾艾發表於2018-04-24
    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危險,一定要慎用,否則主機核心被破壞。




來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29357786/viewspace-2153301/,如需轉載,請註明出處,否則將追究法律責任。

相關文章