OCP执行步骤Install ocp agent 报错

【 使用环境 】 测试环境
【 Ocp agent安装失败】

【 使用版本 v 4.3.2 】
【问题描述】使用pbd部署集群及OCP完成后,初始化过程中的问题,Install ocp agent 步骤出的问题。
错误提示:

错误码CMP10102
错误信息执行 SSH 命令失败,错误信息:dpkg: warning: 'ldconfig' not found in PATH or not executable dpkg: warning: 'start-stop-daemon' not found in PATH or not executable dpkg: error: 2 expected programs not found in PATH or not executable Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin Unable to install at /usr/share/perl5/Alien/Package/Deb.pm line 97.
错误原因在主机 10.46.128.11 上执行命令 /tmp/d997e146ce2e4c02/install_package.sh 失败,退出码:2,错误信息:dpkg: warning: 'ldconfig' not found in PATH or not executable dpkg: warning: 'start-stop-daemon' not found in PATH or not executable dpkg: error: 2 expected programs not found in PATH or not executable Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin Unable to install at /usr/share/perl5/Alien/Package/Deb.pm line 97.

我已经确认本机环境变量已经添加,

dba@xxx$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

sudo ldconfigsudo start-stop-daemon --help命令也可以正常执行,并且报错信息中的 /tmp/d997e146ce2e4c02/install_package.sh shell脚本可以手动执行成功。

dba@xxx$ bash install_package.sh
	dpkg --no-force-overwrite -i ocp-agent-ce_4.3.2-20241012145836.el7_amd64.deb
Selecting previously unselected package ocp-agent-ce.
(Reading database ... 93682 files and directories currently installed.)
Preparing to unpack ocp-agent-ce_4.3.2-20241012145836.el7_amd64.deb ...
Unpacking ocp-agent-ce (4.3.2-20241012145836.el7) ...
Setting up ocp-agent-ce (4.3.2-20241012145836.el7) ...
Processing triggers for libc-bin (2.31-13+deb11u10) ...

所以目前不知道是哪里有问题报的错 …

部署机系统为 Centos7, 报错的机器系统为 Debian GNU/Linux 11。

3 个赞

ocp 是432吗?麻烦发下ocp-server.log及完整的任务日志

3 个赞
$ ssh dba@'10.192.128.11' 'sudo bash  /tmp/a73a415925994a44/install_package.sh'
	dpkg --no-force-overwrite -i ocp-agent-ce_4.3.2-20241012145836.el7_amd64.deb
Selecting previously unselected package ocp-agent-ce.
(Reading database ... 93658 files and directories currently installed.)
Preparing to unpack ocp-agent-ce_4.3.2-20241012145836.el7_amd64.deb ...
Unpacking ocp-agent-ce (4.3.2-20241012145836.el7) ...
Setting up ocp-agent-ce (4.3.2-20241012145836.el7) ...
Processing triggers for libc-bin (2.31-13+deb11u10) ...
dba@mongodb10-online-cmpri:/home/admin$ ssh dba@'10.192.128.11' 'sudo dpkg --help'
Usage: dpkg [<option>...] <command>

Commands:
...
...
...
Comparison operators for --compare-versions are:
  lt le eq ne ge gt       (treat empty version as earlier than any version);
  lt-nl le-nl ge-nl gt-nl (treat empty version as later than any version);
  < << <= = >= >> >       (only for compatibility with control file syntax).

Use 'apt' or 'aptitude' for user-friendly package management.

尝试了一下远程执行这些命令也没有报错 。

3 个赞

我在平台上把日志下载下来了 ,还有ocp-server的日志,辛苦帮忙看下。
log_task_2.zip (82.8 KB)
ocp-server.log (19.5 MB)

3 个赞

版本号: 4.3.2-20241012145836

2 个赞

root用户的PATH在看下呢?

error: 2 expected programs not found in PATH or not executable Note: root’s PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin

2 个赞
$ ssh dba@'10.192.128.11' 'bash  /tmp/83e4d0b93a2046d7/install_package.sh'
	dpkg --no-force-overwrite -i ocp-agent-ce_4.3.2-20241012145836.el7_amd64.deb
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
dpkg: error: 2 expected programs not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
	find ocp-agent-ce-4.3.2 -type d -exec chmod 755 {} ;
Unable to install at /usr/share/perl5/Alien/Package/Deb.pm line 97.
	rm -rf ocp-agent-ce-4.3.2

这个报错应该是这么产生的。

2 个赞

root@xxx-test1:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/sbin/start-stop-daemon:/usr/sbin/ldconfig

root环境变量也是存在,但是远程执行的时候,看样子是并没有获取到环境变量。

2 个赞

好的,我们尝试复现下这个问题,有进展会尽快回复你

1 个赞

好的,辛苦 ~

1 个赞

将/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin加到/root/.bashrc 试下呢?

vim /root/.bashrc
export PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

source /root/.bashrc

export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/sbin/start-stop-daemon:/usr/sbin/ldconfig
export PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
root@cm-test1:~# cat .bashrc

刚刚也source过了,还是报同样的错。

debian12上没有复现出来这个问题,由于没有debian11的环境,不过看这个问题大概率是环境的问题,应该还需要从环境继续排查下

嗯, 我今天又重新下载 ocp-all-in-one的包,重新来了一遍,还是卡在那里,很奇怪。 :melting_face:

我尝试了几种方式来跳过这个问题

  1. 使用 sudo执行脚本 (可以执行成功)
$ ssh dba@'10.192.128.11' 'sudo bash /tmp/50449c85fbea4d65/install_package.sh'
	dpkg --no-force-overwrite -i ocp-agent-ce_4.3.2-20241012145836.el7_amd64.deb
Selecting previously unselected package ocp-agent-ce.
(Reading database ... 93658 files and directories currently installed.)
Preparing to unpack ocp-agent-ce_4.3.2-20241012145836.el7_amd64.deb ...
Unpacking ocp-agent-ce (4.3.2-20241012145836.el7) ...
  1. 尝试在root用户 /etc/frofile,~/.bashrc.~/.profile 添加环境变量(不能执行成功)
    export PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin;
  2. 尝试添加环境变量执行脚本 (可以执行成功)
    $ ssh dba@'10.192.128.11' 'export PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin; bash /tmp/50449c85fbea4d65/install_package.sh'
  3. 修改脚本install_package.sh 添加环境变量 (可以执行成功)
    export PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

但是我在部署机器并没有找到脚本的原始位置,并且每次重试部署,目录会随机再生成一遍,并且我看脚本内容都是 echo进去的? 所以我有没有其他办法可以通过以上方式跳过这个问题继续部署 ?

您好,我暂时找到了一种笨方法可以跳过这个错误,就是在 /usr/local/bin/dpkg 重新编辑一下这个命令:

$ cat /usr/local/bin/dpkg
#!/bin/bash
export PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
/usr/bin/dpkg "$@"

虽然我这个是个例的情况,咱们看看是否后续可以直接把获取环境变量的动作放到脚本里,这样针对debian11 这种情况,可能会更合理一些。
感谢您的细心帮助 :handshake:

你有其它debian11 的环境可以复现这个问题吗?我后面也再继续看下

嗯 这两天我还会尝试云主机安装一下,也是debian11的,如果复现了,我再在这个帖子下留言。