---
title: "OAT 初始化服务器日志报错 groupadd: command not found 的原因和解决方法-OceanBase数据库使用指南"
description: "了解OceanBase数据库在实际应用中关于OAT 初始化服务器日志报错 groupadd: command not found 的原因和解决方法相关的常见问题和使用技巧，帮助您快速解决OAT 初始化服务器日志报错 groupadd: command not found 的原因和解决方法的难题。"
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)划线反馈

# OAT 初始化服务器日志报错 groupadd: command not found 的原因和解决方法

更新时间：2026-06-24 08:16

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

## 问题现象

1. OAT 初始化服务器失败 `config os admin failed`，日志报错 `groupadd: command not found`。

   ```shell
   create admin user
   2 14:22:00 114:07:47
                   else
                        touch /home/"$admin_user"/$name
                   fi
                   chown "$admin user:$admin user"/hom /home/"$admin_user"/$name
              fi
   done

   [2024-11-12T14:22:00.540+0800] ERROR - bash: line 8: groupadd: command not found

   [2024-11-12T14:22:00.540+0800] INFO - create group ocean with gid 500 error!
   [2024-11-12T14:22:00.541+0800] ERROR - Task failed with exception
   Traceback (most recent call 1 1 last):
   File "/usr/local/lib/python3.9/site-packages/airflow/decoratorators/base :py", line 217, in execute
      return_value = super().execute(context)
   File "/usr/local/lib/pythons.9/site-packages/airflou/operators/python.py", line 175, in execute
      return_value = self.execute_callable()
   File "/usr/local/lib/pythons.9/site-packages/airflou/operators/python.py", line 192,in execute_callable
      return self.python_callable(*self.op_args,**self.op_kwargs)
   File "/oat/task_engine/dags/init_server_with_tag.py",line 51,in create_admin_user
     common.config os admin(ctx,logger)
   File"/oat/task engine/plugins/common-py", line 1813, in config_os_admin
      raise RuntimeError('config os admin failed')
   RuntimeError:config os admin failed
   [2024-11-12T14:22:00.548+0800] INFO - Marking task as FAILED. dag_id=init_server_with_tag, task_id=create_admin_user.........
   execution_date=2024112T060744,start_date=20241112T062200, end_date=20241112T062200
   [2024-11-12T14:22:00.568+0800] ERROR - Failed to execute job 93 for task create admin user (config os admin failed.......
   [2024-11-12T14:22:00.596+0800] INFO - Task exited with return code 1
   [2024-11-12T14:22:00.622+0800] INFO - 0 downstream tasks scheduled fr from follow-on schedule check

   ```
 2. 命令行测试 groupadd 却可以成功。

   ```shell
   [root@localhost install]# groupadd -g 500 ocean
   [root@localhost install]# cat /etc/group
   root:x:0:
   .....

   ```

## 问题原因

由于 PATH 环境变量配置的问题，在 OAT 内通过代码远程连接到对应服务器执行 groupadd 命令是找不到 groupadd 这个命令。

## 问题的风险及影响

OAT 初始化服务器失败。

## 影响租户

影响 OceanBase 数据库中的 SYS 租户和 Oracle 租户以及 MySQL 租户。

## 适用版本

OAT V3.x、V4.x 版本。

## 解决方法

1. 需要 ssh obadmin@ip  能执行。 这里只要把 groupadd 的路径加入到 bashrc 里面的 PATH 即可。在打开的文件中找到 PATH 变量的定义行，通常类似于 **/etc/bashrc 加一行 export PATH=$PATH:/usr/sbin**。

   ```shell
   # /etc/bashrc
   # system wide functions and aliases
   # environment stuff ff goes in /etc/profile

   # It's NOT a good idea to change this file unless you know what you
   # are doing. It's much better to create a custom.sh shell script in
   # /etc/profile.d/ to make custom changes to your environment, as this
   # will prevent the need for merging in future updates.

   # Prevent doublesourcing
   export PATH=$PATH://usr/sbin -- 此处为 /etc/bashrc 中添加的一行：export PATH=$PATH:/usr/sbin
   if [ -z $NASHRCSOURCED"]; then
   BASHRCSOURCED="Y"

   # are we an interactive shell?
   if [ $PS1 ];  then
   if[-z "$PROMPT_COMMAND" ]; then
   case $TERM in
   xterm*|vte*)
   if [ -e /etc/sysconfig/bash-prompt-xterm]; then
        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
   elif ["${VTE_VERSION:-0}" -ge 3405 ]; then
        PROMPT_COMMAND="_vte_prompt_command"
   else
        PROMPT_COMMAND="printf "\033]0;%s@%s:%s\097" "${USER}" "${HOSTNAME%%.*} " "${PW.......
   fi
   ;;
   screen*)
   if [ -e /etc/sysconfig/bash-prompt-screen ]; then
    PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
   else
   PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "$USERj" "$HOSTNAME%%.*}" "${pw.......
   fi
   ;;
   *)

   ```
 2. 在当前 SHELL 终端中执行 `source /etc/bashrc` 命令，可以立即生效修改的内容。
 3. 重试 OAT 上的失败任务。

Previous

[OAT precheck 内存/CPU/硬盘空间不足](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000284424)

Next

[OAT V4.2.1 版本启动失败的原因和解决方法](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000001260547) ![有帮助](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) 咨询
