优麒麟 2204 与 win10 双系统安装笔记

本文为 amd64 架构下 GPT 分区格式磁盘进行优麒麟 22.04 与 windows10 双系统引导的实操笔记。

1.安装优麒麟(操作:略)

这里的 linux 分区规划为:dev/sda1efi 分区,dev/sda2swap 分区,dev/sda3为根(/)分区,并留出足够的空间给 windows。

2.安装win10(操作:略)

在多余空间创建分区,并安装win10。这里分区时会提示将自动分配一个约了 16M 的保留空间

3.安装成功,重启电脑,发现直接进入优麒麟,且无windows启动菜单。

先测试一下几个文件:

1)查看efi分区

$ ls -al /boot/efi/EFI
总用量 20
drwxr-xr-x 5 root root 4096  7月 11 08:38 .
drwxr-xr-x 4 root root 4096  1月  1  1970 ..
drwxr-xr-x 2 root root 4096  7月  7 10:12 BOOT
drwxr-xr-x 4 root root 4096  7月 11 08:30 Microsoft
drwxr-xr-x 2 root root 4096  7月  7 10:12 ubuntu

如无意外,将会发现 /boot/efi/EFI 目录内存在 Microsoft 或者 ubuntu 这两个目录(也就是2个系统引导文件的目录),如没有,请尝试用其他办法解决。

2) 更新 grub 引导

$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/UKUI/theme.txt
Found linux image: /boot/vmlinuz-5.15.0-40-generic
Found initrd image: /boot/initrd.img-5.15.0-40-generic
Found linux image: /boot/vmlinuz-5.15.0-25-generic
Found initrd image: /boot/initrd.img-5.15.0-25-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

如果提示类似上面,也就是无法识别 windows 引导,可以试着用下面的解决办法,如果正常找到 windows 引导分区,恭喜你,下面的步骤可以省略了。不过我没这么好运…

4.关于2个解决办法:

1)修改 grub 配置文件,将 windows 启动项添加到启动菜单。

a. 改 /etc/grub.d/40_custom 文件

$ sudo vim /etc/grub.d/40_custom 
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry 'Microsoft Windows 10' {
        insmod part_gpt
        insmod ntfs
        insmod search_fs_uuid
        insmod chain
        search --fs-uuid --no-floppy --set=root 025C-7AC8     # 这里的025C-7AC8 是 efi 分区的 uuid ,可以通过blkid命令查看
        chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}

blkid 查看 uuid

$ blkid
...
/dev/sda1: UUID="025C-7AC8" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="b86b79c3-0733-4232-99dd-5c75de4872ad"
...

b. 更新 grub 启动菜单

$ sudo update-grub

重启电脑即可发现引导菜单中新增了 windows 10 启动项,并可正常启动windows。

2)直接从 EFI Bios 引导 windows

注意:这里的按键及界面都因主板的不同而有所差异,请根据情况选择。

重启,按 esc 进入bios界面,找到并进入 “UEFI Hard Disk Drive BBS Priorities”,将第一个启动项修改为 “Windows Boot Manager”,保存配置并重启电脑。即可直接进入 windows 了.

如想进入优麒麟22.04,重复上面操作并将第一个启动想修改为 “Ubuntu” 即可。

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值