This commit is contained in:
zj
2026-02-12 03:19:49 +08:00
parent 3d3d1aac26
commit 7b20993078

View File

@@ -2198,11 +2198,18 @@ def chroot_and_repair_grub(mount_point: str, target_disk: str,
# 检查 /boot 是否已挂载(在 chroot 内) # 检查 /boot 是否已挂载(在 chroot 内)
success, stdout, _ = run_command( success, stdout, _ = run_command(
chroot_cmd_prefix + ["mount", "|", "grep", "boot"], chroot_cmd_prefix + ["mount"],
"检查 /boot 挂载状态", "检查挂载状态",
timeout=5 timeout=5
) )
log_info(f"/boot 挂载状态: {stdout if success else '未显示或检查失败'}") if success:
boot_mounts = [line for line in stdout.split('\n') if 'boot' in line.lower()]
if boot_mounts:
log_info(f"/boot 挂载状态: {', '.join(boot_mounts)}")
else:
log_info("/boot 挂载状态: 未找到相关挂载")
else:
log_info("/boot 挂载状态: 检查失败")
# 方法1: 使用 grub2-editenv 创建 # 方法1: 使用 grub2-editenv 创建
editenv_cmd = None editenv_cmd = None