`
itspace
  • 浏览: 981500 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

sudo安装错误/usr/bin/ld: cannot find -lpam

阅读更多
centos 5.1版本为
引用
[root@rztest sudo-1.7.2p6]# uname -a
Linux rztest 2.6.18-53.el5 #1 SMP Mon Nov 12 02:22:48 EST 2007 i686 i686 i386 GNU/Linux


sudo编译包版本为sudo-1.7.2p6
报如下错误
引用
#make install
...
gcc -c -I. -I.  -O2 -D_GNU_SOURCE -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440  ./closefrom.c
gcc -o sudo gram.o alias.o alloc.o defaults.o error.o list.o match.o toke.o redblack.o zero_bytes.o  sudo_auth.o passwd.o  audit.o check.o env.o getspwuid.o gettime.o goodpath.o fileops.o find_path.o interfaces.o lbuf.o logging.o parse.o pwutil.o set_perms.o sudo.o sudo_edit.o sudo_nss.o term.o tgetpass.o strlcpy.o strlcat.o closefrom.o  -lpam -ldl -lcrypt    
/usr/bin/ld: cannot find -lpam
collect2: ld returned 1 exit status
make: *** [sudo] Error 1


同时比较make正确时的日志:
引用
gcc -c -I. -I.  -O2 -D_GNU_SOURCE -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440  ./closefrom.c
gcc -o sudo gram.o alias.o alloc.o defaults.o error.o list.o match.o toke.o redblack.o zero_bytes.o  sudo_auth.o pam.o  audit.o check.o env.o getspwuid.o gettime.o goodpath.o fileops.o find_path.o interfaces.o lbuf.o logging.o parse.o pwutil.o set_perms.o sudo.o sudo_edit.o sudo_nss.o term.o tgetpass.o strlcpy.o strlcat.o closefrom.o  -lpam -ldl   
gcc -c -I. -I.  -O2 -D_GNU_SOURCE -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440  ./visudo.c
gcc -o visudo gram.o alias.o alloc.o defaults.o error.o list.o match.o toke.o redblack.o zero_bytes.o  visudo.o fileops.o gettime.o goodpath.o find_path.o pwutil.o strlcpy.o strlcat.o closefrom.o  
/bin/sh ./libtool --mode=compile gcc -c -I. -I.  -O2 -D_GNU_SOURCE -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440  ./sudo_noexec.c
mkdir .libs
gcc -c -I. -I. -O2 -D_GNU_SOURCE -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440 ./sudo_noexec.c  -fPIC -DPIC -o .libs/sudo_noexec.o
/bin/sh ./libtool --mode=link gcc  -o sudo_noexec.la sudo_noexec.lo -avoid-version -rpath /usr/local/libexec
gcc -shared  .libs/sudo_noexec.o   -Wl,-soname -Wl,sudo_noexec.so -o .libs/sudo_noexec.so
creating sudo_noexec.la
(cd .libs && rm -f sudo_noexec.la && ln -s ../sudo_noexec.la sudo_noexec.la)


其中/usr/bin/ld: cannot find -lpam引起了我的注意,根据经验系统中很可能少包,网上搜索也没有很好的解决方法。
进一步比较两者之间的configure日志
引用
checking for main in -ldl... yes
checking security/pam_appl.h usability... no
checking security/pam_appl.h presence... no
checking for security/pam_appl.h... no
checking pam/pam_appl.h usability... no
checking pam/pam_appl.h presence... no
checking for pam/pam_appl.h... no
checking for library containing crypt... -lcrypt
checking for getspnam... yes
checking for log file location... /var/log/sudo.log
checking for timestamp file location... /var/run/sudo
configure: using the following authentication methods: passwd
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sudo.man
config.status: creating visudo.man
config.status: creating sudoers.man
config.status: creating sudoers.ldap.man
config.status: creating sudo_usage.h
config.status: creating config.h
config.status: creating pathnames.h

从以上可以看出利用 passwd验证,而make正确得系统采用pam认证。
引用
checking for main in -ldl... yes
checking security/pam_appl.h usability... yes
checking security/pam_appl.h presence... yes
checking for security/pam_appl.h... yes
checking whether to use PAM session support... yes
checking for log file location... /var/log/sudo.log
checking for timestamp file location... /var/run/sudo
configure: using the following authentication methods: pam
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sudo.man
config.status: creating visudo.man
config.status: creating sudoers.man
config.status: creating sudoers.ldap.man
config.status: creating sudo_usage.h
config.status: creating config.h
config.status: creating pathnames.h
configure: You will need to customize sample.pam and install it as /etc/pam.d/sudo

到这里,可以比较明显的看出系统很可能缺少pam包,比较系统间的rpm包,可以明显看到,能正确安装的系统多出了pam-devel-0.99.6.2-3.26.el5。
引用
[root@mcprod ~/sudo-1.7.2p6]# rpm -qa | grep pam
pam_smb-1.1.7-7.2.1
pam_passwdqc-1.0.2-1.2.2
pam-0.99.6.2-3.26.el5
spamassassin-3.1.9-1.el5
pam_ccreds-3-5
pam_pkcs11-0.5.3-23
pam-devel-0.99.6.2-3.26.el5
pam_krb5-2.2.14-1


引用
[root@rztest sudo-1.7.2p6]# rpm -qa|grep pam
pam_smb-1.1.7-7.2.1
pam_krb5-2.2.14-1
pam_passwdqc-1.0.2-1.2.2
pam-0.99.6.2-3.26.el5
spamassassin-3.1.9-1.el5
pam_pkcs11-0.5.3-23
pam_ccreds-3-5


安装pam-devel rpm包
引用
[root@rztest sudo-1.7.2p6]# yum install pam-devel
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for pam-devel to pack into transaction set.
pam-devel-0.99.6.2-6.el5_ 100% |=========================|  60 kB    00:00    
---> Package pam-devel.i386 0:0.99.6.2-6.el5_4.1 set to be updated
--> Running transaction check
--> Processing Dependency: pam = 0.99.6.2-6.el5_4.1 for package: pam-devel
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for pam to pack into transaction set.
pam-0.99.6.2-6.el5_4.1.i3 100% |=========================|  87 kB    00:01    
---> Package pam.i386 0:0.99.6.2-6.el5_4.1 set to be updated
--> Running transaction check
--> Processing Dependency: audit-libs >= 1.6.5 for package: pam
--> Processing Dependency: glibc > 2.5-19 for package: pam
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for audit-libs to pack into transaction set.
audit-libs-1.7.13-2.el5.i 100% |=========================|  16 kB    00:01    
---> Package audit-libs.i386 0:1.7.13-2.el5 set to be updated
---> Downloading header for glibc to pack into transaction set.
glibc-2.5-42.el5_4.3.i686 100% |=========================| 150 kB    00:09    
---> Package glibc.i686 0:2.5-42.el5_4.3 set to be updated
--> Running transaction check
--> Processing Dependency: glibc = 2.5-18 for package: glibc-headers
--> Processing Dependency: audit-libs = 1.5.5-7.el5 for package: audit
--> Processing Dependency: audit-libs = 1.5.5-7.el5 for package: audit-libs-python
--> Processing Dependency: glibc-common = 2.5-42.el5_4.3 for package: glibc
--> Processing Dependency: glibc = 2.5-18 for package: glibc-devel
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for glibc-headers to pack into transaction set.
glibc-headers-2.5-42.el5_ 100% |=========================| 148 kB    00:04    
---> Package glibc-headers.i386 0:2.5-42.el5_4.3 set to be updated
---> Downloading header for audit to pack into transaction set.
audit-1.7.13-2.el5.i386.r 100% |=========================|  21 kB    00:01    
---> Package audit.i386 0:1.7.13-2.el5 set to be updated
---> Downloading header for glibc-devel to pack into transaction set.
glibc-devel-2.5-42.el5_4. 100% |=========================| 115 kB    00:01    
---> Package glibc-devel.i386 0:2.5-42.el5_4.3 set to be updated
---> Downloading header for audit-libs-python to pack into transaction set.
audit-libs-python-1.7.13- 100% |=========================|  15 kB    00:00    
---> Package audit-libs-python.i386 0:1.7.13-2.el5 set to be updated
---> Downloading header for glibc-common to pack into transaction set.
glibc-common-2.5-42.el5_4 100% |=========================| 729 kB    08:58    
---> Package glibc-common.i386 0:2.5-42.el5_4.3 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
pam-devel               i386       0.99.6.2-6.el5_4.1  updates           187 k
Updating for dependencies:
audit                   i386       1.7.13-2.el5     base              379 k
audit-libs              i386       1.7.13-2.el5     base               80 k
audit-libs-python       i386       1.7.13-2.el5     base               78 k
glibc                   i686       2.5-42.el5_4.3   updates           5.2 M
glibc-common            i386       2.5-42.el5_4.3   updates            16 M
glibc-devel             i386       2.5-42.el5_4.3   updates           2.0 M
glibc-headers           i386       2.5-42.el5_4.3   updates           601 k
pam                     i386       0.99.6.2-6.el5_4.1  updates           976 k

Transaction Summary
=============================================================================
Install      1 Package(s)        
Update       8 Package(s)        
Remove       0 Package(s)        

Total download size: 26 M
Is this ok [y/N]: y
Downloading Packages:
(1/9): glibc-2.5-42.el5_4 100% |=========================| 5.2 MB    00:29    
(2/9): glibc-headers-2.5- 100% |=========================| 601 kB    00:03    
(3/9): audit-1.7.13-2.el5 100% |=========================| 379 kB    01:02    
(4/9): glibc-devel-2.5-42 100% |=========================| 2.0 MB    00:11    
(5/9): audit-libs-python- 100% |=========================|  78 kB    00:03    
(6/9): glibc-common-2.5-4 100% |=========================|  16 MB    01:24    
(7/9): audit-libs-1.7.13- 100% |=========================|  80 kB    00:03    
(8/9): pam-devel-0.99.6.2 100% |=========================| 187 kB    00:02    
(9/9): pam-0.99.6.2-6.el5 100% |=========================| 976 kB    00:04    
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating  : glibc-common                 ####################### [ 1/17]
  Updating  : glibc                        ####################### [ 2/17]
  Updating  : audit-libs                   ####################### [ 3/17]
  Updating  : pam                                                  [ 4/17]warning: /etc/pam.d/system-auth created as /etc/pam.d/system-auth.rpmnew
  Updating  : pam                          ####################### [ 4/17]
  Updating  : glibc-headers                ####################### [ 5/17]
  Updating  : audit                        ####################### [ 6/17]
  Updating  : glibc-devel                  ####################### [ 7/17]
  Updating  : audit-libs-python            ####################### [ 8/17]
  Installing: pam-devel                    ####################### [ 9/17]
  Cleanup   : glibc                        ####################### [10/17]
  Cleanup   : glibc-headers                ####################### [11/17]
  Cleanup   : audit                        ####################### [12/17]
  Cleanup   : glibc-devel                  ####################### [13/17]
  Cleanup   : audit-libs-python            ####################### [14/17]
  Cleanup   : glibc-common                 ####################### [15/17]
  Cleanup   : audit-libs                   ####################### [16/17]
  Cleanup   : pam                          ####################### [17/17]

Installed: pam-devel.i386 0:0.99.6.2-6.el5_4.1
Dependency Updated: audit.i386 0:1.7.13-2.el5 audit-libs.i386 0:1.7.13-2.el5 audit-libs-python.i386 0:1.7.13-2.el5 glibc.i686 0:2.5-42.el5_4.3 glibc-common.i386 0:2.5-42.el5_4.3 glibc-devel.i386 0:2.5-42.el5_4.3 glibc-headers.i386 0:2.5-42.el5_4.3 pam.i386 0:0.99.6.2-6.el5_4.1
Complete!


附:
插入式验证模块(Pluggable Authentication Module,PAM)API 将公开一组功能,应用程序程序员可以使用这些功能来实现与安全性相关的功能,例如用户验证、数据加密、LDAP 等。
哪些操作系统支持 PAM?
PAM 最初是由 Sun Microsystems 于 1995 年开发的,并且以下操作系统版本(及更高版本)都提供支持:

    * RedHat 5.0
    * SUSE 6.2
    * Debian 2.2
    * Mandrake 5.2
    * Caldera 1.3
    * TurboLinux 3.6

详见http://www.ibm.com/developerworks/cn/linux/l-pam/index.html






分享到:
评论

相关推荐

    解决 cannot find -lxxx 的问题

    /usr/bin/ld: cannot find -lxxx ``` 其中 `-lxxx` 表示链接器未能找到名为 `xxx` 的库。这些库通常是动态链接库 `.so` 文件,例如: - `/usr/bin/ld: cannot find -lc` - `/usr/bin/ld: cannot find -lltdl` - `/...

    centos安装jdk1.8时出现没有/lib/ld-linux.so.2:这个文件的原因分析

    -bash: /usr/local/jdk/jdk1.8.0_181/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory 安装完后 java -version 查看版本出现: 原因是:没有那个文件或目录,找了很久发现需要...

    arm-linux-gnueabi-5.4.0.tar

    /usr/local/arm/5.4.0/usr/bin/../libexec/gcc/arm-none-linux-gnueabi/5.4.0/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory 解决方法: ...

    Ubuntu环境QT问题 /usr/bin/ld: 找不到 -lGL(已解决)

    安装完qt之后,构建项目就会出现:/usr/bin/ld: 找不到 -lGL 因为缺少了libGL环境,此时更新libGL环境 执行此命令sudo apt-get install libgl1-mesa-dev 执行完命令会提示错误,说依赖关系被破坏 因为是源有问题,...

    linux输入yum后提示: -bash: /usr/bin/yum: No such file or directory的解决方法

    如果出现“-bash: /usr/bin/yum: No such file or directory”的错误提示,这意味着系统找不到`yum`命令的执行路径,这通常是由于以下原因: 1. **yum命令未安装**:最直接的原因是`yum`这个包本身没有被正确地安装...

    mac下/usr/local/bin No such file or directory问题解决

    在对composer进行全局配置时,执行 sudo mv composer.phar /usr/local/bin/composer 时,mac报错:/usr/local/bin No such file or directory 。 分析原因,在finder中command+shift+G进入目录,确实也找不到 /usr/...

    qt_uImage_root_GUI.zip

    修改:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/4.3.2/bin" 改为:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/work/...

    使用docker的x86环境模拟 arrch环境

    sudo cp qemu-aarch64-static /usr/bin/ chmod +x /usr/bin/qemu-aarch64-static 3:注册 docker run --rm --privileged multiarch/qemu-user-static:register --reset 4:测试 docker run --rm -t -v /usr/bin/qemu...

    视觉slam十四讲中第十一章libopencv_core问题:

    ss/usr/bin/ld: warning: libopencv_core3.so.3.3, needed by /usr/local/lib/lib 搜寻了好久大致有以下几种解决方案: 1.把该文件所在的目录放到linux动态库链接文件中: sudo gedit /etc/ld.so.conf 输入路径...

    经典的编译器gcc2.95.3安装文件(已编译)

    编译旧内核要用的老...sudo mv /usr/bin/cpp /usr/bin/cpp-bak sudo mv /usr/bin/gcc /usr/bin/gcc-bak sudo ln -s /usr/local/gcc-2.95/bin/gcc /usr/bin/gcc sudo ln -s /usr/local/gcc-2.95/bin/cpp /usr/bin/cpp

    64位linux 编译c提示gnu/stubs-32.h:No such file or directory的解决方法

    这些错误都是由于缺少32位兼容包导致的,可以通过安装相应的包来解决。 需要注意的是,在编译C语言程序时,需要注意头文件的引用关系。例如,conf_init.c文件引用../include/MyTypes.h头文件,而这个头文件又引用/...

    libpaho-mqtt3as.so.zip

    v2x@ubuntu:~/Desktop$ sudo cp ./libpaho-mqtt3as.so/libpaho-mqtt3as.so /usr/lib/ v2x@ubuntu:~/Desktop$ sudo cp ./libpaho-mqtt3as.so/libpaho-mqtt3as.so.1 /usr/lib/ v2x@ubuntu:~/Desktop$ sudo cp ./...

    cuda报错 OSError: libcudart.so.10.0: cannot open shared object file: No such file

    有时候会碰到cuda报错,OSError: libcudart.so.10.0: cannot open shared object file: No such file 原因是cuda动态链接库没有链接上。 解决方法如下: cuda10.0: sudo ldconfig /usr/local/cuda-10.0/lib64 cuda...

    ubuntu 工具源码和安装说明-2

    sudo cp -rf /usr/local/ncurses/bin /usr/bin sudo cp -rf /usr/local/ncurses/lib /usr/lib tar xf vim_7.3.547.orig.tar.gz mv vim-7.3.547/ vim cd vim ./configure --prefix=/usr/local/vim make sudo ...

    ubuntu 工具源码和安装说明

    sudo cp -rf /usr/local/ncurses/bin /usr/bin sudo cp -rf /usr/local/ncurses/lib /usr/lib tar xf vim_7.3.547.orig.tar.gz mv vim-7.3.547/ vim cd vim ./configure --prefix=/usr/local/vim make sudo make ...

    youtube-dl 是一个命令行程序,用于下载视频 它需要 Python 解释器2.6、2.7 或 3.2+

    sudo chmod a+rx /usr/local/bin/youtube-dl 如果你没有 curl,你可以使用最近的 wget: sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl sudo chmod a+rx /usr/local/bin/...

    CentOS7_nvidia-docker2安装.rar

    sudo systemctl daemon-reload 依次执行此命令,如果 事先安装了containerd.io 则需要先进行 rpm -qa | grep containerd.io查询,然后再rpm -e XX进行卸载,如果 运行nvidia-docker之后 还出现 /usr/bin/nvidia-...

    docker-compose-linux-x86-64 版本v2.29.1

    源地址: ...使用方法: 将文件修改名称为:docker-compose 并放置在目录:/usr/local/bin/ 下 ...sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose # 验证安装 docker-compose --version

    ubuntu中部署tomcat

    - `sudo tar -zxvf /usr/shopxx/tomcat6.0/bin/commons-daemon-native.tar.gz -C /usr/shopxx/tomcat6.0` - 进入编译目录: - `cd /usr/shopxx/tomcat6.0/commons-daemon-1.0.15-native-src/unix` - 配置编译参数: ...

    ubuntu安装gcc源码过程中报错情况记录

    在编译GCC时,如果遇到“/usr/bin/ld: cannot find -lz”的错误,意味着系统中缺少了LZ库的支持。LZ库是压缩和解压缩功能的重要组成部分,在GCC编译过程中起着不可或缺的作用。为了解决这个问题,可以通过以下步骤...

Global site tag (gtag.js) - Google Analytics