3x-ui/docs/Tasktracking/2026-04-23-fix-mariadb-restart-diagnostics.md
root eca9b219cf docs: add missing task tracking records for multi-node and traffic fixes
Add task tracking records for commits that were missing documentation:
- 2026-04-10: multi-node backend foundation (7 commits)
- 2026-04-15: improve mariadb flow and traffic flush
- 2026-04-23: install cron before acme.sh
- 2026-04-24: resolve client traffic InboundId from DB
- 2026-04-24: fix traffic flush blocked by stale inboundId=0 delta
2026-04-24 03:04:15 +08:00

1.6 KiB
Raw Blame History

Task Record: Fix MariaDB restart error diagnostics

Date: 2026-04-23 Related Module: install.sh, x-ui.sh — MariaDB service management Change Type: Fix

Background

用户在安装过程中选择本地 MariaDB 后,遇到 "重启 MariaDB 失败,请检查配置文件" 错误。该错误信息过于笼统,因为 restart_mariadb_service()start_mariadb_service() 函数使用 2>/dev/null 抑制了 stderr导致 systemctl 返回的实际错误信息被隐藏,无法定位根因。

Changes

  • restart_mariadb_service()install.sh + x-ui.sh移除 stderr 抑制,捕获 systemctl/rc-service 输出,失败时打印实际错误信息和 systemctl status 诊断输出
  • start_mariadb_service()install.sh + x-ui.shsystemctl start/enable 失败时使用 || true 避免 set -e 场景下脚本意外退出,保持行为一致

Impact

  • install.sh: restart_mariadb_service()start_mariadb_service()
  • x-ui.sh: restart_mariadb_service()start_mariadb_service()
  • 不影响功能逻辑,仅改善错误诊断输出
  • 无 API、数据库、配置变更

Verification

  • bash -n install.sh — syntax OK
  • bash -n x-ui.sh — syntax OK
  • bash tests/mariadb_install_switch_test.sh — PASS
  • bash tests/mariadb_admin_empty_password_test.sh — PASS
  • bash tests/install_uninstall_resilience_test.sh — PASS

Risks And Follow-Up

  • 无风险。改动仅影响错误输出,不改变控制流
  • 用户重新运行安装脚本后,应能看到 systemctl 实际报错原因(如配置文件语法错误、端口冲突等),可据此进一步定位