本文为您介绍如何处理 OCP任务报错:sudo: a terminal is required。
适用版本
OceanBase 云平台(OceanBase Cloud Platform,OCP) V2.x,V3.x,V4.x 版本。
问题现象
通过 OCP 升级 OB 集群时遇到报错:sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper: 
问题原因
该问题是因为主机上 /etc/ssh/sshd_config 配置文件中的 PermitTTY 参数为 no。主机使用的是 root 用户+密码的鉴权凭据,但是 OCP 代码中为了统一指令,OCP 使用sudo 执行的指令,OCP 使用 终端设备 TTY 远程建立 SSH 连接,所以在 /etc/ssh/sshd_config 配置文件中的 PermitTTY 这个参数应为 yes。
解决办法
- 将
/etc/ssh/sshd_config配置中的“PermitTTY no”修改为 “PermitTTY yes”。 - 执行如下命令,重启 sshd 服务:
systemctl restart sshd - 重试失败的子任务。