LINUX在卸载elfutils-libelf导致rpm工具不可用该怎么办

LINUX在卸载elfutils-libelf导致rpm工具不可用该怎么办,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

    2021年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危险,一定要慎用,否则主机内核被破坏。

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/199482.html

(0)
上一篇 2021年11月20日
下一篇 2021年11月20日

相关推荐

发表回复

登录后才能评论