openGauss
开源数据库
openGauss社区官网
开源社区
使用PTK卸载数据库时删除用户失败怎么办?
2022-08-18使用PTK卸载数据库时删除用户失败怎么办?
使用 PTK 卸载数据库时删除用户失败怎么办?
背景介绍:
PTK (Provisioning Toolkit)是一款针对 MogDB 数据库开发的软件安装和运维工具,旨在帮助用户更便捷地安装部署 MogDB 数据库。
如果用户想要运行 MogDB 或者 MogDB 的相关组件时,仅需要执行一行命令即可实现。
PTK 支持安装 MogDB 的操作系统众多,达到 22 个,后期还会不断增多。
本次在使用 PTK 卸载 mogdb 时,系统提示如下错误信息。
报错内容:
bash
[root@mogdb-kernel-0003 ~]# ptk uninstall -n mogdb2
=============================
global:
cluster_name: mogdb2
user: ommdoc
group: ommdoc
app_dir: /opt/mogdb/app
data_dir: /opt/mogdb/data
log_dir: /opt/mogdb/log
tool_dir: /opt/mogdb/tool
tmp_dir: /opt/mogdb/tmp
db_servers:
- host: ***.***.***.*** db_port: 28000
role: primary
az_name: AZ1
az_priority: 1
=============================
Do you really want to uninstall this cluster? Please confirm carefully[Y|Yes](default=N) y
Do you want to delete db data '/opt/mogdb/data'?[Y|Yes](default=N) y
Do you want to delete user 'ommdoc'?[Y|Yes](default=N) y
INFO[2022-08-18T10:13:21.187] check db dirs owner host=***.***.***.***INFO[2022-08-18T10:13:21.194] check db process status host=***.***.***.***INFO[2022-08-18T10:13:21.205] clean crontab host=***.***.***.***INFO[2022-08-18T10:13:21.264] kill ommdoc's processes host=***.***.***.***INFO[2022-08-18T10:13:21.355] remove files /opt/mogdb/app,/opt/mogdb/tool,/opt/mogdb/cm,/opt/mogdb/tmp,/opt/mogdb/data,/opt/mogdb/log host=***.***.***.***INFO[2022-08-18T10:13:21.477] delete os user ommdoc host=***.***.***.***ERRO[2022-08-18T10:13:21.513] error occur when uninstall, maybe there are some dirty file/dir need clean by your self manually
[***.***.***.***] failed to delete os user 'ommdoc': exit status 1, cmd: test -f /etc/sudoers.d/ommdoc && rm -f /etc/sudoers.d/ommdoc; userdel -rf ommdoc || [ $? -eq 6 ], output: userdel: failure while writing changes to /etc/passwd
[root@mogdb-kernel-0003 ~]#
解决办法:
进入/etc/passwd
文件,删除 ommdoc: x :20016:20013::/home/ommdoc:/bin/bash 即可删掉 ommdoc 用户。