Skip to Content
文档参考故障排查双系统启动修复

常见问题

  • 安装 Windows 后 GRUB 被覆盖,直接进入 Windows
  • 安装 Ubuntu 后 Windows 启动项消失
  • GRUB 菜单不显示或报错 “error: no such partition”
  • 更新后启动顺序改变

从 Live USB 修复 GRUB

准备工作

  1. 使用 Ubuntu 26.04 Live USB 启动
  2. 选择 “Try Ubuntu” 进入 Live 环境

确认分区布局

# 列出所有分区 sudo fdisk -l # 确认 Ubuntu 根分区和 EFI 分区 # EFI 分区通常为 FAT32,约 100-512MB # Ubuntu 根分区通常为 ext4 lsblk -f

挂载并 chroot

# 挂载 Ubuntu 根分区(替换 sdXn 为实际分区) sudo mount /dev/sdX2 /mnt # 挂载 EFI 分区 sudo mount /dev/sdX1 /mnt/boot/efi # 绑定必要的虚拟文件系统 sudo mount --bind /dev /mnt/dev sudo mount --bind /dev/pts /mnt/dev/pts sudo mount --bind /proc /mnt/proc sudo mount --bind /sys /mnt/sys sudo mount --bind /run /mnt/run # 进入 chroot 环境 sudo chroot /mnt

重新安装 GRUB

# UEFI 系统 grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu # 更新 GRUB 配置 update-grub # 退出 chroot exit sudo umount -R /mnt sudo reboot

使用 boot-repair 工具

更简单的图形化修复方式:

# 在 Live USB 环境中 sudo add-apt-repository ppa:yannubuntu/boot-repair sudo apt update sudo apt install boot-repair # 启动 boot-repair boot-repair

点击 “Recommended repair” 进行自动修复。

手动管理 EFI 启动项

使用 efibootmgr

# 查看所有启动项 efibootmgr -v # 调整启动顺序(ubuntu 在前) sudo efibootmgr -o 0001,0000,0002 # 删除某个启动项 sudo efibootmgr -b 0003 -B # 添加新启动项 sudo efibootmgr -c -d /dev/sda -p 1 -L "Ubuntu" -l "\EFI\ubuntu\shimx64.efi"

常见启动项路径

系统EFI 路径
Ubuntu\EFI\ubuntu\shimx64.efi 或 \EFI\ubuntu\grubx64.efi
Windows\EFI\Microsoft\Boot\bootmgfw.efi

GRUB 配置

让 GRUB 检测 Windows

# 确保安装了 os-prober sudo apt install os-prober # 启用 os-prober(Ubuntu 26.04 默认可能禁用) sudo nano /etc/default/grub

确保包含以下行:

GRUB_DISABLE_OS_PROBER=false

更新 GRUB:

sudo update-grub

输出中应看到 “Found Windows Boot Manager” 之类的信息。

调整 GRUB 超时

sudo nano /etc/default/grub
GRUB_TIMEOUT=10 # 菜单等待秒数 GRUB_TIMEOUT_STYLE=menu # 始终显示菜单
sudo update-grub

设置默认启动项

# 查看菜单项编号 grep -E "menuentry|submenu" /boot/grub/grub.cfg | head -20 # 设置默认项(0 为第一项) sudo nano /etc/default/grub # GRUB_DEFAULT=0 # 或使用名称: # GRUB_DEFAULT="Windows Boot Manager (on /dev/sda1)" # 记住上次选择 # GRUB_DEFAULT=saved # GRUB_SAVEDEFAULT=true sudo update-grub

Windows 更新覆盖 GRUB

Windows 大版本更新可能重写 EFI 启动顺序。修复方法:

  1. 进入 BIOS/UEFI 设置,将 Ubuntu/GRUB 设为第一启动项
  2. 或使用 Live USB 按上述步骤重新安装 GRUB

时间不同步问题

双系统中 Windows 和 Ubuntu 时间显示不一致:

# 让 Ubuntu 使用本地时间(与 Windows 一致) timedatectl set-local-rtc 1 # 或让 Windows 使用 UTC(推荐) # 在 Windows 中运行: # reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /t REG_DWORD /d 1

安全启动(Secure Boot)

如果启用了 Secure Boot,确保 GRUB 使用签名的引导程序:

# 检查 Secure Boot 状态 mokutil --sb-state # Ubuntu 默认使用 shimx64.efi 处理 Secure Boot # 确认 shim 已安装 dpkg -l | grep shim-signed
Last updated on