![使用 Ansible 管理 FreeBSD 主机失败:未找到共享对象 \“libdl.so.1\”,该对象由 \“python\”\r\n 所需](https://linux22.com/image/1557212/%E4%BD%BF%E7%94%A8%20Ansible%20%E7%AE%A1%E7%90%86%20FreeBSD%20%E4%B8%BB%E6%9C%BA%E5%A4%B1%E8%B4%A5%EF%BC%9A%E6%9C%AA%E6%89%BE%E5%88%B0%E5%85%B1%E4%BA%AB%E5%AF%B9%E8%B1%A1%20%5C%E2%80%9Clibdl.so.1%5C%E2%80%9D%EF%BC%8C%E8%AF%A5%E5%AF%B9%E8%B1%A1%E7%94%B1%20%5C%E2%80%9Cpython%5C%E2%80%9D%5Cr%5Cn%20%E6%89%80%E9%9C%80.png)
Raspberry pi 3 上的 FreeBSD 管理(来自 RaspBSD 项目的 FreeBSD-aarch64-12.0-GENERIC-320146M -http://www.raspbsd.org/)失败。
控制主机是MacOS 10.13.2。
python 已成功安装在托管主机上(rpi3_freebsd):
$ ansible -m raw -a "sudo pkg install -y python27" --user drew --ask-pass rpi3_freebsd
SSH password:
rpi | SUCCESS | rc=0 >>
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The most recent version of packages are already installed
但是,当我尝试运行剧本时,ansible 返回以下错误:
$ ansible-playbook --user drew --ask-pass bootstrap.yml -vvvv
ansible-playbook 2.4.3.0
config file = /Users/drew/SynologyDrive/rpi-scripts/ansible/ansible.cfg
configured module search path = [u'/Users/drew/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/2.4.3.0/libexec/lib/python2.7/site-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 2.7.10 (default, Jul 15 2017, 17:16:57) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
Using /Users/drew/SynologyDrive/rpi-scripts/ansible/ansible.cfg as config file
SSH password:
setting up inventory plugins
Parsed /Users/drew/SynologyDrive/rpi-scripts/ansible/hosts inventory source with ini plugin
Loading callback plugin skippy of type stdout, v2.0 from /usr/local/Cellar/ansible/2.4.3.0/libexec/lib/python2.7/site-packages/ansible/plugins/callback/skippy.pyc
PLAYBOOK: bootstrap.yml ******************************************************************************************************************
1 plays in bootstrap.yml
PLAY [raspberrypi_3] *********************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************************
Using module file /usr/local/Cellar/ansible/2.4.3.0/libexec/lib/python2.7/site-packages/ansible/modules/system/setup.py
<172.16.42.6> ESTABLISH CONNECTION FOR USER: drew on PORT 22 TO 172.16.42.6
<172.16.42.6> EXEC /bin/sh -c 'echo ~ && sleep 0'
<172.16.42.6> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/drew/.ansible/tmp/ansible-tmp-1522353818.07-1230475463058 `" && echo ansible-tmp-1522353818.07-1230475463058="` echo /home/drew/.ansible/tmp/ansible-tmp-1522353818.07-1230475463058 `" ) && sleep 0'
<172.16.42.6> PUT /var/folders/2c/m_z3y5gs3fz1m2b2lwzk7yl80000gn/T/tmpgWCvx_ TO /home/drew/.ansible/tmp/ansible-tmp-1522353818.07-1230475463058/setup.py
<172.16.42.6> EXEC /bin/sh -c 'chmod u+x /home/drew/.ansible/tmp/ansible-tmp-1522353818.07-1230475463058/ /home/drew/.ansible/tmp/ansible-tmp-1522353818.07-1230475463058/setup.py && sleep 0'
<172.16.42.6> EXEC /bin/sh -c '/usr/local/bin/python /home/drew/.ansible/tmp/ansible-tmp-1522353818.07-1230475463058/setup.py; rm -rf "/home/drew/.ansible/tmp/ansible-tmp-1522353818.07-1230475463058/" > /dev/null 2>&1 && sleep 0'
fatal: [rpi]: FAILED! => {
"changed": false,
"module_stderr": "",
"module_stdout": "Shared object \"libdl.so.1\" not found, required by \"python\"\r\n",
"msg": "MODULE FAILURE",
"rc": 0
}
to retry, use: --limit @/Users/drew/SynologyDrive/rpi-scripts/ansible/bootstrap.retry
PLAY RECAP *******************************************************************************************************************************
rpi : ok=0 changed=0 unreachable=0 failed=1
ansible 的唯一依赖项是 python,它已得到满足。
哪里出了问题?我该如何修复?
谢谢。
答案1
通过创建链接修复了 bash 和 wget 中缺少依赖项的类似问题
ln -sf /lib/libc.so.7 /usr/lib/libdl.so.1
答案2
我在从 FreeBSD 11.1 过渡到 11.2 时遇到了类似的问题,但gnutls
报告的问题是由于缺少libdl.so.1
。
我的解决方案源自于我在以下网址找到的一个提示:
首先备份/etc/pkg/FreeBSD.conf
:
# cp -vp /etc/pkg/FreeBSD.conf /etc/pkg/FreeBSD.conf.safety
然后编辑/etc/pkg/FreeBSD.conf
并将该url:
行更改为:
url: "pkg+http://pkg.FreeBSD.org/${ABI}/release_2",
保存文件并退出 vi。
# pkg update
# pkg install -f python27
现在再次尝试你的 ansible playbook。
如果这对您有用,并且您最近升级了其他端口,您可能需要对它们进行粗略的调用,以确保它们没有类似的问题。
我不是专家,但我希望一旦你将操作系统升级到较新的版本,这个问题就会消失。就我而言,我相信问题出现的原因是 pkg repo 提供了链接到 11.2 的软件包,该软件包具有 libdl.so.1,而我将它们安装到仍为 11.1 版本的 jail 中,而该 jail 中没有 libdl.so.1。
一旦升级到最新版本,您应该恢复/etc/pkg/FreeBSD.conf
到您制作的备份副本,并继续跟踪最新的 pkg 仓库。