关机重启失败排查指引 查看电源按钮事件配置 cat /etc/acpi/handler.sh 查看事件处理脚本(部分发行版) 5. 手动测试 ACPI 是否能接收电源事件 plaintext acpilisten 监听 ACPI 事件(开另一个终端按电源按钮测试) 处理方法: 1. 启动 acpid 服务 plaintext systemctl start acpid CentOS 7+/Ubuntu service acpid start CentOS 6 2. 设置开机自启 plaintext systemctl enable acpid chkconfig acpid on CentOS 6 3. 如果 acpid 服务不存在,安装 ACPI 守护进程 plaintext yum install acpid CentOS/RHEL apt install acpid Ubuntu/Debian 4. 确保 powerbtn 事件配置正确,一般应包含: plaintext eventbutton[ /]power action/sbin/shutdown h now 预防措施: 确保 acpid 服务已安装并设置为开机自启 不要禁用或卸载 acpid 服务 在制作自定义镜像时,确认 acpid 服务已正确安装并启用 6. Windows 系统特有问题 现象: Windows 系统在关机/重启时可能因以下原因导致失败:系统更新正在安装、关机时等待用户交互(如”强制关机”弹窗)等。 排查方法: 1. 通过 VNC 或 TeleCloudShell 登录 Windows 实例 2. 检查 Windows 更新状态: 打开 设置 > 更新和安全 > Windows 更新,查看是否有更新正在安装 或在命令行中执行: 1. 查看 Windows 更新服务状态 plaintext GetService wuauserv 2. 查看最近的更新历史 plaintext wmic qfe list brief /format:table 3. 检查关机阻止程序: 查看是否有程序阻止关机 shutdown /g 4. 查看系统事件日志: 查看关机相关的事件日志 GetEventLog LogName System Source "User32" Newest 10 GetWinEvent FilterHashtable @{LogName'System'; ID1074,6006,6008} MaxEvents 10 处理方法: 等待 Windows 更新安装完成后再重试关机/重启 通过组策略禁用”关机时等待用户交互”:gpedit.msc > 计算机配置 > 管理模板 > 系统 > 关机选项 > 关闭阻止或取消关机的应用程序的自动终止功能 预防措施: 配置 Windows 更新在业务低峰期自动安装并重启 确保虚拟机中安装了 virtio 驱动和 QEMU Guest Agent