日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
CentOS7/lib64被重命名后的解決

centos 7 64 位系統(tǒng),為了測(cè)試,把/usr/lib64重命名成了/usr/lib64.bk,結(jié)果發(fā)現(xiàn),在運(yùn)行vi命令的時(shí)候報(bào)錯(cuò):

為炎陵等地區(qū)用戶提供了全套網(wǎng)頁(yè)設(shè)計(jì)制作服務(wù),及炎陵網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為網(wǎng)站設(shè)計(jì)制作、做網(wǎng)站、炎陵網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專(zhuān)業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!

-bash: /usr/bin/vi: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory

想把它重命名回來(lái),發(fā)現(xiàn)在運(yùn)行mv命令的時(shí)候,也是一樣的報(bào)錯(cuò)。除此之外,ls,cp,ftp,wget,rz,7z,unzip,tar什么的統(tǒng)統(tǒng)運(yùn)行不了,就連重新ssh遠(yuǎn)程都遠(yuǎn)程不了。。。

這下悲劇了,難道僅僅因?yàn)橐粋€(gè)很小的mv操作,整個(gè)shell都崩潰了?

然后開(kāi)始baidu,很多都是設(shè)置LD_LIBRARY_PATH, LD_PRELOAD這兩個(gè)環(huán)境變量,來(lái)改變應(yīng)用程序所調(diào)用庫(kù)文件的路徑(因?yàn)槟J(rèn)的庫(kù)文件路徑/usr/lib64被我改成了/usr/lib64.bk)。于是嘗試:

export LD_LIBRARY_PATH=/usr/lib64.bk
export LD_PRELOAD=/usr/lib64.bk

然后執(zhí)行cp,結(jié)果還是一樣的問(wèn)題。

似乎這兩個(gè)環(huán)境變量只對(duì)應(yīng)用程序有效,對(duì)shell命令不起作用啊。后來(lái)發(fā)現(xiàn),/lib64/ld-linux-x86-64.so.2只是個(gè)軟鏈,真實(shí)文件是/usr/lib64/ld-2.17.so。而ld-2.17.so本身并不是庫(kù)文件,可以把它理解為庫(kù)文件的管理程序,而且它很特別。國(guó)外有個(gè)牛人是這么說(shuō)的:

ld-linux-x86-64.so.2 is a pretty core part of your OS. It actually runs every (64 bit) dynamic application. It's not a library as much as an app itself, a handler that is called when you run an app.

Basically, when you run a dynamic app, the kernel first runs ld-linux.so (or whatever name it is for your bitsize, distro, etc). ld-linux.so then peers into your app, sees the libraries that you need, sees any hard coded paths for the libraries (e.g. rpath's) checks LD_LIBRARY_PATH, and then goes looking for all those libraries, makes sure they match bitsizes, names, what have you. It then collects all of those, loads them, and runs your app. If it can't find the libs, it doesn't run your app.

ld-linux.so can not be affected by LD_LIBRARY_PATH because it is run by the kernel, and the kernel does not load libraries like ld-linux.so does, it just has the one it's configured to run. Again, not a library, so don't use library semantics (LD_LIBRARY_PATH) to change how it's called. It does have environment variables that affect it running - see man ld-linux.so for details.

大意是,ld-linux-x86-64.so.2是操作系統(tǒng)的核心,并不受LD_LIBRARY_PATH環(huán)境變量的影響。如果想改變其調(diào)用方式,請(qǐng)查看man文檔。

 于是乖乖的去看文檔??赡苁沁@個(gè)文檔太老了,在服務(wù)器上怎么man都沒(méi)有,只有網(wǎng)上有:

http://www.man7.org/linux/man-pages/man8/ld.so.8.html

文檔里有這么一段:

 /lib/ld-linux.so.* [OPTIONS] [PROGRAM [ARGUMENTS]]

      --library-path path Use path instead of LD_LIBRARY_PATH environment variable

setting (see below).

貌似ld-2.17.so這個(gè)文件可以當(dāng)命令來(lái)用。于是在服務(wù)器上嘗試執(zhí)行:

/usr/lib64.bk/ld-2.17.so

果不其然,服務(wù)器沒(méi)有再返回那條可惡的錯(cuò)誤提示,取而代之的是,一連串幫助信息:

You have invoked `ld.so', the helper program for shared library executables. This program usually lives in the file `/lib/ld.so', and special directives in executable files using ELF shared libraries tell the system's program loader to load the helper program from this file.  This helper program loads the shared libraries needed by the program executable, prepares the program to run, and runs it.  You may invoke this helper program directly from the command line to load and run an ELF executable file; this is like executing that file itself, but always uses this helper program from the file you specified, instead of the helper program file specified in the executable file you run.  This is mostly of use for maintainers to test new versions of this helper program; chances are you did not intend to run this program.  --list                list all dependencies and how they are resolved  --verify              verify that given object really is a dynamically linked                        object we can handle  --inhibit-cache      Do not use /etc/ld.so.cache  --library-path PATH  use given PATH instead of content of the environment                        variable LD_LIBRARY_PATH  --inhibit-rpath LIST  ignore RUNPATH and RPATH information in object names                        in LIST  --audit LIST          use objects named in LIST as auditor

而這個(gè)-library-path參數(shù),應(yīng)該就是用來(lái)指定自定義庫(kù)文件的路徑。于是嘗試通過(guò)ld-2.17.so來(lái)調(diào)用cp:
/usr/lib64.bk/ld-2.17.so  --library-path /usr/lib64.bk /usr/bin/cp /usr/lib64.bk/ /usr/lib64 -fr
終于成功了!再ls了一下,發(fā)現(xiàn)提示:
Segmentation fault
這應(yīng)該是會(huì)話緩存的問(wèn)題。于是嘗試連接新的ssh,正常;再執(zhí)行其他任意命令,也都正常。問(wèn)題終于解決了!


新聞標(biāo)題:CentOS7/lib64被重命名后的解決
本文鏈接:http://www.dlmjj.cn/article/cddhcig.html