---
title: 通过 OCP Web 创建 OceanBase 数据库集群时【路径设置】检测失败的原因和解决方法-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于通过 OCP Web 创建 OceanBase 数据库集群时【路径设置】检测失败的原因和解决方法相关的常见问题和使用技巧，帮助您快速解决通过 OCP Web 创建 OceanBase 数据库集群时【路径设置】检测失败的原因和解决方法的难题。
image: https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*OSPzQ6GUQF4AAAAAQHAAAAgAeiGDAQ/original
---
[OceanBase AI 数据大会](https://www.oceanbase.com/conference2026 "OceanBase AI 数据大会")

## 体验新一代 AI 数据平台

[立即咨询](https://www.oceanbase.com/contactus) [免费试用 免费试用](https://www.oceanbase.com/free-trial)划线反馈

# 通过 OCP Web 创建 OceanBase 数据库集群时【路径设置】检测失败的原因和解决方法

更新时间：2026-07-24 10:01

适用版本： V1.x、V2.x、V3.x、V4.x 内容类型：Troubleshoot  

## 问题现象

将操作系统为 `Ubuntu 22.04 LTS` 的主机添加到 OCP 主机列表（添加主机时使用的凭据类型为：普通用户 test + 该用户的 sudo 免密登陆），添加主机时没有遇到任何报错，但是使用该主机来创建 OceanBase 数据库集群时，在【路径设置】的窗口遇到了报错：**检测失败，请检查 OCP Agent 服务是否正常**。相关路径的 `owner:group` 都已经修改为 `admin:admin` 了。

![image](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/OCP/20250722path-setting-detection-failed-when-creating-ob-cluster-through-ocp-web.png)

## 问题原因

通过分析 `/home/admin/ocp_agent/log/` 路径下的 OCP Agent 相关日志后发现，在 `mgragent.log` 中，报错时间点附近存在如下日志信息。

```shell
2025-06-16T19:57:53.07956+08:00 INFO [94685,8d767562acd9c76a] caller=common/middleware.go:152:func1: API response OK: [POST /api/v1/file/checkDirectoryPermission, client=172.20.xx.xxx, ocpServerIp=172.20.xx.xxx, traceId=8d767562acd9c76a, duration=6.70846ms, status=200, data=CHECK_FAILED]
2025-06-16T19:57:53.10604+08:00 INFO [94685,1281859c7071e0ef] caller=common/middleware.go:60:func1: API request: [POST /api/v1/file/checkDirectoryPermission, client=172.20.xx.xxx, ocpServerIp=172.20.xx.xxx, traceId=1281859c7071e0ef, body={"directory":"/home/admin","user":"admin","permission":"ACCESS_EXECUTE","onlyExistingAncestor":true}]
2025-06-16T19:57:53.10619+08:00 INFO [94685,1281859c7071e0ef] caller=shell/exec.go:124:execute: execute shell command start, command=Command{user=admin, program=sh, outputType=std, cmd=if [ -"x" "/home/admin" ]; then echo 0; else echo 1; fi, timeout=10s} fields:, duration="20.899µs"
2025-06-16T19:57:53.10622+08:00 INFO [94685,] caller=shell/exec.go:128:execute: c.user=admin, currentUser=root
2025-06-16T19:57:53.11308+08:00 INFO [94685,1281859c7071e0ef] caller=shell/exec.go:163:execute: execute shell command failed, command=Command{user=admin, program=sh, outputType=std, cmd=if [ -"x" "/home/admin" ]; then echo 0; else echo 1; fi, timeout=10s}, exitCode=1, error=root is not in the sudoers file.  This incident will be reported.
: exit status 1 fields:, duration=6.910099ms
2025-06-16T19:57:53.11314+08:00 INFO [94685,1281859c7071e0ef] caller=file/file.go:255:CheckDirectoryPermission: check directory permission failed, cannot check directory permission fields: directory=/home/admin, user=admin, permissionType=ACCESS_EXECUTE, error="failed to execute command: Command{user=admin, program=sh, outputType=std, cmd=if [ -\"x\" \"/home/admin\" ]; then echo 0; else echo 1; fi, timeout=10s}, exitCode: 1, output: , error: root is not in the sudoers file.  This incident will be reported.\n: exit status 1"
2025-06-16T19:57:53.11319+08:00 INFO [94685,1281859c7071e0ef] caller=common/middleware.go:152:func1: API response OK: [POST /api/v1/file/checkDirectoryPermission, client=172.20.xx.xxx, ocpServerIp=172.20.xx.xxx, traceId=1281859c7071e0ef, duration=7.057125ms, status=200, data=CHECK_FAILED]

```

其中关键报错信息为：**root is not in the sudoers file. This incident will be reported.**

目前 OCP Agent 相关的进程在 OBServer 主机上都是以 `<root>` 用户的身份运行的。

```shell
root@observer:/home/admin/ocp_agent/log# ps -ef | grep agent | grep -v grep
root       36824       1  0 21:25 ?        00:00:01 /home/admin/ocp_agent/bin/ocp_agentd -c /home/admin/ocp_agent/conf/agentd.yaml
root       36844   36824  3 21:25 ?        00:02:32 /home/admin/ocp_agent/bin/ocp_mgragent
root       36845   36824  8 21:25 ?        00:06:07 /home/admin/ocp_agent/bin/ocp_monagent
root@observer:/home/admin/ocp_agent/log#

```

在该主机上用 `<root>` 用户的身份 + sudo 执行命令。

```shell
root@observer:/home/admin/ocp_agent/log# sudo -s whoami

```

输出内容如下：

```shell
root is not in the sudoers file.  This incident will be reported.

```

## 问题的风险及影响

无法通过 OCP Web 界面创建 OceanBase 数据库集群。

## 适用版本

- OCP 所有版本。
 - Ubuntu 或其它类 Debian 操作系统。

## 解决方法

通过比对正常环境上的 `/etc/sudoers` 配置文件，找到该问题的解决方法是将 root 用户添加到 `/etc/sudoers` 系统配置文件中去。

```shell
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

```

**备注：这边强烈推荐使用 `sudo visudo` 命令去修改 `/etc/sudoers` 配置文件（不要直接使用 vim 命令去编辑 `/etc/sudoers`），因为该命令会自动检查人为修改的语法是否包含非法的格式**。

## 规避方式

无。

上一篇

[ARM CPU 服务器下 OCP 持续 Hang、日志断打问题的解决](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000003505825)

下一篇

[升级常见问题](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000180019) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ) 咨询
