NHỮNG CÂU HỎI THƯỜNG GẶP VỀ LINUX - Trang 70

Những câu hỏi thường gặp về Linux

Paul Campbell

H: programname:

error in loading shared libraries: lib

xxx.

.so.

x

: cannot open shared object file: No such file or directory.

Đ:

A message like this, when the program that you’re trying to run uses shared libraries, usually means

one of two things: the program was either compiled on a machine that had a different set of libraries or
library paths than yours; or you’ve upgraded your libraries but not the program.

Executable programs that are linked with dynamic libraries, expect the full pathname of each of the
library files it requires. So do the shared libraries, if they rely on other libraries. This is so the shared
object dependencies remain as unambiguous as possible, và also as a security measure.

Short of recompiling the executable file for the libraries on the systemprobably the most desirable
alternative in the long run - you can try to determine which libraries the executable file needs with the
command: “

ldd

programname

.” The output will be a list of the shared libraries on the system that the

program needs to run, as well as the missing libraries. You can then add the library packages, or if the
libraries already exist in a different directory, you can create a symbolic link so the program can find it.
For example, if the program requires /usr/lib/libncurses.so.2, và your machine has /lib/libncurses.so.2,
you can create a link where the program expects to find the library; v.d.:

# cd /usr/lib && ln -s /lib/libncurses.so.2 .

You should note, however, that creating library links like these should be considered a security risk, và
the additional links you create will not be compatible with future upgrades. It’s simply a quick fix for
backward compatibility.

Also, it may take some guesswork to determine in exactly which of the system library directories the
program expects to find a shared library file, because

ldd

will not list the paths of libraries it can’t find.

A program most likely will tell the run-time linker,

/lib/ld.so

, to look for shared libraries in

/lib

,

[/usr/lib], [/usr/local/lib], or [/usr/X11R6/lib], if it’s an X client. But that doesn’t mean that libraries can’t
be installed elsewhere. It helps to have some idea of the original library configuration before proceeding.

Also be sure to run

ldconfig

after creating the symbolic link, so that

ld.so

has an updated view of

the system’s libraries. You should also make certain that all of the library directories are listed in
[/etc/ld.so.conf], và perhaps in the

LD_LIBRARY_PATH

environment variable.

H:

init: Id "x" respawning too fast: disabled for 5 minutes

.”

Đ:

However, “

Id

” can also indicate the absence or misconfiguration of another program, like mingetty,

if init tries to respawn itself more than 10 times in 2 minutes.

Id “x” is the number in the leftmost column of the [/etc/inittab] file:

# Run gettys in standard runlevels

1:2345:respawn:/sbin/mingetty tty1

2:2345:respawn:/sbin/mingetty tty2

3:2345:respawn:/sbin/mingetty tty3

69

Liên Kết Chia Sẽ

** Đây là liên kết chia sẻ bới cộng đồng người dùng, chúng tôi không chịu trách nhiệm gì về nội dung của các thông tin này. Nếu có liên kết nào không phù hợp xin hãy báo cho admin.