本文为您介绍安装 OCP Agent 时报错curl 命令 return code:23的处理方法。
适用版本
OceanBase 云平台(OceanBase Cloud Platform,OCP) V2.x,V3.x,V4.x 版本。
问题现象
OCP白屏界面中 Install ocp agent 的子任务报错:
2023-03-02 19:50:08.833 ERROR 53 --- [pool-manual-subtask-executor25,bf852d1fe8904335,382b4d14b2ba] c.o.ocp.executor.executor.SshExecutor : failed to execute ssh command, errMsg:command failed, args:curl -s -k -o /tmp/t-oceanbase-ocp-agent-3.3.4-20221202162504.alios7.x86_64.rpm "http://xxx.xxx.xxx.xxx:8080/api/v2/files/sys-package/t-oceanbase-ocp-agent-3.3.4-20221202162504.alios7.x86_64.rpm", return code:23, output:, extOut:. cause:null2023-03-02 19:50:08.835 INFO 53 --- [pool-manual-subtask-executor25,bf852d1fe8904335,382b4d14b2ba] c.a.o.c.m.t.model.SubtaskInstanceEntity : Set state for subtask: 1149, current state: RUNNING, new state: FAILED2023-03-02 19:50:08.838 WARN 53 --- [pool-manual-subtask-executor25,bf852d1fe8904335,382b4d14b2ba] c.a.o.c.t.engine.runner.RunnerFactory : Execute task failed, subtask=SubtaskInstanceEntity{id=1149, name=Install ocp agent, state=FAILED, operation=EXECUTE, className=com.alipay.ocp.service.task.business.host.InstallOcpAgentTask, seriesId=14, startTime=2023-03-02T19:50:07.605+08:00, endTime=2023-03-02T19:50:08.837+08:00}com.oceanbase.ocp.executor.exception.SshCommandFailedException: failed to execute ssh command, errMsg:command failed, args:curl -s -k -o /tmp/t-oceanbase-ocp-agent-3.3.4-20221202162504.alios7.x86_64.rpm "http://xxx.xxx.xxx.xxx:8080/api/v2/files/sys-package/t-oceanbase-ocp-agent-3.3.4-20221202162504.alios7.x86_64.rpm", return code:23, output:, extOut:. cause:null
问题原因
报错的根因是因为 OCP 使用 curl 命令去保存t-oceanbase-ocp-agent-xxx.rpm软件包到本地的/tmp/目录下的时候返回码为 23(23 Write error. Curl couldn't write data to a local filesystem or similar.),而在/tmp/目录下面已经存在了一个残留的t-oceanbase-ocp-agent-xxx.rpm软件包了,并且属主为root,导致 rpm 文件保存失败: [admin@localhost /tmp]$ ls -altr -rw-r--r-- 1 root root 33446996 Mar 1 14:25 t-oceanbase-ocp-agent-3.3.4-20221202162504.alios7.x86_64.rpm
解决方法
手工删除掉之前残留的 t-oceanbase-ocp-agent-xxx.rpm,或者将该软件包的属主改为admin:admin,然后重试失败的步骤。